MDL-44200 theme_brick: unified @package use and improved coding style
This commit is contained in:
@@ -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 for the Brick theme.
|
||||
*
|
||||
* @package theme_brick
|
||||
* @copyright 2010 John Stabinger (http://newschoollearning.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());
|
||||
|
||||
@@ -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 for the Brick theme.
|
||||
*
|
||||
* @package theme_brick
|
||||
* @copyright 2010 John Stabinger (http://newschoollearning.com/)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$hasheading = ($PAGE->heading);
|
||||
$hasnavbutton = ($PAGE->button);
|
||||
|
||||
+92
-29
@@ -1,4 +1,34 @@
|
||||
<?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 Brick theme.
|
||||
*
|
||||
* @package theme_brick
|
||||
* @copyright 2010 John Stabinger (http://newschoollearning.com/)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sets the link colour used by the Brick theme.
|
||||
*
|
||||
* @param string $css
|
||||
* @param string $linkcolor
|
||||
* @return string
|
||||
*/
|
||||
function brick_set_linkcolor($css, $linkcolor) {
|
||||
$tag = '[[setting:linkcolor]]';
|
||||
$replacement = $linkcolor;
|
||||
@@ -9,6 +39,13 @@ function brick_set_linkcolor($css, $linkcolor) {
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the link hover colour used by the Brick theme.
|
||||
*
|
||||
* @param string $css
|
||||
* @param string $linkhover
|
||||
* @return string
|
||||
*/
|
||||
function brick_set_linkhover($css, $linkhover) {
|
||||
$tag = '[[setting:linkhover]]';
|
||||
$replacement = $linkhover;
|
||||
@@ -19,6 +56,13 @@ function brick_set_linkhover($css, $linkhover) {
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the main colour used by the Brick theme.
|
||||
*
|
||||
* @param string $css
|
||||
* @param string $maincolor
|
||||
* @return string
|
||||
*/
|
||||
function brick_set_maincolor($css, $maincolor) {
|
||||
$tag = '[[setting:maincolor]]';
|
||||
$replacement = $maincolor;
|
||||
@@ -29,6 +73,13 @@ function brick_set_maincolor($css, $maincolor) {
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the main link colour used by the Brick theme.
|
||||
*
|
||||
* @param string $css
|
||||
* @param string $maincolorlink
|
||||
* @return string
|
||||
*/
|
||||
function brick_set_maincolorlink($css, $maincolorlink) {
|
||||
$tag = '[[setting:maincolorlink]]';
|
||||
$replacement = $maincolorlink;
|
||||
@@ -39,6 +90,13 @@ function brick_set_maincolorlink($css, $maincolorlink) {
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the headig colour used by the brick theme.
|
||||
*
|
||||
* @param string $css
|
||||
* @param string $headingcolor
|
||||
* @return string
|
||||
*/
|
||||
function brick_set_headingcolor($css, $headingcolor) {
|
||||
$tag = '[[setting:headingcolor]]';
|
||||
$replacement = $headingcolor;
|
||||
@@ -49,55 +107,65 @@ function brick_set_headingcolor($css, $headingcolor) {
|
||||
return $css;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the logo used by the Brick theme.
|
||||
*
|
||||
* @param string $css
|
||||
* @param string $logo
|
||||
* @param theme_config $theme
|
||||
* @return string
|
||||
*/
|
||||
function brick_set_logo($css, $logo, $theme) {
|
||||
$tag = '[[setting:logo]]';
|
||||
$replacement = $logo;
|
||||
if (is_null($replacement)) {
|
||||
$replacement = $theme->pix_url('logo', 'theme');
|
||||
}
|
||||
$css = str_replace($tag, $replacement, $css);
|
||||
return $css;
|
||||
$tag = '[[setting:logo]]';
|
||||
$replacement = $logo;
|
||||
if (is_null($replacement)) {
|
||||
$replacement = $theme->pix_url('logo', 'theme');
|
||||
}
|
||||
$css = str_replace($tag, $replacement, $css);
|
||||
return $css;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Processes CSS adding Brick customisations to it before it is cached and delivered.
|
||||
*
|
||||
* @param string $css
|
||||
* @param theme_config $theme
|
||||
* @return string
|
||||
*/
|
||||
function brick_process_css($css, $theme) {
|
||||
|
||||
if (!empty($theme->settings->linkcolor)) {
|
||||
|
||||
if (!empty($theme->settings->linkcolor)) {
|
||||
$linkcolor = $theme->settings->linkcolor;
|
||||
} else {
|
||||
$linkcolor = null;
|
||||
}
|
||||
$css = brick_set_linkcolor($css, $linkcolor);
|
||||
|
||||
// Set the link hover color
|
||||
// Set the link hover color.
|
||||
if (!empty($theme->settings->linkhover)) {
|
||||
$linkhover = $theme->settings->linkhover;
|
||||
} else {
|
||||
$linkhover = null;
|
||||
}
|
||||
$css = brick_set_linkhover($css, $linkhover);
|
||||
|
||||
// Set the main color
|
||||
|
||||
// Set the main color.
|
||||
if (!empty($theme->settings->maincolor)) {
|
||||
$maincolor = $theme->settings->maincolor;
|
||||
} else {
|
||||
$maincolor = null;
|
||||
}
|
||||
$css = brick_set_maincolor($css, $maincolor);
|
||||
|
||||
// Set the main accent color
|
||||
|
||||
// Set the main accent color.
|
||||
if (!empty($theme->settings->maincolorlink)) {
|
||||
$maincolorlink = $theme->settings->maincolorlink;
|
||||
} else {
|
||||
$maincolorlink = null;
|
||||
}
|
||||
$css = brick_set_maincolorlink($css, $maincolorlink);
|
||||
|
||||
// Set the main headings color
|
||||
|
||||
// Set the main headings color.
|
||||
if (!empty($theme->settings->headingcolor)) {
|
||||
$headingcolor = $theme->settings->headingcolor;
|
||||
} else {
|
||||
@@ -105,18 +173,13 @@ function brick_process_css($css, $theme) {
|
||||
}
|
||||
$css = brick_set_headingcolor($css, $headingcolor);
|
||||
|
||||
// Set the logo image
|
||||
// Set the logo image.
|
||||
if (!empty($theme->settings->logo)) {
|
||||
$logo = $theme->settings->logo;
|
||||
} else {
|
||||
$logo = null;
|
||||
}
|
||||
$css = brick_set_logo($css, $logo, $theme);
|
||||
|
||||
|
||||
|
||||
|
||||
return $css;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+74
-53
@@ -1,66 +1,87 @@
|
||||
<?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 Brick theme.
|
||||
*
|
||||
* @package theme_brick
|
||||
* @copyright 2010 John Stabinger (http://newschoollearning.com/)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
if ($ADMIN->fulltree) {
|
||||
|
||||
// Background image setting
|
||||
// logo image setting
|
||||
$name = 'theme_brick/logo';
|
||||
$title = get_string('logo','theme_brick');
|
||||
$description = get_string('logodesc', 'theme_brick');
|
||||
$setting = new admin_setting_configtext($name, $title, $description, '', PARAM_URL);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$settings->add($setting);
|
||||
// Background image setting logo image setting.
|
||||
$name = 'theme_brick/logo';
|
||||
$title = get_string('logo','theme_brick');
|
||||
$description = get_string('logodesc', 'theme_brick');
|
||||
$setting = new admin_setting_configtext($name, $title, $description, '', PARAM_URL);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$settings->add($setting);
|
||||
|
||||
// link color setting
|
||||
$name = 'theme_brick/linkcolor';
|
||||
$title = get_string('linkcolor','theme_brick');
|
||||
$description = get_string('linkcolordesc', 'theme_brick');
|
||||
$default = '#06365b';
|
||||
$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_brick/linkcolor';
|
||||
$title = get_string('linkcolor','theme_brick');
|
||||
$description = get_string('linkcolordesc', 'theme_brick');
|
||||
$default = '#06365b';
|
||||
$previewconfig = NULL;
|
||||
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$settings->add($setting);
|
||||
|
||||
// link hover color setting
|
||||
$name = 'theme_brick/linkhover';
|
||||
$title = get_string('linkhover','theme_brick');
|
||||
$description = get_string('linkhoverdesc', 'theme_brick');
|
||||
$default = '#5487ad';
|
||||
$previewconfig = NULL;
|
||||
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$settings->add($setting);
|
||||
// Link hover color setting.
|
||||
$name = 'theme_brick/linkhover';
|
||||
$title = get_string('linkhover','theme_brick');
|
||||
$description = get_string('linkhoverdesc', 'theme_brick');
|
||||
$default = '#5487ad';
|
||||
$previewconfig = NULL;
|
||||
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$settings->add($setting);
|
||||
|
||||
// main color setting
|
||||
$name = 'theme_brick/maincolor';
|
||||
$title = get_string('maincolor','theme_brick');
|
||||
$description = get_string('maincolordesc', 'theme_brick');
|
||||
$default = '#8e2800';
|
||||
$previewconfig = NULL;
|
||||
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$settings->add($setting);
|
||||
// Main color setting.
|
||||
$name = 'theme_brick/maincolor';
|
||||
$title = get_string('maincolor','theme_brick');
|
||||
$description = get_string('maincolordesc', 'theme_brick');
|
||||
$default = '#8e2800';
|
||||
$previewconfig = NULL;
|
||||
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$settings->add($setting);
|
||||
|
||||
// main color accent setting
|
||||
$name = 'theme_brick/maincolorlink';
|
||||
$title = get_string('maincolorlink','theme_brick');
|
||||
$description = get_string('maincolorlinkdesc', 'theme_brick');
|
||||
$default = '#fff0a5';
|
||||
$previewconfig = NULL;
|
||||
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$settings->add($setting);
|
||||
// Main color accent setting.
|
||||
$name = 'theme_brick/maincolorlink';
|
||||
$title = get_string('maincolorlink','theme_brick');
|
||||
$description = get_string('maincolorlinkdesc', 'theme_brick');
|
||||
$default = '#fff0a5';
|
||||
$previewconfig = NULL;
|
||||
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$settings->add($setting);
|
||||
|
||||
// heading color setting
|
||||
$name = 'theme_brick/headingcolor';
|
||||
$title = get_string('headingcolor','theme_brick');
|
||||
$description = get_string('headingcolordesc', 'theme_brick');
|
||||
$default = '#5c3500';
|
||||
$previewconfig = NULL;
|
||||
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$settings->add($setting);
|
||||
// Heading color setting.
|
||||
$name = 'theme_brick/headingcolor';
|
||||
$title = get_string('headingcolor','theme_brick');
|
||||
$description = get_string('headingcolordesc', 'theme_brick');
|
||||
$default = '#5c3500';
|
||||
$previewconfig = NULL;
|
||||
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
|
||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||
$settings->add($setting);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user