|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00010 function magazine_process_css($css, $theme) { 00011 00012 // Set the link color 00013 if (!empty($theme->settings->linkcolor)) { 00014 $linkcolor = $theme->settings->linkcolor; 00015 } else { 00016 $linkcolor = null; 00017 } 00018 $css = magazine_set_linkcolor($css, $linkcolor); 00019 00020 // Set the link hover color 00021 if (!empty($theme->settings->linkhover)) { 00022 $linkhover = $theme->settings->linkhover; 00023 } else { 00024 $linkhover = null; 00025 } 00026 $css = magazine_set_linkhover($css, $linkhover); 00027 00028 // Set the main color 00029 if (!empty($theme->settings->maincolor)) { 00030 $maincolor = $theme->settings->maincolor; 00031 } else { 00032 $maincolor = null; 00033 } 00034 $css = magazine_set_maincolor($css, $maincolor); 00035 00036 // Set the main accent color 00037 if (!empty($theme->settings->maincoloraccent)) { 00038 $maincoloraccent = $theme->settings->maincoloraccent; 00039 } else { 00040 $maincoloraccent = null; 00041 } 00042 $css = magazine_set_maincoloraccent($css, $maincoloraccent); 00043 00044 // Set the main headings color 00045 if (!empty($theme->settings->headingcolor)) { 00046 $headingcolor = $theme->settings->headingcolor; 00047 } else { 00048 $headingcolor = null; 00049 } 00050 $css = magazine_set_headingcolor($css, $headingcolor); 00051 00052 // Set the block headings color 00053 if (!empty($theme->settings->blockcolor)) { 00054 $blockcolor = $theme->settings->blockcolor; 00055 } else { 00056 $blockcolor = null; 00057 } 00058 $css = magazine_set_blockcolor($css, $blockcolor); 00059 00060 // Set the forum background color 00061 if (!empty($theme->settings->forumback)) { 00062 $forumback = $theme->settings->forumback; 00063 } else { 00064 $forumback = null; 00065 } 00066 $css = magazine_set_forumback($css, $forumback); 00067 00068 // Set the body background image 00069 if (!empty($theme->settings->background)) { 00070 $background = $theme->settings->background; 00071 } else { 00072 $background = null; 00073 } 00074 $css = magazine_set_background($css, $background); 00075 00076 // Set the logo image 00077 if (!empty($theme->settings->logo)) { 00078 $logo = $theme->settings->logo; 00079 } else { 00080 $logo = null; 00081 } 00082 $css = magazine_set_logo($css, $logo); 00083 00084 00085 // Return the CSS 00086 return $css; 00087 } 00088 00089 00090 00095 function magazine_set_linkcolor($css, $linkcolor) { 00096 $tag = '[[setting:linkcolor]]'; 00097 $replacement = $linkcolor; 00098 if (is_null($replacement)) { 00099 $replacement = '#32529a'; 00100 } 00101 $css = str_replace($tag, $replacement, $css); 00102 return $css; 00103 } 00104 00105 function magazine_set_linkhover($css, $linkhover) { 00106 $tag = '[[setting:linkhover]]'; 00107 $replacement = $linkhover; 00108 if (is_null($replacement)) { 00109 $replacement = '#4e2300'; 00110 } 00111 $css = str_replace($tag, $replacement, $css); 00112 return $css; 00113 } 00114 00115 function magazine_set_maincolor($css, $maincolor) { 00116 $tag = '[[setting:maincolor]]'; 00117 $replacement = $maincolor; 00118 if (is_null($replacement)) { 00119 $replacement = '#002f2f'; 00120 } 00121 $css = str_replace($tag, $replacement, $css); 00122 return $css; 00123 } 00124 00125 function magazine_set_maincoloraccent($css, $maincoloraccent) { 00126 $tag = '[[setting:maincoloraccent]]'; 00127 $replacement = $maincoloraccent; 00128 if (is_null($replacement)) { 00129 $replacement = '#092323'; 00130 } 00131 $css = str_replace($tag, $replacement, $css); 00132 return $css; 00133 } 00134 00135 function magazine_set_headingcolor($css, $headingcolor) { 00136 $tag = '[[setting:headingcolor]]'; 00137 $replacement = $headingcolor; 00138 if (is_null($replacement)) { 00139 $replacement = '#4e0000'; 00140 } 00141 $css = str_replace($tag, $replacement, $css); 00142 return $css; 00143 } 00144 00145 function magazine_set_blockcolor($css, $blockcolor) { 00146 $tag = '[[setting:blockcolor]]'; 00147 $replacement = $blockcolor; 00148 if (is_null($replacement)) { 00149 $replacement = '#002f2f'; 00150 } 00151 $css = str_replace($tag, $replacement, $css); 00152 return $css; 00153 } 00154 00155 function magazine_set_forumback($css, $forumback) { 00156 $tag = '[[setting:forumback]]'; 00157 $replacement = $forumback; 00158 if (is_null($replacement)) { 00159 $replacement = '#e6e2af'; 00160 } 00161 $css = str_replace($tag, $replacement, $css); 00162 return $css; 00163 } 00164 00165 function magazine_set_background($css, $background) { 00166 global $OUTPUT; 00167 $tag = '[[setting:background]]'; 00168 $replacement = $background; 00169 if (is_null($replacement)) { 00170 $replacement = $OUTPUT->pix_url('bg4', 'theme'); 00171 } 00172 $css = str_replace($tag, $replacement, $css); 00173 return $css; 00174 } 00175 00176 function magazine_set_logo($css, $logo) { 00177 global $OUTPUT; 00178 $tag = '[[setting:logo]]'; 00179 $replacement = $logo; 00180 if (is_null($replacement)) { 00181 $replacement = $OUTPUT->pix_url('logo', 'theme'); 00182 } 00183 $css = str_replace($tag, $replacement, $css); 00184 return $css; 00185 }