Proyectos de Subversion Moodle

Rev

Rev 1293 | Rev 1295 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
256 ariadna 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
901 ariadna 17
namespace theme_universe_child\output;
256 ariadna 18
 
19
use html_writer;
20
use stdClass;
21
use moodle_url;
22
use context_course;
23
use context_system;
24
use core_course_list_element;
25
use custom_menu;
26
use action_menu_filler;
27
use action_menu_link_secondary;
28
use action_menu;
29
use action_link;
30
use core_text;
31
use coding_exception;
32
use navigation_node;
33
use context_header;
891 ariadna 34
use core\oauth2\rest;
256 ariadna 35
use pix_icon;
36
use renderer_base;
37
use theme_config;
38
use get_string;
39
use core_course_category;
40
use theme_universe\util\user;
41
use theme_universe\util\course;
901 ariadna 42
use core_completion\progress;
256 ariadna 43
 
44
require_once($CFG->dirroot . '/cesa/statics_blocks.php'); // Incluimos StaticsBlocks
45
 
46
 
47
/**
48
 * Renderers to align Moodle's HTML with that expected by Bootstrap
49
 *
50
 * @package    theme_universe
51
 * @copyright  2023 Marcin Czaja (https://rosea.io)
52
 * @license    Commercial https://themeforest.net/licenses
53
 */
1291 ariadna 54
class core_renderer extends \theme_universe\output\core_renderer
55
{
56
 
57
    public function render_statics_blocks($userid = null)
58
    {
59
        global $USER;
60
 
61
        if (!$userid) {
62
            $userid = $USER->id;
63
        }
64
 
65
        // Instanciamos StaticsBlocks para renderizar los bloques
66
        $statics_blocks = new \StaticsBlocks(
67
            'side-pre',
68
            ['messageteacher', 'comments', 'cesa_course_rating', 'cesa_notes']
69
        );
70
 
71
        $blocks = $statics_blocks->renderBlocks();
72
 
73
        return $blocks;
74
    }
1294 ariadna 75
 
76
    function universe_child_course_drawer(): string
77
    {
78
        global $PAGE;
79
 
80
        // If the course index is explicitly set and if it should be hidden.
81
        if ($PAGE->get_show_course_index() === false) {
82
            return '';
83
        }
84
 
85
        // Only add course index on non-site course pages.
86
        if (!$PAGE->course || $PAGE->course->id == SITEID) {
87
            return '';
88
        }
89
 
90
        // Show course index to users can access the course only.
91
        if (!can_access_course($PAGE->course, null, '', true)) {
92
            return '';
93
        }
94
 
95
        $format = course_get_format($PAGE->course);
96
        $renderer = $format->get_renderer($PAGE);
97
        if (method_exists($renderer, 'course_index_drawer')) {
98
            return $this->render_from_template('theme_universe_child/courseindex/drawer', []);
99
        }
100
 
101
        return '';
102
    }
1291 ariadna 103
}