-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.php
47 lines (38 loc) · 1.92 KB
/
lib.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
function local_addsectionforexam_extend_settings_navigation($settingsnav, $context) {
global $CFG , $PAGE;
// Verifier que l'on est dans un contexte de cours
if ($context == null || $context->contextlevel != CONTEXT_COURSE) {
return;
}
// Verifier qu'il y a bien le menu "Administration du cours"
if (null == ($courseadminnode = $settingsnav->get('courseadmin'))) {
return;
}
//Verifier que l'utilisateur a bien le droit de mettre à jour un cours
if (!has_capability('moodle/course:update', context_course::instance($PAGE->course->id))) {
return;
}
//Verifier que l'utilisateur a bien le droit de deplacer les sections d'un cours
if (!has_capability('moodle/course:movesections', context_course::instance($PAGE->course->id))) {
return;
}
//Créer l'adresse qui permet de supprimer le cours
$url = new moodle_url($CFG->wwwroot . '/local/addsectionforexam/addsectionforexam.php', array('id' => $context->instanceid));
//Ajouter une ligne au menu d'administration du cours
$courseadminnode->add(get_string('pluginname','local_addsectionforexam'), $url,navigation_node::TYPE_SETTING, null, 'addsectionforexam'.$context->instanceid, new pix_icon('i/folder', ''));
}