MDL-30243 Add custom settings to theme_afterburner
This commit is contained in:
@@ -130,4 +130,6 @@ $THEME->layouts = array(
|
||||
|
||||
$THEME->enable_dock = true;
|
||||
|
||||
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
|
||||
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
|
||||
|
||||
$THEME->csspostprocess = 'afterburner_process_css';
|
||||
@@ -26,6 +26,12 @@
|
||||
$string['pluginname'] = 'Afterburner';
|
||||
$string['region-side-post'] = 'Right';
|
||||
$string['region-side-pre'] = 'Left';
|
||||
$string['logo'] = 'Logo';
|
||||
$string['logodesc'] = 'Please add the URL to your new logo only if you want to replace the default logo for this theme.<br />For your information, the default logo is a JPG image 320px (wide) by 75px (high)';
|
||||
$string['footnote'] = 'Footnote';
|
||||
$string['footnotedesc'] = 'Whatever you add to this textarea will be displayed in the footer of every page.';
|
||||
$string['customcss'] = 'Custom CSS';
|
||||
$string['customcssdesc'] = 'Whatever CSS rules you add to this textarea will be reflected in every page, making for easier customization of this theme.';
|
||||
$string['choosereadme'] = '
|
||||
<div class="clearfix">
|
||||
<div class="theme_screenshot">
|
||||
|
||||
@@ -13,6 +13,8 @@ $showsidepost = ($hassidepost && !$PAGE->blocks->region_completely_docked('side-
|
||||
$custommenu = $OUTPUT->custom_menu();
|
||||
$hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu));
|
||||
|
||||
$hasfootnote = (!empty($PAGE->theme->settings->footnote));
|
||||
|
||||
$bodyclasses = array();
|
||||
if ($showsidepre && !$showsidepost) {
|
||||
$bodyclasses[] = 'side-pre-only';
|
||||
@@ -108,6 +110,11 @@ echo $OUTPUT->doctype() ?>
|
||||
<div id="page-footer" class="clearfix">
|
||||
|
||||
<div class="footer-left">
|
||||
|
||||
<?php if ($hasfootnote) { ?>
|
||||
<div id="footnote"><?php echo $PAGE->theme->settings->footnote;?></div>
|
||||
<?php } ?>
|
||||
|
||||
<a href="http://moodle.org" title="Moodle">
|
||||
<img src="<?php echo $OUTPUT->pix_url('footer/moodle-logo','theme')?>" alt="Moodle logo" />
|
||||
</a>
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
function afterburner_process_css($css, $theme) {
|
||||
|
||||
// Set the background image for the logo
|
||||
if (!empty($theme->settings->logo)) {
|
||||
$logo = $theme->settings->logo;
|
||||
} else {
|
||||
$logo = null;
|
||||
}
|
||||
$css = afterburner_set_logo($css, $logo);
|
||||
|
||||
// Set custom CSS
|
||||
if (!empty($theme->settings->customcss)) {
|
||||
$customcss = $theme->settings->customcss;
|
||||
} else {
|
||||
$customcss = null;
|
||||
}
|
||||
$css = afterburner_set_customcss($css, $customcss);
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
function afterburner_set_logo($css, $logo) {
|
||||
global $OUTPUT;
|
||||
$tag = '[[setting:logo]]';
|
||||
$replacement = $logo;
|
||||
if (is_null($replacement)) {
|
||||
$replacement = $OUTPUT->pix_url('images/logo','theme');
|
||||
}
|
||||
|
||||
$css = str_replace($tag, $replacement, $css);
|
||||
|
||||
return $css;
|
||||
|
||||
}
|
||||
|
||||
function afterburner_set_customcss($css, $customcss) {
|
||||
$tag = '[[setting:customcss]]';
|
||||
$replacement = $customcss;
|
||||
if (is_null($replacement)) {
|
||||
$replacement = '';
|
||||
}
|
||||
|
||||
$css = str_replace($tag, $replacement, $css);
|
||||
|
||||
return $css;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.9 KiB |
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
if ($ADMIN->fulltree) {
|
||||
|
||||
// Logo file setting
|
||||
$name = 'theme_afterburner/logo';
|
||||
$title = get_string('logo','theme_afterburner');
|
||||
$description = get_string('logodesc', 'theme_afterburner');
|
||||
$default = '';
|
||||
$setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_URL);
|
||||
$settings->add($setting);
|
||||
|
||||
// Foot note setting
|
||||
$name = 'theme_afterburner/footnote';
|
||||
$title = get_string('footnote','theme_afterburner');
|
||||
$description = get_string('footnotedesc', 'theme_afterburner');
|
||||
$default = '';
|
||||
$setting = new admin_setting_confightmleditor($name, $title, $description, $default);
|
||||
$settings->add($setting);
|
||||
}
|
||||
|
||||
// Custom CSS file
|
||||
$name = 'theme_afterburner/customcss';
|
||||
$title = get_string('customcss','theme_afterburner');
|
||||
$description = get_string('customcssdesc', 'theme_afterburner');
|
||||
$default = '';
|
||||
$setting = new admin_setting_configtextarea($name, $title, $description, $default);
|
||||
$settings->add($setting);
|
||||
@@ -19,8 +19,8 @@ a:hover, a:active {
|
||||
text-decoration: none;
|
||||
}
|
||||
hr {
|
||||
border-bottom:1px dotted gray;
|
||||
border-top:0px;
|
||||
border-bottom: 1px dotted #808080;
|
||||
border-top: 0px;
|
||||
}
|
||||
h2.headingblock {
|
||||
border-bottom: 1px solid #ddd;
|
||||
@@ -46,11 +46,11 @@ Header and Logo
|
||||
background: #fff;
|
||||
}
|
||||
#logo {
|
||||
background: url([[pix:theme|images/light3]]) no-repeat 0 -272px;
|
||||
width: 288px;
|
||||
height: 58px;
|
||||
background: url([[setting:logo]]) no-repeat 0 0;
|
||||
width: 320px;
|
||||
height: 75px;
|
||||
display: block;
|
||||
margin: 20px 15px;
|
||||
margin: 15px 10px 10px;
|
||||
float: left;
|
||||
}
|
||||
.headermenu,
|
||||
@@ -72,13 +72,13 @@ Page Footer
|
||||
#page-footer {
|
||||
background: #fff url([[pix:theme|core/h2grad]]) repeat-x left top;
|
||||
height: auto;
|
||||
clear:both;
|
||||
float:left;
|
||||
width:98%;
|
||||
clear: both;
|
||||
float: left;
|
||||
width: 98%;
|
||||
margin: 0;
|
||||
padding: 1%;
|
||||
color: #4b4b4b;
|
||||
border-top:1px solid #fff;
|
||||
border-top: 1px solid #fff;
|
||||
line-height: 2em;
|
||||
font-size: 1em;
|
||||
}
|
||||
@@ -97,6 +97,12 @@ Page Footer
|
||||
text-align: left;
|
||||
color: #999;
|
||||
}
|
||||
#page-footer .footer-left p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 100%;
|
||||
line-height: 1;
|
||||
}
|
||||
#page-footer .footer-right {
|
||||
float: right;
|
||||
text-align: right;
|
||||
@@ -433,4 +439,8 @@ tab styles for ie6 & ie7
|
||||
}
|
||||
.yui-skin-sam .yui-panel-container {
|
||||
z-index: 999999!important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Custom CSS Settings
|
||||
-------------------------*/
|
||||
[[setting:customcss]]
|
||||
Reference in New Issue
Block a user