|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 function sky_high_process_css($css, $theme) { 00004 00005 if (!empty($theme->settings->regionwidth)) { 00006 $regionwidth = $theme->settings->regionwidth; 00007 } else { 00008 $regionwidth = null; 00009 } 00010 $css = sky_high_set_regionwidth($css, $regionwidth); 00011 00012 if (!empty($theme->settings->customcss)) { 00013 $customcss = $theme->settings->customcss; 00014 } else { 00015 $customcss = null; 00016 } 00017 $css = sky_high_set_customcss($css, $customcss); 00018 00019 return $css; 00020 } 00021 00029 function sky_high_set_regionwidth($css, $regionwidth) { 00030 $tag = '[[setting:regionwidth]]'; 00031 $doubletag = '[[setting:regionwidthdouble]]'; 00032 $leftmargintag = '[[setting:leftregionwidthmargin]]'; 00033 $rightmargintag = '[[setting:rightregionwidthmargin]]'; 00034 $replacement = $regionwidth; 00035 if (is_null($replacement)) { 00036 $replacement = 240; 00037 } 00038 $css = str_replace($tag, $replacement.'px', $css); 00039 $css = str_replace($doubletag, ($replacement*2).'px', $css); 00040 $css = str_replace($rightmargintag, ($replacement*3-5).'px', $css); 00041 $css = str_replace($leftmargintag, ($replacement+5).'px', $css); 00042 return $css; 00043 } 00044 00052 function sky_high_set_customcss($css, $customcss) { 00053 $tag = '[[setting:customcss]]'; 00054 $replacement = $customcss; 00055 if (is_null($replacement)) { 00056 $replacement = ''; 00057 } 00058 $css = str_replace($tag, $replacement, $css); 00059 return $css; 00060 } 00061 00062 ?>