Merge branch '44209-27' of git://github.com/samhemelryk/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2014-02-19 01:30:43 +01:00
commit 8817802bfd
5 changed files with 155 additions and 57 deletions

View File

@ -1,4 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* The frontpage layout.
*
* @package theme_overlay
* @copyright 2008 NodeThirtyThree (http://nodethirtythree.com/)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$hasheading = ($PAGE->heading);
$hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar());

View File

@ -1,4 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* The default layout.
*
* @package theme_overlay
* @copyright 2008 NodeThirtyThree (http://nodethirtythree.com/)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$hasheading = ($PAGE->heading);
$hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar());

View File

@ -1,4 +1,33 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file contains functions specific to the needs of the Overlay theme.
*
* @package theme_overlay
* @copyright 2008 NodeThirtyThree (http://nodethirtythree.com/)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Sets the link colour in CSS.
* @param string $css
* @param string $linkcolor
* @return string
*/
function overlay_set_linkcolor($css, $linkcolor) {
$tag = '[[setting:linkcolor]]';
$replacement = $linkcolor;
@ -6,11 +35,15 @@ function overlay_set_linkcolor($css, $linkcolor) {
$replacement = '#428ab5';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
/**
* Sets the header colour in CSS.
* @param string $css
* @param string $headercolor
* @return string
*/
function overlay_set_headercolor($css, $headercolor) {
$tag = '[[setting:headercolor]]';
$replacement = $headercolor;
@ -18,12 +51,15 @@ function overlay_set_headercolor($css, $headercolor) {
$replacement = '#2a4c7b';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
/**
* Adds custom CSS to the theme CSS before it is cached and delivered.
* @param string $css
* @param string $customcss
* @return string
*/
function overlay_set_customcss($css, $customcss) {
$tag = '[[setting:customcss]]';
$replacement = $customcss;
@ -34,36 +70,35 @@ function overlay_set_customcss($css, $customcss) {
return $css;
}
/**
* Processes CSS before it is cached and delivered, applying theme customisations.
* @param string $css
* @param theme_config $theme
* @return string
*/
function overlay_process_css($css, $theme) {
if (!empty($theme->settings->linkcolor)) {
if (!empty($theme->settings->linkcolor)) {
$linkcolor = $theme->settings->linkcolor;
} else {
$linkcolor = null;
}
$css = overlay_set_linkcolor($css, $linkcolor);
if (!empty($theme->settings->headercolor)) {
if (!empty($theme->settings->headercolor)) {
$headercolor = $theme->settings->headercolor;
} else {
$headercolor = null;
}
$css = overlay_set_headercolor($css, $headercolor);
if (!empty($theme->settings->customcss)) {
if (!empty($theme->settings->customcss)) {
$customcss = $theme->settings->customcss;
} else {
$customcss = null;
}
$css = overlay_set_customcss($css, $customcss);
return $css;
}

View File

@ -1,45 +1,64 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Settings for the overlay theme.
*
* @package theme_overlay
* @copyright 2008 NodeThirtyThree (http://nodethirtythree.com/)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
// link color setting.
$name = 'theme_overlay/linkcolor';
$title = get_string('linkcolor','theme_overlay');
$description = get_string('linkcolordesc', 'theme_overlay');
$default = '#428ab5';
$previewconfig = NULL;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
// link color setting
$name = 'theme_overlay/linkcolor';
$title = get_string('linkcolor','theme_overlay');
$description = get_string('linkcolordesc', 'theme_overlay');
$default = '#428ab5';
$previewconfig = NULL;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
// Tag line setting.
$name = 'theme_overlay/headercolor';
$title = get_string('headercolor','theme_overlay');
$description = get_string('headercolordesc', 'theme_overlay');
$default = '#2a4c7b';
$previewconfig = NULL;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
// Foot note setting.
$name = 'theme_overlay/footertext';
$title = get_string('footertext','theme_overlay');
$description = get_string('footertextdesc', 'theme_overlay');
$setting = new admin_setting_confightmleditor($name, $title, $description, '');
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
// Tag line setting
$name = 'theme_overlay/headercolor';
$title = get_string('headercolor','theme_overlay');
$description = get_string('headercolordesc', 'theme_overlay');
$default = '#2a4c7b';
$previewconfig = NULL;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
// Foot note setting
$name = 'theme_overlay/footertext';
$title = get_string('footertext','theme_overlay');
$description = get_string('footertextdesc', 'theme_overlay');
$setting = new admin_setting_confightmleditor($name, $title, $description, '');
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
// Custom CSS file
$name = 'theme_overlay/customcss';
$title = get_string('customcss','theme_overlay');
$description = get_string('customcssdesc', 'theme_overlay');
$setting = new admin_setting_configtextarea($name, $title, $description, '');
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
// Custom CSS file.
$name = 'theme_overlay/customcss';
$title = get_string('customcss','theme_overlay');
$description = get_string('customcssdesc', 'theme_overlay');
$setting = new admin_setting_configtextarea($name, $title, $description, '');
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
}

View File

@ -24,9 +24,9 @@
defined('MOODLE_INTERNAL') || die;
$plugin->version = 2013110500; // The current module version (Date: YYYYMMDDXX)
$plugin->requires = 2013110500; // Requires this Moodle version
$plugin->component = 'theme_overlay'; // Full name of the plugin (used for diagnostics)
$plugin->version = 2013110500; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2013110500; // Requires this Moodle version.
$plugin->component = 'theme_overlay'; // Full name of the plugin (used for diagnostics).
$plugin->dependencies = array(
'theme_canvas' => 2013110500,
);