Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 32... Línea 32...
32
 */
32
 */
33
class secondary extends core_secondary {
33
class secondary extends core_secondary {
34
    protected function get_default_module_mapping(): array {
34
    protected function get_default_module_mapping(): array {
35
        $basenodes = parent::get_default_module_mapping();
35
        $basenodes = parent::get_default_module_mapping();
36
        $basenodes[self::TYPE_CUSTOM] += [
36
        $basenodes[self::TYPE_CUSTOM] += [
-
 
37
            'questionnode' => 2,
37
            'templatenode' => 12,
38
            'templatenode' => 3,
38
            'mapcourse' => 13,
39
            'responses' => 4,
39
            'feedbackanalysis' => 14,
40
            'nonrespondents' => 4.1,
40
            'responses' => 15,
41
            'feedbackanalysis' => 5,
41
            'nonrespondents' => 15.1
42
            'mapcourse' => 12,
42
        ];
43
        ];
Línea 43... Línea 44...
43
 
44
 
44
        return $basenodes;
45
        return $basenodes;
45
    }
-
 
46
 
-
 
47
    /**
-
 
48
     * Custom module construct for feedback
-
 
49
     *
-
 
50
     * @param settings_navigation $settingsnav The settings navigation object related to the module page
-
 
51
     * @param navigation_node|null $rootnode The node where the module navigation nodes should be added into as children.
-
 
52
     *                                       If not explicitly defined, the nodes will be added to the secondary root
-
 
53
     *                                       node by default.
-
 
54
     */
-
 
55
    protected function load_module_navigation(settings_navigation $settingsnav, ?navigation_node $rootnode = null): void {
-
 
56
        $rootnode = $rootnode ?? $this;
-
 
57
        $mainnode = $settingsnav->find('modulesettings', self::TYPE_SETTING);
-
 
58
        $nodes = $this->get_default_module_mapping();
-
 
59
 
-
 
60
        if ($mainnode) {
-
 
61
            $url = new \moodle_url('/mod/' . $this->page->activityname . '/view.php', ['id' => $this->page->cm->id]);
-
 
62
            $setactive = $url->compare($this->page->url, URL_MATCH_BASE);
-
 
63
            $node = $rootnode->add(get_string('modulename', 'feedback'), $url, null, null, 'modulepage');
-
 
64
            if ($setactive) {
-
 
65
                $node->make_active();
-
 
66
            }
-
 
67
 
-
 
68
            // Add the initial nodes.
-
 
69
            $nodesordered = $this->get_leaf_nodes($mainnode, $nodes);
-
 
70
            $this->add_ordered_nodes($nodesordered, $rootnode);
-
 
71
 
-
 
72
            // Reorder the existing nodes in settings so the active node scan can pick it up.
-
 
73
            $existingnode = $settingsnav->find('questionnode', self::TYPE_CUSTOM);
-
 
74
            if ($existingnode) {
-
 
75
                $node->add_node($existingnode);
-
 
76
                $nodes[self::TYPE_CUSTOM] += ['questionnode' => 3];
-
 
77
            }
-
 
78
            // We have finished inserting the initial structure.
-
 
79
            // Populate the menu with the rest of the nodes available.
-
 
80
            $this->load_remaining_nodes($mainnode, $nodes, $rootnode);
-
 
81
        }
-
 
82
    }
46
    }