MDL-31461 Plagiarism - adjust api functions to allow better support for renderers
[moodle.git] / theme / formal_white / lib.php
blob2869b801525c45016de42e3a5a0e0559317d8a59
1 <?php
3 defined('MOODLE_INTERNAL') || die();
5 /**
6 * Makes our changes to the CSS
8 * @param string $css
9 * @param theme_config $theme
10 * @return string
12 function formal_white_user_settings($css, $theme) {
14 // Set the font reference size
15 if (empty($theme->settings->fontsizereference)) {
16 $fontsizereference = '13'; // default
17 } else {
18 $fontsizereference = $theme->settings->fontsizereference;
20 $css = formal_white_set_fontsizereference($css, $fontsizereference);
22 // Set the page header background color
23 if (empty($theme->settings->headerbgc)) {
24 $headerbgc = '#E3DFD4'; // default
25 } else {
26 $headerbgc = $theme->settings->headerbgc;
28 $css = formal_white_set_headerbgc($css, $headerbgc);
30 // Set the block content background color
31 if (empty($theme->settings->blockcontentbgc)) {
32 $blockcontentbgc = '#F6F6F6'; // default
33 } else {
34 $blockcontentbgc = $theme->settings->blockcontentbgc;
36 $css = formal_white_set_blockcontentbgc($css, $blockcontentbgc);
38 // Set the left block column background color
39 if (empty($theme->settings->lblockcolumnbgc)) {
40 $lblockcolumnbgc = '#E3DFD4'; // default
41 } else {
42 $lblockcolumnbgc = $theme->settings->lblockcolumnbgc;
44 $css = formal_white_set_lblockcolumnbgc($css, $lblockcolumnbgc);
46 // Set the right block column background color
47 if (empty($theme->settings->rblockcolumnbgc)) {
48 $rblockcolumnbgc = $lblockcolumnbgc; // default
49 } else {
50 $rblockcolumnbgc = $theme->settings->rblockcolumnbgc;
52 $css = formal_white_set_rblockcolumnbgc($css, $rblockcolumnbgc);
54 // set the width of the two blocks columns
55 if (!empty($theme->settings->blockcolumnwidth)) {
56 $blockcolumnwidth = $theme->settings->blockcolumnwidth;
57 } else {
58 $blockcolumnwidth = '200'; // default
60 $css = formal_white_set_blockcolumnwidth($css, $blockcolumnwidth);
62 // set the customcss
63 if (!empty($theme->settings->customcss)) {
64 $customcss = $theme->settings->customcss;
65 } else {
66 $customcss = null;
68 $css = formal_white_set_customcss($css, $customcss);
70 // Return the CSS
71 return $css;
76 /**
77 * Sets the link color variable in CSS
80 function formal_white_set_fontsizereference($css, $fontsizereference) {
81 $tag = '[[setting:fontsizereference]]';
82 $css = str_replace($tag, $fontsizereference.'px', $css);
83 return $css;
86 function formal_white_set_headerbgc($css, $headerbgc) {
87 $tag = '[[setting:headerbgc]]';
88 $css = str_replace($tag, $headerbgc, $css);
89 return $css;
92 function formal_white_set_blockcontentbgc($css, $blockcontentbgc) {
93 $tag = '[[setting:blockcontentbgc]]';
94 $css = str_replace($tag, $blockcontentbgc, $css);
95 return $css;
98 function formal_white_set_lblockcolumnbgc($css, $lblockcolumnbgc) {
99 $tag = '[[setting:lblockcolumnbgc]]';
100 $css = str_replace($tag, $lblockcolumnbgc, $css);
101 return $css;
104 function formal_white_set_rblockcolumnbgc($css, $rblockcolumnbgc) {
105 $tag = '[[setting:rblockcolumnbgc]]';
106 $css = str_replace($tag, $rblockcolumnbgc, $css);
107 return $css;
110 function formal_white_set_blockcolumnwidth($css, $blockcolumnwidth) {
111 $tag = '[[setting:blockcolumnwidth]]';
112 $css = str_replace($tag, $blockcolumnwidth.'px', $css);
114 $tag = '[[setting:minusdoubleblockcolumnwidth]]';
115 $css = str_replace($tag, (-2*$blockcolumnwidth).'px', $css);
117 $tag = '[[setting:doubleblockcolumnwidth]]';
118 $css = str_replace($tag, (2*$blockcolumnwidth).'px', $css);
120 return $css;
123 function formal_white_set_customcss($css, $customcss) {
124 $tag = '[[setting:customcss]]';
125 $css = str_replace($tag, $customcss, $css);
126 return $css;