Added settings to fusion theme. MDL-23299
authorjohn St <jstabinger@gmail.com>
Tue, 3 Aug 2010 15:05:12 +0000 (15:05 +0000)
committerjohn St <jstabinger@gmail.com>
Tue, 3 Aug 2010 15:05:12 +0000 (15:05 +0000)
theme/fusion/config.php
theme/fusion/lang/en/theme_fusion.php
theme/fusion/layout/frontpage.php
theme/fusion/layout/general.php
theme/fusion/lib.php [new file with mode: 0644]
theme/fusion/settings.php [new file with mode: 0644]
theme/fusion/style/settings.css

index f8fa177..3ce1832 100644 (file)
@@ -57,6 +57,7 @@ $THEME->sheets = array(
        'core',
        'pagelayout',
        'menus',
+       'settings',
 );
 
 ////////////////////////////////////////////////////
@@ -253,3 +254,4 @@ $THEME->rarrow      = '&rang;';
 ////////////////////////////////////////////////////
 // Controls the colours for the MP3 player     
 ////////////////////////////////////////////////////
+$THEME->csspostprocess = 'fusion_process_css';
\ No newline at end of file
index 6c5396f..185520a 100644 (file)
@@ -60,12 +60,11 @@ $string['choosereadme'] = '
 
 $string['linkcolor'] = 'Link Color';
 $string['linkcolordesc'] = 'This sets the link color for the theme.';
-$string['configtitle'] = 'Arialist settings';
+$string['configtitle'] = 'Fusion settings';
 $string['customcss'] = 'Custom CSS';
 $string['customcssdesc'] = 'Any CSS you enter here will be added to every page allowing your to easily customise this theme.';
 $string['tagline'] = 'Tagline';
-$string['taglinedesc'] = 'A short tagline to be displayed under the site name on the front page.<br /><em>(Will not be displayed with logo.)</em>';
-$string['logo'] = 'Logo';
-$string['logodesc'] = 'Enter the URL to an image to use as the logo for this site. Should be http://www.yoursite.com/path/to/logo.png';
-$string['regionwidth'] = 'Column width';
-$string['regionwidthdesc'] = 'This sets the width of the two block regions that form the left and right columns.';
+$string['taglinedesc'] = 'A short tagline to be displayed under the site name on the front page.<br />';
+$string['footertext'] = 'Footertext';
+$string['footertextdesc'] = 'Set a footnote or footer text.';
+
index 4b1a24a..4657c2e 100644 (file)
@@ -19,6 +19,19 @@ if ($hascustommenu) {
     $bodyclasses[] = 'has_custom_menu';
 }
 
+
+if (!empty($PAGE->theme->settings->tagline)) {
+    $tagline = $PAGE->theme->settings->tagline;
+} else {
+    $tagline = "Another Moodle Theme";
+}
+
+if (!empty($PAGE->theme->settings->footertext)) {
+    $footnote = $PAGE->theme->settings->footertext;
+} else {
+    $footnote = '<!-- There was no custom footnote set -->';
+}
+
 echo $OUTPUT->doctype() ?>
 <html <?php echo $OUTPUT->htmlattributes() ?>>
 <head>
@@ -77,7 +90,7 @@ echo $OUTPUT->doctype() ?>
                                                                        
                                                                        <div id="region-header">
                                                                    <h1 class="headermain"><?php echo $PAGE->heading ?></h1>
-                                                                   <p class="tagline">Another Moodle Theme</p>
+                                                                   <p class="tagline"><?php echo $tagline ?></p>
                                                                </div>
                                                            
                                            <?php echo core_renderer::MAIN_CONTENT_TOKEN ?>
@@ -112,6 +125,7 @@ echo $OUTPUT->doctype() ?>
 
 <!-- START OF FOOTER -->
     <div id="page-footer" class="wrapper clearfix">
+    <?php echo $footnote ?>
            <p class="helplink"><?php echo page_doc_link(get_string('moodledocslink')) ?></p>
         <?php
                    echo $OUTPUT->login_info();
index 8bb5e7d..27f1c76 100644 (file)
@@ -20,6 +20,13 @@ if ($hascustommenu) {
     $bodyclasses[] = 'has_custom_menu';
 }
 
