-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccountmanager.php
More file actions
80 lines (65 loc) · 2.69 KB
/
accountmanager.php
File metadata and controls
80 lines (65 loc) · 2.69 KB
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
78
79
80
<?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/>.
/**
* @package local_edusupport
* @copyright 2022 Thomas Winkler
* @author Thomas Winkler
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace local_edusupport;
require_once('../../config.php');
use local_edusupport\form\accountmanager_form;
use moodle_url;
use stdClass;
$context = \context_system::instance();
// Set PAGE variables.
$PAGE->set_context($context);
$PAGE->set_url($CFG->wwwroot . '/local/edusupport/accountmanager.php');
// Force the user to login/create an account to access this page.
require_login();
$PAGE->set_pagelayout('admin');
$accountmanager = new accountmanager();
$title = get_string('accountmanagers', 'local_edusupport');
$heading = get_string('accountmanagers', 'local_edusupport');
$mform = new accountmanager_form();
$PAGE->set_title($title);
$PAGE->set_heading($heading);
$url = new \moodle_url('/admin/search.php', []);
$PAGE->navbar->add(get_string('administrationsite'), $url);
$url = new \moodle_url('/admin/category.php', ['category' => 'modules']);
$PAGE->navbar->add(get_string('plugins', 'core_admin'), $url);
$url = new \moodle_url('/admin/category.php', ['category' => 'localplugins']);
$PAGE->navbar->add(get_string('localplugins'), $url);
$url = new \moodle_url('/admin/settings.php', ['section' => 'local_edusupport_settings']);
$PAGE->navbar->add(get_string('pluginname', 'local_edusupport'), $url);
$PAGE->navbar->add(get_string('supporters', 'local_edusupport'), $PAGE->url);
if (!is_siteadmin()) {
$tourl = new moodle_url('/my', []);
echo $OUTPUT->render_from_template('local_edusupport/alert', [
'content' => get_string('missing_permission', 'local_edusupport'),
'type' => 'danger',
'url' => $tourl->__toString(),
]);
}
if ($mform->is_cancelled()) {
redirect($url);
} else if ($data = $mform->get_data()) {
$accountmanager->form_to_config_edusupport_accountmanager($data->possiblemanagers, $data->capstocheck);
}
echo $OUTPUT->header();
$mform->set_data(new stdClass());
$mform->display();
echo $OUTPUT->footer();