2010-07-06 11:59:31 +00:00
|
|
|
<?php
|
|
|
|
|
2011-03-06 17:31:32 +01:00
|
|
|
defined('MOODLE_INTERNAL') || die();
|
|
|
|
|
2010-07-06 11:59:31 +00:00
|
|
|
/**
|
|
|
|
* Makes our changes to the CSS
|
|
|
|
*
|
|
|
|
* @param string $css
|
|
|
|
* @param theme_config $theme
|
|
|
|
* @return string
|
|
|
|
*/
|
2011-03-06 17:31:32 +01:00
|
|
|
function formal_white_user_settings($css, $theme) {
|
|
|
|
|
2011-05-23 15:05:03 +08:00
|
|
|
// Set the font reference size
|
|
|
|
if (empty($theme->settings->fontsizereference)) {
|
|
|
|
$fontsizereference = '13'; // default
|
|
|
|
} else {
|
|
|
|
$fontsizereference = $theme->settings->fontsizereference;
|
|
|
|
}
|
|
|
|
$css = formal_white_set_fontsizereference($css, $fontsizereference);
|
|
|
|
|
2012-01-19 09:15:04 +01:00
|
|
|
// Set the frame margin
|
|
|
|
if (!isset($theme->settings->framemargin)) {
|
|
|
|
$framemargin = 15; // default
|
|
|
|
} else {
|
|
|
|
$framemargin = $theme->settings->framemargin;
|
|
|
|
}
|
|
|
|
$css = formal_white_set_framemargin($css, $framemargin);
|
|
|
|
|
2011-03-07 15:29:08 +01:00
|
|
|
// Set the page header background color
|
|
|
|
if (empty($theme->settings->headerbgc)) {
|
2011-08-29 11:52:15 +12:00
|
|
|
$headerbgc = '#E3DFD4'; // default
|
2011-03-07 15:29:08 +01:00
|
|
|
} else {
|
|
|
|
$headerbgc = $theme->settings->headerbgc;
|
|
|
|
}
|
|
|
|
$css = formal_white_set_headerbgc($css, $headerbgc);
|
|
|
|
|
2011-03-06 17:31:32 +01:00
|
|
|
// Set the block content background color
|
|
|
|
if (empty($theme->settings->blockcontentbgc)) {
|
2011-05-23 15:05:03 +08:00
|
|
|
$blockcontentbgc = '#F6F6F6'; // default
|
2011-03-06 17:31:32 +01:00
|
|
|
} else {
|
|
|
|
$blockcontentbgc = $theme->settings->blockcontentbgc;
|
|
|
|
}
|
|
|
|
$css = formal_white_set_blockcontentbgc($css, $blockcontentbgc);
|
2010-07-06 11:59:31 +00:00
|
|
|
|
2011-05-23 15:05:03 +08:00
|
|
|
// Set the left block column background color
|
|
|
|
if (empty($theme->settings->lblockcolumnbgc)) {
|
|
|
|
$lblockcolumnbgc = '#E3DFD4'; // default
|
2010-07-06 11:59:31 +00:00
|
|
|
} else {
|
2011-05-23 15:05:03 +08:00
|
|
|
$lblockcolumnbgc = $theme->settings->lblockcolumnbgc;
|
2010-07-06 11:59:31 +00:00
|
|
|
}
|
2011-05-23 15:05:03 +08:00
|
|
|
$css = formal_white_set_lblockcolumnbgc($css, $lblockcolumnbgc);
|
2010-07-06 11:59:31 +00:00
|
|
|
|
2011-05-23 15:05:03 +08:00
|
|
|
// Set the right block column background color
|
|
|
|
if (empty($theme->settings->rblockcolumnbgc)) {
|
|
|
|
$rblockcolumnbgc = $lblockcolumnbgc; // default
|
2010-07-06 11:59:31 +00:00
|
|
|
} else {
|
2011-05-23 15:05:03 +08:00
|
|
|
$rblockcolumnbgc = $theme->settings->rblockcolumnbgc;
|
2010-07-06 11:59:31 +00:00
|
|
|
}
|
2011-05-23 15:05:03 +08:00
|
|
|
$css = formal_white_set_rblockcolumnbgc($css, $rblockcolumnbgc);
|
2010-07-06 11:59:31 +00:00
|
|
|
|
2011-05-23 15:05:03 +08:00
|
|
|
// set the width of the two blocks columns
|
2011-03-06 17:31:32 +01:00
|
|
|
if (!empty($theme->settings->blockcolumnwidth)) {
|
|
|
|
$blockcolumnwidth = $theme->settings->blockcolumnwidth;
|
2010-07-06 11:59:31 +00:00
|
|
|
} else {
|
2011-03-06 17:31:32 +01:00
|
|
|
$blockcolumnwidth = '200'; // default
|
2010-07-06 11:59:31 +00:00
|
|
|
}
|
2011-03-06 17:31:32 +01:00
|
|
|
$css = formal_white_set_blockcolumnwidth($css, $blockcolumnwidth);
|
2010-07-06 11:59:31 +00:00
|
|
|
|
2011-05-23 15:05:03 +08:00
|
|
|
// set the customcss
|
|
|
|
if (!empty($theme->settings->customcss)) {
|
|
|
|
$customcss = $theme->settings->customcss;
|
|
|
|
} else {
|
|
|
|
$customcss = null;
|
|
|
|
}
|
|
|
|
$css = formal_white_set_customcss($css, $customcss);
|
|
|
|
|
2010-07-06 11:59:31 +00:00
|
|
|
return $css;
|
|
|
|
}
|
|
|
|
|
2011-03-06 17:31:32 +01:00
|
|
|
|
|
|
|
|
2010-07-06 11:59:31 +00:00
|
|
|
/**
|
2011-03-06 17:31:32 +01:00
|
|
|
* Sets the link color variable in CSS
|
2010-07-06 11:59:31 +00:00
|
|
|
*
|
|
|
|
*/
|
2011-05-23 15:05:03 +08:00
|
|
|
function formal_white_set_fontsizereference($css, $fontsizereference) {
|
|
|
|
$tag = '[[setting:fontsizereference]]';
|
|
|
|
$css = str_replace($tag, $fontsizereference.'px', $css);
|
|
|
|
return $css;
|
|
|
|
}
|
|
|
|
|
2012-01-19 09:15:04 +01:00
|
|
|
function formal_white_set_framemargin($css, $framemargin) {
|
|
|
|
$tag = '[[setting:framemargin]]';
|
|
|
|
$css = str_replace($tag, $framemargin.'px', $css);
|
|
|
|
|
|
|
|
// Set .headermenu right
|
|
|
|
$tag = '[[setting:headermenuright]]';
|
|
|
|
$css = str_replace($tag, ($framemargin+17).'px', $css); // 17px is the width of the frame
|
|
|
|
|
|
|
|
return $css;
|
|
|
|
}
|
|
|
|
|
2011-03-07 15:29:08 +01:00
|
|
|
function formal_white_set_headerbgc($css, $headerbgc) {
|
|
|
|
$tag = '[[setting:headerbgc]]';
|
|
|
|
$css = str_replace($tag, $headerbgc, $css);
|
|
|
|
return $css;
|
|
|
|
}
|
|
|
|
|
2011-03-06 17:31:32 +01:00
|
|
|
function formal_white_set_blockcontentbgc($css, $blockcontentbgc) {
|
|
|
|
$tag = '[[setting:blockcontentbgc]]';
|
|
|
|
$css = str_replace($tag, $blockcontentbgc, $css);
|
2010-07-06 11:59:31 +00:00
|
|
|
return $css;
|
|
|
|
}
|
|
|
|
|
2011-05-23 15:05:03 +08:00
|
|
|
function formal_white_set_lblockcolumnbgc($css, $lblockcolumnbgc) {
|
|
|
|
$tag = '[[setting:lblockcolumnbgc]]';
|
|
|
|
$css = str_replace($tag, $lblockcolumnbgc, $css);
|
2010-07-06 11:59:31 +00:00
|
|
|
return $css;
|
|
|
|
}
|
|
|
|
|
2011-05-23 15:05:03 +08:00
|
|
|
function formal_white_set_rblockcolumnbgc($css, $rblockcolumnbgc) {
|
|
|
|
$tag = '[[setting:rblockcolumnbgc]]';
|
|
|
|
$css = str_replace($tag, $rblockcolumnbgc, $css);
|
2011-03-07 15:29:08 +01:00
|
|
|
return $css;
|
2011-03-06 17:31:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function formal_white_set_blockcolumnwidth($css, $blockcolumnwidth) {
|
2011-03-07 15:29:08 +01:00
|
|
|
$tag = '[[setting:blockcolumnwidth]]';
|
|
|
|
$css = str_replace($tag, $blockcolumnwidth.'px', $css);
|
2011-03-06 17:31:32 +01:00
|
|
|
|
2011-03-07 15:29:08 +01:00
|
|
|
$tag = '[[setting:minusdoubleblockcolumnwidth]]';
|
|
|
|
$css = str_replace($tag, (-2*$blockcolumnwidth).'px', $css);
|
2011-03-06 17:31:32 +01:00
|
|
|
|
2011-03-07 15:29:08 +01:00
|
|
|
$tag = '[[setting:doubleblockcolumnwidth]]';
|
|
|
|
$css = str_replace($tag, (2*$blockcolumnwidth).'px', $css);
|
2011-03-06 17:31:32 +01:00
|
|
|
|
2012-01-19 09:15:04 +01:00
|
|
|
// set the min-width of the page to provide: content region min-width = block region width
|
|
|
|
// I do not care $framemargin because the min-width applies to #frametop that is free from $framemargin
|
|
|
|
// I need to add twice the width of the frame because it is inside #frametop
|
|
|
|
// (this code here because it HAS TO come later than $blockcolumnwidth definition)
|
|
|
|
$tag = '[[setting:minwidth]]';
|
|
|
|
$css = str_replace($tag, (3*$blockcolumnwidth + 34).'px', $css); // 34 = 2*17 (17px is the width of the frame)
|
|
|
|
|
2011-03-07 15:29:08 +01:00
|
|
|
return $css;
|
2011-05-23 15:05:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function formal_white_set_customcss($css, $customcss) {
|
|
|
|
$tag = '[[setting:customcss]]';
|
|
|
|
$css = str_replace($tag, $customcss, $css);
|
|
|
|
return $css;
|
2011-08-29 11:52:15 +12:00
|
|
|
}
|