forked from emmarichardson/local_autogroup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.php
77 lines (68 loc) · 2.41 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?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/>.
/**
* autogroup local plugin
*
* This plugin automatically assigns users to a group within any course
* upon which they may be enrolled and which has auto-grouping
* configured.
*
* @package local_autogroup
* @copyright Mark Ward ([email protected])
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Functions within this file all conform to Moodle standard function names
* and are referred to by core Moodle code.
*
* Each of these functions are under the global namespace, so each
* function name should being with "local_autogroup" to prevent conflicts
*/
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/locallib.php');
if ($CFG->branch == '27') {
/**
* Generates the course settings navigation for Moodle 27
*
* @param settings_navigation $settingsnav
* @param context $context
* @return bool
* @throws coding_exception
*/
function local_autogroup_extends_settings_navigation(settings_navigation $settingsnav, context $context) {
if (!local_autogroup_plugin_is_enabled()) {
return false;
}
local_autogroup_amend_settings_structure($settingsnav, $context);
return true;
}
} else {
/**
* Generates the course settings navigation for Moodle 28 and higher
*
* @param settings_navigation $settingsnav
* @param context $context
* @return bool
* @throws coding_exception
*/
function local_autogroup_extend_settings_navigation(settings_navigation $settingsnav, context $context) {
if (!local_autogroup_plugin_is_enabled()) {
return false;
}
local_autogroup_amend_settings_structure($settingsnav, $context);
return true;
}
}