-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathcss.php
55 lines (48 loc) · 1.86 KB
/
css.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
<?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/>.
/**
* Completion Progress block runtime configured styles.
*
* @package block_completion_progress
* @copyright 2020 Jonathon Fowler
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_DEBUG_DISPLAY', true);
define('NO_MOODLE_COOKIES', true);
define('NO_UPGRADE_CHECK', true);
require_once(__DIR__ . '/../../config.php');
require_once($CFG->libdir.'/filelib.php');
$cachevalue = optional_param('v', -1, PARAM_INT);
$css = '';
// Emit colours configuration.
$colours = [
'completed' => 'completed_colour',
'submittedNotComplete' => 'submittednotcomplete_colour',
'notCompleted' => 'notCompleted_colour',
'futureNotCompleted' => 'futureNotCompleted_colour',
];
foreach ($colours as $classname => $stringkey) {
$colour = get_config('block_completion_progress', $stringkey) ?:
get_string($stringkey, 'block_completion_progress');
$css .= ".block_completion_progress .progressBarCell.$classname { ";
$css .= "background-color: $colour;";
$css .= " }\n";
}
if ($cachevalue < 0) {
send_content_uncached($css, 'styles.css');
} else {
send_file($css, 'styles.css', null, 0, true, false, '', false, ['immutable' => true]);
}