2011-11-14 01:29:21 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function afterburner_process_css($css, $theme) {
|
|
|
|
|
2011-11-24 11:31:11 +08:00
|
|
|
// Set the background image for the logo
|
2013-04-10 13:10:00 +02:00
|
|
|
$logo = $theme->setting_file_url('logo', 'logo');
|
2013-11-08 13:15:23 +08:00
|
|
|
$css = afterburner_set_logo($css, $logo, $theme);
|
2011-11-14 01:29:21 +00:00
|
|
|
|
|
|
|
// Set custom CSS
|
|
|
|
if (!empty($theme->settings->customcss)) {
|
|
|
|
$customcss = $theme->settings->customcss;
|
|
|
|
} else {
|
|
|
|
$customcss = null;
|
|
|
|
}
|
|
|
|
$css = afterburner_set_customcss($css, $customcss);
|
|
|
|
|
|
|
|
return $css;
|
|
|
|
}
|
|
|
|
|
2013-11-08 13:15:23 +08:00
|
|
|
function afterburner_set_logo($css, $logo, $theme) {
|
2011-11-24 11:31:11 +08:00
|
|
|
$tag = '[[setting:logo]]';
|
|
|
|
$replacement = $logo;
|
|
|
|
if (is_null($replacement)) {
|
2013-11-08 13:15:23 +08:00
|
|
|
$replacement = $theme->pix_url('images/logo','theme');
|
2011-11-24 11:31:11 +08:00
|
|
|
}
|
2011-11-14 01:29:21 +00:00
|
|
|
|
2011-11-24 11:31:11 +08:00
|
|
|
$css = str_replace($tag, $replacement, $css);
|
2011-11-14 01:29:21 +00:00
|
|
|
|
2011-11-24 11:31:11 +08:00
|
|
|
return $css;
|
2011-11-14 01:29:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function afterburner_set_customcss($css, $customcss) {
|
|
|
|
$tag = '[[setting:customcss]]';
|
|
|
|
$replacement = $customcss;
|
|
|
|
if (is_null($replacement)) {
|
|
|
|
$replacement = '';
|
|
|
|
}
|
|
|
|
|
2011-11-24 11:31:11 +08:00
|
|
|
$css = str_replace($tag, $replacement, $css);
|
2011-11-14 01:29:21 +00:00
|
|
|
|
2011-11-24 11:31:11 +08:00
|
|
|
return $css;
|
2013-04-10 13:10:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function theme_afterburner_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
|
|
|
|
if ($context->contextlevel == CONTEXT_SYSTEM and $filearea === 'logo') {
|
|
|
|
$theme = theme_config::load('afterburner');
|
|
|
|
return $theme->setting_file_serve('logo', $args, $forcedownload, $options);
|
|
|
|
} else {
|
|
|
|
send_file_not_found();
|
|
|
|
}
|
|
|
|
}
|