1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* Global settings definition for block dash.
|
|
|
19 |
* @package block_dash
|
|
|
20 |
* @copyright 2020 bdecent gmbh <https://bdecent.de>
|
|
|
21 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
22 |
*/
|
|
|
23 |
|
|
|
24 |
defined('MOODLE_INTERNAL') || die;
|
|
|
25 |
|
|
|
26 |
if ($ADMIN->fulltree) {
|
|
|
27 |
|
|
|
28 |
require_once("$CFG->dirroot/blocks/dash/lib.php");
|
|
|
29 |
|
|
|
30 |
// Default high scores.
|
|
|
31 |
$settings->add(new admin_setting_configselect(
|
|
|
32 |
'block_dash/bootstrap_version',
|
|
|
33 |
get_string('bootstrapversion', 'block_dash'),
|
|
|
34 |
get_string('bootstrapversion_desc', 'block_dash'),
|
|
|
35 |
block_dash_is_totara() ? 3 : 4,
|
|
|
36 |
[
|
|
|
37 |
3 => 'Bootstrap 3.x',
|
|
|
38 |
4 => 'Bootstrap 4.x',
|
|
|
39 |
]
|
|
|
40 |
));
|
|
|
41 |
|
|
|
42 |
// Css classes.
|
|
|
43 |
$settings->add(new admin_setting_configtext(
|
|
|
44 |
'block_dash/cssclass',
|
|
|
45 |
get_string('cssclass', 'block_dash'),
|
|
|
46 |
get_string('cssclass_help', 'block_dash'),
|
|
|
47 |
'',
|
|
|
48 |
PARAM_TEXT
|
|
|
49 |
));
|
|
|
50 |
|
|
|
51 |
$settings->add(new admin_setting_configselect(
|
|
|
52 |
'block_dash/showheader',
|
|
|
53 |
get_string('showheader', 'block_dash'),
|
|
|
54 |
get_string('showheader_help', 'block_dash'),
|
|
|
55 |
1,
|
|
|
56 |
[
|
|
|
57 |
|
|
|
58 |
1 => get_string('visible'),
|
|
|
59 |
]
|
|
|
60 |
));
|
|
|
61 |
|
|
|
62 |
$settings->add(new admin_setting_configselect(
|
|
|
63 |
'block_dash/hide_when_empty',
|
|
|
64 |
get_string('hidewhenempty', 'block_dash'),
|
|
|
65 |
get_string('hidewhenempty_desc', 'block_dash'),
|
|
|
66 |
0,
|
|
|
67 |
[
|
|
|
68 |
|
|
|
69 |
1 => get_string('yes'),
|
|
|
70 |
]
|
|
|
71 |
));
|
|
|
72 |
|
|
|
73 |
$settings->add(new admin_setting_configcheckbox(
|
|
|
74 |
'block_dash/disableall',
|
|
|
75 |
get_string('disableall', 'block_dash'),
|
|
|
76 |
get_string('disableall_help', 'block_dash'),
|
|
|
77 |
|
|
|
78 |
));
|
|
|
79 |
|
|
|
80 |
$settings->add(new admin_setting_configcheckbox(
|
|
|
81 |
'block_dash/exportdata',
|
|
|
82 |
get_string('defaultexportdata', 'block_dash'),
|
|
|
83 |
get_string('defaultexportdata_help', 'block_dash'),
|
|
|
84 |
|
|
|
85 |
));
|
|
|
86 |
|
|
|
87 |
$settings->add(new admin_setting_configtext(
|
|
|
88 |
'block_dash/suggestinterests',
|
|
|
89 |
get_string('suggestinterests', 'block_dash'),
|
|
|
90 |
get_string('suggestinterests_desc', 'block_dash'), 0, PARAM_INT)
|
|
|
91 |
);
|
|
|
92 |
|
|
|
93 |
$settings->add(new admin_setting_configtext(
|
|
|
94 |
'block_dash/suggestcohort',
|
|
|
95 |
get_string('suggestcohort', 'block_dash'),
|
|
|
96 |
get_string('suggestcohort_desc', 'block_dash'), 0, PARAM_INT)
|
|
|
97 |
);
|
|
|
98 |
|
|
|
99 |
$settings->add(new admin_setting_configtext(
|
|
|
100 |
'block_dash/suggestgroups',
|
|
|
101 |
get_string('suggestgroups', 'block_dash'),
|
|
|
102 |
get_string('suggestgroups_desc', 'block_dash'), 0, PARAM_INT)
|
|
|
103 |
);
|
|
|
104 |
|
|
|
105 |
$users = block_dash_get_suggest_users();
|
|
|
106 |
$settings->add(new admin_setting_configmultiselect(
|
|
|
107 |
'block_dash/suggestusers',
|
|
|
108 |
get_string('suggestusers', 'block_dash'),
|
|
|
109 |
get_string('suggestusers_desc', 'block_dash'), [], $users)
|
|
|
110 |
);
|
|
|
111 |
|
|
|
112 |
if ($ADMIN->fulltree) {// Category images.
|
|
|
113 |
|
|
|
114 |
$settings->add(new admin_setting_heading('block_dash_categoryimg', get_string('categoryimgheadingsub', 'block_dash'),
|
|
|
115 |
format_text(get_string('categoryimgdesc', 'block_dash'), FORMAT_MARKDOWN)));
|
|
|
116 |
|
|
|
117 |
$name = 'block_dash/categoryimgfallback';
|
|
|
118 |
$title = get_string('categoryimgfallback', 'block_dash');
|
|
|
119 |
$description = get_string('categoryimgfallbackdesc', 'block_dash');
|
|
|
120 |
$default = 'categoryimg';
|
|
|
121 |
$setting = new admin_setting_configstoredfile($name, $title, $description, $default, 0);
|
|
|
122 |
$setting->set_updatedcallback('theme_reset_all_caches');
|
|
|
123 |
$settings->add($setting);
|
|
|
124 |
|
|
|
125 |
$coursecats = core_course_category::make_categories_list();
|
|
|
126 |
|
|
|
127 |
// Go through all categories and create the necessary settings.
|
|
|
128 |
foreach ($coursecats as $key => $value) {
|
|
|
129 |
// Category Icons for each category.
|
|
|
130 |
$name = 'block_dash/categoryimg';
|
|
|
131 |
$title = $value;
|
|
|
132 |
$description = get_string('categoryimgcategory', 'block_dash', ['category' => $value]);
|
|
|
133 |
$filearea = 'categoryimg';
|
|
|
134 |
$setting = new admin_setting_configstoredfile($name . $key, $title, $description, $default, $key);
|
|
|
135 |
$setting->set_updatedcallback('theme_reset_all_caches');
|
|
|
136 |
$settings->add($setting);
|
|
|
137 |
}
|
|
|
138 |
unset($coursecats);
|
|
|
139 |
}
|
|
|
140 |
|
|
|
141 |
$PAGE->requires->js_amd_inline("
|
|
|
142 |
require(['core/form-autocomplete'], function(module) {
|
|
|
143 |
module.enhance('#id_s_block_dash_suggestusers');
|
|
|
144 |
});
|
|
|
145 |
");
|
|
|
146 |
|
|
|
147 |
}
|