Proyectos de Subversion Moodle

Rev

Rev 259 | Rev 264 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 259 Rev 261
Línea 1... Línea 1...
1
<?php
1
<?php
2
require_once(__DIR__ . '/cesa.php');
2
require_once(__DIR__ . '/cesa.php');
Línea 3... Línea 3...
3
 
3
 
4
class StaticsBlocks extends Cesa
4
class StaticsBlocks extends Cesa
-
 
5
{
5
{
6
 
6
    public function __construct($title)
7
    public function __construct($title)
7
    {
8
    {
8
        global $USER, $PAGE, $SITE;
9
        global $USER, $PAGE, $SITE;
Línea 15... Línea 16...
15
        $this->userID = optional_param('userid', $USER->id, PARAM_INT);
16
        $this->userID = optional_param('userid', $USER->id, PARAM_INT);
16
        $this->currentUser = $this->userID == $USER->id;
17
        $this->currentUser = $this->userID == $USER->id;
17
        $this->user = core_user::get_user($this->userID);
18
        $this->user = core_user::get_user($this->userID);
18
        $this->title = get_string($title);
19
        $this->title = get_string($title);
19
        $this->blockManager = $PAGE->blocks;
20
        $this->blockManager = $PAGE->blocks;
-
 
21
 
-
 
22
        // Definimos varias regiones
20
        $this->regionName = 'side-post'; // Puedes cambiar la región si lo necesitas
23
        $regions = ['side-pre', 'side-post'];
-
 
24
 
-
 
25
        // Definir los nombres de los bloques
21
        $this->blockNames = ['cesa_course_rating', 'comments', 'mynotes'];
26
        $this->blockNames = ['cesa_course_rating', 'comments', 'messageteacher'];
22
        $this->blockExists = true;
27
        $this->blockExists = true;
Línea 23... Línea 28...
23
 
28
 
24
        if (!$this->user || !core_user::is_real_user($this->userID)) {
29
        if (!$this->user || !core_user::is_real_user($this->userID)) {
25
            throw new moodle_exception('invaliduser', 'error');
30
            throw new moodle_exception('invaliduser', 'error');
-
 
31
        }
-
 
32
 
-
 
33
        // Asignar los bloques a las dos regiones
-
 
34
        foreach ($regions as $region) {
-
 
35
            foreach ($this->blockNames as $blockName) {
-
 
36
                // Añadir el bloque a la región actual
-
 
37
                $this->blockManager->add_block($blockName, $region);
-
 
38
            }
26
        }
39
        }
Línea 27... Línea 40...
27
    }
40
    }
28
 
41
 
29
    public function renderBlocks()
42
    public function renderBlocks()