-
Notifications
You must be signed in to change notification settings - Fork 5
/
settings.php
116 lines (100 loc) · 4.2 KB
/
settings.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?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/>.
/**
* Settings file
*
* @package block_studentstracker
* @copyright 2021 Pierre Duverneix
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
require_once("$CFG->dirroot/blocks/studentstracker/locallib.php");
if ($ADMIN->fulltree) {
global $DB;
$roles = $DB->get_records('role');
$rolesarray = array();
$defaultroleid = 5;
foreach ($roles as $role) {
if ($role->archetype === 'student') {
$defaultroleid = $role->id;
}
$rolesarray[$role->id] = $role->shortname;
}
$settings->add(new admin_setting_configtext(
'studentstracker/trackingdays',
get_string('days', 'block_studentstracker'),
get_string('days_desc', 'block_studentstracker'), '3'));
$settings->add(new admin_setting_configtext(
'studentstracker/trackingdayscritical',
get_string('days_critical', 'block_studentstracker'),
get_string('days_critical_desc', 'block_studentstracker'),
'6'));
$settings->add(new admin_setting_configcolourpicker(
'studentstracker/colordays',
get_string('color_days', 'block_studentstracker'),
get_string('color_days_desc', 'block_studentstracker'),
'#FFD9BA', null));
$settings->add(new admin_setting_configcolourpicker(
'studentstracker/colordayscritical',
get_string('color_days_critical', 'block_studentstracker'),
get_string('color_days_critical_desc', 'block_studentstracker'),
'#FECFCF', null));
$settings->add(new admin_setting_configcolourpicker(
'studentstracker/colordaysnever',
get_string('color_never', 'block_studentstracker'),
get_string('color_never_desc', 'block_studentstracker'),
'#e0e0e0', null));
$settings->add(new admin_setting_configmultiselect(
'studentstracker/roletrack',
get_string('roletrack', 'block_studentstracker'),
get_string('roletrack_desc', 'block_studentstracker'),
array($defaultroleid),
$rolesarray));
$settings->add(new admin_setting_configtext(
'studentstracker/truncate',
get_string('truncate', 'block_studentstracker'),
get_string('truncate_desc', 'block_studentstracker'), '10'));
$settings->add(new admin_setting_configtext(
'studentstracker/excludeolder',
get_string('excludeolder', 'block_studentstracker'),
get_string('excludeolder_desc', 'block_studentstracker'), ''));
$default = 'd/m/Y H:i';
$choices['d/m/Y H:i'] = 'd/m/Y H:i';
$choices['m/d/Y H:i'] = 'm/d/Y H:i';
$choices['d/m/Y'] = 'd/m/Y';
$choices['m/d/Y'] = 'm/d/Y';
$settings->add(new admin_setting_configselect(
'studentstracker/dateformat',
get_string('dateformat', 'block_studentstracker'),
get_string('dateformat_desc', 'block_studentstracker'),
$default,
$choices));
unset($default);
unset($choices);
$default = 'date_desc';
$choices['id'] = 'id';
$choices['lastname'] = get_string('lastname', 'core');
$choices['firstname'] = get_string('firstname', 'core');
$choices['email'] = get_string('email', 'core');
$choices['date_asc'] = get_string('date_asc', 'block_studentstracker');
$choices['date_desc'] = get_string('date_desc', 'block_studentstracker');
$settings->add(new admin_setting_configselect(
'studentstracker/sorting',
get_string('sorting', 'block_studentstracker'),
get_string('sorting_desc', 'block_studentstracker'),
$default,
$choices));
}