Proyectos de Subversion Moodle

Rev

Rev 492 | | Comparar con el anterior | Ultima modificación | Ver Log |

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