|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 function brick_set_linkcolor($css, $linkcolor) { 00003 $tag = '[[setting:linkcolor]]'; 00004 $replacement = $linkcolor; 00005 if (is_null($replacement)) { 00006 $replacement = '#06365b'; 00007 } 00008 $css = str_replace($tag, $replacement, $css); 00009 return $css; 00010 } 00011 00012 function brick_set_linkhover($css, $linkhover) { 00013 $tag = '[[setting:linkhover]]'; 00014 $replacement = $linkhover; 00015 if (is_null($replacement)) { 00016 $replacement = '#5487ad'; 00017 } 00018 $css = str_replace($tag, $replacement, $css); 00019 return $css; 00020 } 00021 00022 function brick_set_maincolor($css, $maincolor) { 00023 $tag = '[[setting:maincolor]]'; 00024 $replacement = $maincolor; 00025 if (is_null($replacement)) { 00026 $replacement = '#8e2800'; 00027 } 00028 $css = str_replace($tag, $replacement, $css); 00029 return $css; 00030 } 00031 00032 function brick_set_maincolorlink($css, $maincolorlink) { 00033 $tag = '[[setting:maincolorlink]]'; 00034 $replacement = $maincolorlink; 00035 if (is_null($replacement)) { 00036 $replacement = '#fff0a5'; 00037 } 00038 $css = str_replace($tag, $replacement, $css); 00039 return $css; 00040 } 00041 00042 function brick_set_headingcolor($css, $headingcolor) { 00043 $tag = '[[setting:headingcolor]]'; 00044 $replacement = $headingcolor; 00045 if (is_null($replacement)) { 00046 $replacement = '#5c3500'; 00047 } 00048 $css = str_replace($tag, $replacement, $css); 00049 return $css; 00050 } 00051 00052 function brick_set_logo($css, $logo) { 00053 global $OUTPUT; 00054 $tag = '[[setting:logo]]'; 00055 $replacement = $logo; 00056 if (is_null($replacement)) { 00057 $replacement = $OUTPUT->pix_url('logo', 'theme'); 00058 } 00059 $css = str_replace($tag, $replacement, $css); 00060 return $css; 00061 } 00062 00063 00064 00065 00066 00067 00068 function brick_process_css($css, $theme) { 00069 00070 if (!empty($theme->settings->linkcolor)) { 00071 $linkcolor = $theme->settings->linkcolor; 00072 } else { 00073 $linkcolor = null; 00074 } 00075 $css = brick_set_linkcolor($css, $linkcolor); 00076 00077 // Set the link hover color 00078 if (!empty($theme->settings->linkhover)) { 00079 $linkhover = $theme->settings->linkhover; 00080 } else { 00081 $linkhover = null; 00082 } 00083 $css = brick_set_linkhover($css, $linkhover); 00084 00085 // Set the main color 00086 if (!empty($theme->settings->maincolor)) { 00087 $maincolor = $theme->settings->maincolor; 00088 } else { 00089 $maincolor = null; 00090 } 00091 $css = brick_set_maincolor($css, $maincolor); 00092 00093 // Set the main accent color 00094 if (!empty($theme->settings->maincolorlink)) { 00095 $maincolorlink = $theme->settings->maincolorlink; 00096 } else { 00097 $maincolorlink = null; 00098 } 00099 $css = brick_set_maincolorlink($css, $maincolorlink); 00100 00101 // Set the main headings color 00102 if (!empty($theme->settings->headingcolor)) { 00103 $headingcolor = $theme->settings->headingcolor; 00104 } else { 00105 $headingcolor = null; 00106 } 00107 $css = brick_set_headingcolor($css, $headingcolor); 00108 00109 // Set the logo image 00110 if (!empty($theme->settings->logo)) { 00111 $logo = $theme->settings->logo; 00112 } else { 00113 $logo = null; 00114 } 00115 $css = brick_set_logo($css, $logo); 00116 00117 00118 00119 return $css; 00120 00121 00122 00123 }