-
Notifications
You must be signed in to change notification settings - Fork 3
/
manageroverview.php
67 lines (52 loc) · 2.19 KB
/
manageroverview.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
<?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/>.
/**
* Overview for evasys course managers.
*
* @package block_evasys_sync
* @copyright 2022 Justus Dieckmann WWU
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use block_evasys_sync\evalcat_manager;
require_once(__DIR__ . '/../../config.php');
global $CFG, $OUTPUT, $PAGE;
require_once($CFG->libdir . '/tablelib.php');
require_login();
$usercats = evalcat_manager::get_instance()->get_user_categories();
if (count($usercats) === 0) {
throw new coding_exception('You do not have permission to manage any course evaluations!');
} else if (count($usercats) === 1) {
redirect(new moodle_url('/blocks/evasys_sync/managecategory.php', ['id' => $usercats[0]]));
}
$PAGE->set_url(new moodle_url('/blocks/evasys_sync/manageroverview.php'));
$PAGE->set_context(context_system::instance());
$PAGE->set_title(get_string('evasys_sync', 'block_evasys_sync'));
$PAGE->navigation->add('EvaSys', new moodle_url('/blocks/evasys_sync/manageroverview.php'));
$categories = evalcat_manager::get_instance()->get_categories();
$table = new flexible_table('block_evasys_sync-manageroverview');
echo $OUTPUT->header();
$table->define_headers(['']);
$table->define_columns(['column']);
$table->define_baseurl($PAGE->url);
$table->setup();
foreach ($usercats as $usercat) {
$table->add_data([
html_writer::link(new moodle_url('/blocks/evasys_sync/managecategory.php', ['id' => $usercat]),
core_course_category::get($usercat)->name)
]);
}
$table->finish_output();
echo $OUTPUT->footer();