Proyectos de Subversion Moodle

Rev

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

<?php

class block_cursos_recientes_ajax extends block_base
{
    public function init()
    {
        $this->title = get_string('pluginname', 'block_cursos_recientes_ajax');
    }

    // if you have a settings.php file
    public function has_config()
    {
        return false;
    }

    public function hide_header()
    {
        return false;
    }

    public function get_content()
    {
        global $PAGE;
        $PAGE->requires->js('/blocks/cursos_recientes_ajax/js/cursos_recientes_ajax.js');

        if (isset($this->content)) {
            return $this->content;
        } else {
            $this->content  = new \stdClass();
        }

        $renderer = $this->page->get_renderer('block_cursos_recientes_ajax');

        $this->content = new \stdClass();
        $this->content->text = $renderer->procesar();
        return $this->content;
    }

    public function instance_allow_multiple()
    {
        return false;
    }


    public function get_config_for_external()
    {
        // Return all settings for all users since it is safe (no private keys, etc..).
        $configs = get_config('block_cursos_recientes_ajax');

        return (object) [
            'instance' => new stdClass(),
            'plugin' => $configs,
        ];
    }
}