1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* Plugin administration pages are defined here.
|
|
|
19 |
*
|
|
|
20 |
* @package tool_courserating
|
|
|
21 |
* @category admin
|
|
|
22 |
* @copyright 2022 Marina Glancy <marina.glancy@gmail.com>
|
|
|
23 |
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
24 |
*/
|
|
|
25 |
|
|
|
26 |
defined('MOODLE_INTERNAL') || die();
|
|
|
27 |
|
|
|
28 |
if ($hassiteconfig) {
|
|
|
29 |
|
|
|
30 |
// Disable ratings in unittests by default, otherwise it breaks core tests.
|
|
|
31 |
$isunittest = defined('PHPUNIT_TEST') && PHPUNIT_TEST;
|
|
|
32 |
|
|
|
33 |
$temp = new admin_settingpage('tool_courserating', new lang_string('pluginname', 'tool_courserating'));
|
|
|
34 |
$el = new admin_setting_configselect('tool_courserating/' . \tool_courserating\constants::SETTING_RATINGMODE,
|
|
|
35 |
new lang_string('ratingmode', 'tool_courserating'),
|
|
|
36 |
new lang_string('ratingmodeconfig', 'tool_courserating'),
|
|
|
37 |
$isunittest ? \tool_courserating\constants::RATEBY_NOONE : \tool_courserating\constants::RATEBY_ANYTIME,
|
|
|
38 |
\tool_courserating\constants::rated_courses_options());
|
|
|
39 |
$el->set_updatedcallback('tool_courserating\task\reindex::schedule');
|
|
|
40 |
$temp->add($el);
|
|
|
41 |
|
|
|
42 |
$el = new admin_setting_configcheckbox('tool_courserating/' . \tool_courserating\constants::SETTING_PERCOURSE,
|
|
|
43 |
new lang_string('percourseoverride', 'tool_courserating'),
|
|
|
44 |
new lang_string('percourseoverrideconfig', 'tool_courserating'), 0);
|
|
|
45 |
$el->set_updatedcallback('tool_courserating\task\reindex::schedule');
|
|
|
46 |
$temp->add($el);
|
|
|
47 |
|
|
|
48 |
$el = new admin_setting_configcolourpicker('tool_courserating/' . \tool_courserating\constants::SETTING_STARCOLOR,
|
|
|
49 |
new lang_string('colorstar', 'tool_courserating'),
|
|
|
50 |
'', \tool_courserating\constants::SETTING_STARCOLOR_DEFAULT);
|
|
|
51 |
$el->set_updatedcallback('tool_courserating\task\reindex::schedule');
|
|
|
52 |
$temp->add($el);
|
|
|
53 |
|
|
|
54 |
$el = new admin_setting_configcolourpicker('tool_courserating/' . \tool_courserating\constants::SETTING_RATINGCOLOR,
|
|
|
55 |
new lang_string('colorrating', 'tool_courserating'),
|
|
|
56 |
new lang_string('colorratingconfig', 'tool_courserating'),
|
|
|
57 |
\tool_courserating\constants::SETTING_RATINGCOLOR_DEFAULT);
|
|
|
58 |
$el->set_updatedcallback('tool_courserating\task\reindex::schedule');
|
|
|
59 |
$temp->add($el);
|
|
|
60 |
|
|
|
61 |
$el = new admin_setting_configcheckbox('tool_courserating/' . \tool_courserating\constants::SETTING_DISPLAYEMPTY,
|
|
|
62 |
new lang_string('displayempty', 'tool_courserating'),
|
|
|
63 |
new lang_string('displayemptyconfig', 'tool_courserating'), 0);
|
|
|
64 |
$el->set_updatedcallback('tool_courserating\task\reindex::schedule');
|
|
|
65 |
$temp->add($el);
|
|
|
66 |
|
|
|
67 |
$el = new admin_setting_configcheckbox('tool_courserating/' . \tool_courserating\constants::SETTING_USEHTML,
|
|
|
68 |
new lang_string('usehtml', 'tool_courserating'),
|
|
|
69 |
new lang_string('usehtmlconfig', 'tool_courserating'), 0);
|
|
|
70 |
$temp->add($el);
|
|
|
71 |
|
|
|
72 |
$el = new admin_setting_configtext('tool_courserating/' . \tool_courserating\constants::SETTING_PARENTCSS,
|
|
|
73 |
new lang_string('parentcss', 'tool_courserating'),
|
|
|
74 |
new lang_string('parentcssconfig', 'tool_courserating'), '');
|
|
|
75 |
$temp->add($el);
|
|
|
76 |
|
|
|
77 |
$temp->add(new admin_setting_description('tool_courserating/description',
|
|
|
78 |
'',
|
|
|
79 |
new lang_string('settingsdescription', 'tool_courserating')));
|
|
|
80 |
|
|
|
81 |
$ADMIN->add('courses', $temp);
|
|
|
82 |
}
|