Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1453 ariadna 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
        if (isset($this->content)) {
27
            return $this->content;
28
        } else {
29
            $this->content  = new \stdClass();
30
        }
31
 
32
        $renderer = $this->page->get_renderer('block_cursos_recientes_ajax');
33
 
34
        $this->content = new \stdClass();
35
        $this->content->text = $renderer->procesar();
36
        return $this->content;
37
    }
38
 
39
    public function instance_allow_multiple()
40
    {
41
        return false;
42
    }
43
 
44
 
45
    public function get_config_for_external()
46
    {
47
        // Return all settings for all users since it is safe (no private keys, etc..).
48
        $configs = get_config('block_cursos_recientes_ajax');
49
 
50
        return (object) [
51
            'instance' => new stdClass(),
52
            'plugin' => $configs,
53
        ];
54
    }
55
}