Proyectos de Subversion Moodle

Rev

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

<?php

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

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

    public function hide_header()
    {
        return false;
    }

    function html_attributes()
    {
        $attributes = array(
            'id' => 'inst' . $this->instance->id,
            'class' => 'block_' . $this->name() . ' block' . ' container',
            'role' => $this->get_aria_role()
        );
        if ($this->hide_header()) {
            $attributes['class'] .= ' no-header';
        }
        if ($this->instance_can_be_docked() && get_user_preferences('docked_block_instance_' . $this->instance->id, 0)) {
            $attributes['class'] .= ' dock_on_load';
        }
        return $attributes;
    }

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


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


        $renderer = $this->page->get_renderer('block_cursos_catalogo_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_catalogo_ajax');

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