+if (!empty($PAGE->theme->settings->footertext)) {
+    $footnote = $PAGE->theme->settings->footertext;
+} else {
+    $footnote = '<!-- There was no custom footnote set -->';
+}
+
+
 echo $OUTPUT->doctype() ?>
 <html <?php echo $OUTPUT->htmlattributes() ?>>
 <head>
@@ -136,6 +143,7 @@ echo $OUTPUT->doctype() ?>
 
        <?php if ($hasfooter) { ?>
                    <div id="page-footer" class="wrapper">
+                        <?php echo $footnote ?>
                        <p class="helplink"><?php echo page_doc_link(get_string('moodledocslink')) ?></p>
                        <?php
                                echo $OUTPUT->login_info();
diff --git a/theme/fusion/lib.php b/theme/fusion/lib.php
new file mode 100644 (file)
index 0000000..116462b
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+function fusion_set_linkcolor($css, $linkcolor) {
+    $tag = '[[setting:linkcolor]]';
+    $replacement = $linkcolor;
+    if (is_null($replacement)) {
+        $replacement = '#2d83d5';
+    }
+    $css = str_replace($tag, $replacement, $css);
+    
+
+    return $css;
+}
+
+function fusion_set_customcss($css, $customcss) {
+    $tag = '[[setting:customcss]]';
+    $replacement = $customcss;
+    if (is_null($replacement)) {
+        $replacement = '';
+    }
+    $css = str_replace($tag, $replacement, $css);
+    return $css;
+}
+
+
+
+
+
+function fusion_process_css($css, $theme) {
+       
+     if (!empty($theme->settings->linkcolor)) {
+        $linkcolor = $theme->settings->linkcolor;
+    } else {
+        $linkcolor = null;
+    }
+    $css = fusion_set_linkcolor($css, $linkcolor);
+
+     if (!empty($theme->settings->customcss)) {
+        $customcss = $theme->settings->customcss;
+    } else {
+        $customcss = null;
+    }
+    $css = fusion_set_customcss($css, $customcss);
+    
+    return $css;
+    
+    
+    
+}
+
diff --git a/theme/fusion/settings.php b/theme/fusion/settings.php
new file mode 100644 (file)
index 0000000..18b0ceb
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+// Create our admin page
+$temp = new admin_settingpage('theme_fusion', get_string('configtitle','theme_fusion'));
+
+// link color setting
+$name = 'theme_fusion/linkcolor';
+$title = get_string('linkcolor','theme_fusion');
+$description = get_string('linkcolordesc', 'theme_fusion');
+$default = '#2d83d5';
+$previewconfig = NULL;
+$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
+$temp->add($setting);
+
+
+// Tag line setting
+$name = 'theme_fusion/tagline';
+$title = get_string('tagline','theme_fusion');
+$description = get_string('taglinedesc', 'theme_fusion');
+$setting = new admin_setting_configtextarea($name, $title, $description, '');
+$temp->add($setting);
+
+// Foot note setting
+$name = 'theme_fusion/footertext';
+$title = get_string('footertext','theme_fusion');
+$description = get_string('footertextdesc', 'theme_fusion');
+$setting = new admin_setting_confightmleditor($name, $title, $description, '');
+$temp->add($setting);
+
+// Custom CSS file
+$name = 'theme_fusion/customcss';
+$title = get_string('customcss','theme_fusion');
+$description = get_string('customcssdesc', 'theme_fusion');
+$setting = new admin_setting_configtextarea($name, $title, $description, '');
+$temp->add($setting);
+
+// Add our page to the structure of the admin tree
+$ADMIN->add('themes', $temp);
\ No newline at end of file
index 0390eef..61645a6 100644 (file)
@@ -2,17 +2,6 @@ a {
        color:[[setting:linkcolor]];
 }
 
-#page-content #region-main-box #region-post-box {
-       margin-left: -[[setting:regionwidth]];
-}
-
-#page-content #region-main-box #region-post-box #region-main-wrap #region-main {
-       margin-left: [[setting:regionwidth]];
-}
-
-#page-content #region-main-box #region-post-box #region-post {
-       left: [[setting:regionwidth]];
-       width: [[setting:regionwidth]];
 
 /** Custom CSS **/
 [[setting:customcss]]
\ No newline at end of file