Proyectos de Subversion Moodle

Rev

Rev 492 | Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
class block_cursos_recientes_ajax extends block_base
4
{
5
    public function init()
6
    {
7
        $this->title = get_string('pluginname', 'block_cursos_recientes_ajax');
8
    }
9
 
10
    // if you have a settings.php file
11
    public function has_config()
12
    {
13
        return false;
14
    }
15
 
16
    public function hide_header()
17
    {
18
        return false;
19
    }
20
 
21
    public function get_content()
22
    {
23
        global $PAGE;
24
        $PAGE->requires->js('/blocks/cursos_recientes_ajax/js/cursos_recientes_ajax.js');
25
 
26
 
27
      if (isset($this->content)) {
28
          return $this->content;
29
      } else {
30
          $this->content  = new stdClass();
31
 
32
      }
33
 
34
 
35
 
36
      $renderer = $this->page->get_renderer('block_cursos_recientes_ajax');
37
 
38
 
39
 
40
 
41
      $this->content->text = $renderer->procesar();
42
      return $this->content;
43
 
44
    }
45
 
46
    public function instance_allow_multiple()
47
    {
48
        return false;
49
    }
50
 
51
 
52
    public function get_config_for_external() {
53
        // Return all settings for all users since it is safe (no private keys, etc..).
54
        $configs = get_config('block_cursos_recientes_ajax');
55
 
56
        return (object) [
57
            'instance' => new stdClass(),
58
            'plugin' => $configs,
59
        ];
60
    }
61
}