mirror of
https://github.com/moodle/moodle.git
synced 2025-01-30 20:19:01 +01:00
MDL-39276 theme_clean: Renamed Simple theme to Clean theme.
This commit is contained in:
parent
3a8c4380c0
commit
109cdf6bd8
@ -2,7 +2,7 @@
|
|||||||
/* How to copy and customise this theme.
|
/* How to copy and customise this theme.
|
||||||
----------------------------------------*/
|
----------------------------------------*/
|
||||||
|
|
||||||
This document describes how to copy and customise the Simple (bootstrap) theme so that
|
This document describes how to copy and customise the Clean (bootstrapbase) theme so that
|
||||||
you can build on this to create a theme of your own. It assumes you have some
|
you can build on this to create a theme of your own. It assumes you have some
|
||||||
understanding of how themes work within Moodle 2.5, as well as a basic understanding
|
understanding of how themes work within Moodle 2.5, as well as a basic understanding
|
||||||
of HTML and CSS.
|
of HTML and CSS.
|
||||||
@ -10,13 +10,13 @@ of HTML and CSS.
|
|||||||
Getting started
|
Getting started
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
From your Moodle theme directory right click on simple and then copy and paste back
|
From your Moodle theme directory right click on clean and then copy and paste back
|
||||||
into your Moodle theme directory. You should now have a folder called Copy of simple.
|
into your Moodle theme directory. You should now have a folder called Copy of clean.
|
||||||
If you right click this folder you are given the option to Rename it. So rename this
|
If you right click this folder you are given the option to Rename it. So rename this
|
||||||
folder to your chosen theme name, using only lower case letters, and if needed,
|
folder to your chosen theme name, using only lower case letters, and if needed,
|
||||||
underscores. For the purpose of this tutorial we will call the theme 'simple2'.
|
underscores. For the purpose of this tutorial we will call the theme 'cleantheme'.
|
||||||
|
|
||||||
On opening 'simple2' your you will find several files and sub-directories which have
|
On opening 'cleantheme' your you will find several files and sub-directories which have
|
||||||
files within them.
|
files within them.
|
||||||
|
|
||||||
These are:
|
These are:
|
||||||
@ -38,7 +38,7 @@ version.php
|
|||||||
if and when you want to add them.
|
if and when you want to add them.
|
||||||
/lang/en/
|
/lang/en/
|
||||||
This sub-directory contains your language files, in this case English.
|
This sub-directory contains your language files, in this case English.
|
||||||
/lang/en/theme_simple.php
|
/lang/en/theme_clean.php
|
||||||
This file contains all the language strings for your theme.
|
This file contains all the language strings for your theme.
|
||||||
(Contains some elements that require renaming as well as the filename itself).
|
(Contains some elements that require renaming as well as the filename itself).
|
||||||
/layout/
|
/layout/
|
||||||
@ -57,10 +57,10 @@ Renaming elements
|
|||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
The problem when copying a theme is that you need to rename all those instances
|
The problem when copying a theme is that you need to rename all those instances
|
||||||
where the old theme name occurs, in this case simple. So using the above list as
|
where the old theme name occurs, in this case clean. So using the above list as
|
||||||
a guide, search through and change all the instances of the theme name
|
a guide, search through and change all the instances of the theme name
|
||||||
'simple' to 'simple2'. This includes the filename of the lang/en/theme_simple.php.
|
'clean' to 'cleantheme'. This includes the filename of the lang/en/theme_clean.php.
|
||||||
You need to change this to 'theme_simple2.php'.
|
You need to change this to 'theme_cleantheme.php'.
|
||||||
|
|
||||||
Installing your theme
|
Installing your theme
|
||||||
---------------------
|
---------------------
|
||||||
@ -74,12 +74,12 @@ If not then navigate to Administration > Notifications.
|
|||||||
Once your theme is successfully installed you can select it and begin to modify
|
Once your theme is successfully installed you can select it and begin to modify
|
||||||
it using the custom settings page found by navigating to...
|
it using the custom settings page found by navigating to...
|
||||||
Administration > Site Administration > Appearance > Themes >>
|
Administration > Site Administration > Appearance > Themes >>
|
||||||
and then click on (Simple2) or whatever you renamed the theme to,
|
and then click on (Cleantheme) or whatever you renamed your theme to,
|
||||||
from the list of theme names that appear at this point in the side block.
|
from the list of theme names that appear at this point in the side block.
|
||||||
|
|
||||||
Customisation using custom theme settings
|
Customisation using custom theme settings
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
The settings page for this theme can be located by navigating to:
|
The settings page for the Clean theme can be located by navigating to:
|
||||||
|
|
||||||
Administration > Site Administration > Appearance > Themes > Simple
|
Administration > Site Administration > Appearance > Themes > Clean
|
@ -23,17 +23,17 @@
|
|||||||
* For full information about creating Moodle themes, see:
|
* For full information about creating Moodle themes, see:
|
||||||
* http://docs.moodle.org/dev/Themes_2.0
|
* http://docs.moodle.org/dev/Themes_2.0
|
||||||
*
|
*
|
||||||
* @package theme_simple
|
* @package theme_clean
|
||||||
* @copyright 2013 Moodle, moodle.org
|
* @copyright 2013 Moodle, moodle.org
|
||||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$THEME->name = 'simple';
|
$THEME->name = 'clean';
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// The only thing you need to change in this file when copying it to
|
// The only thing you need to change in this file when copying it to
|
||||||
// create a new theme is the name above. You also need to change the name
|
// create a new theme is the name above. You also need to change the name
|
||||||
// in version.php and lang/en/theme_simple.php as well.
|
// in version.php and lang/en/theme_clean.php as well.
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
//
|
//
|
||||||
$THEME->doctype = 'html5';
|
$THEME->doctype = 'html5';
|
||||||
@ -56,7 +56,7 @@ $THEME->plugins_exclude_sheets = array(
|
|||||||
);
|
);
|
||||||
|
|
||||||
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
|
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
|
||||||
$THEME->csspostprocess = 'simple_process_css';
|
$THEME->csspostprocess = 'clean_process_css';
|
||||||
|
|
||||||
$useragent = '';
|
$useragent = '';
|
||||||
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
|
if (!empty($_SERVER['HTTP_USER_AGENT'])) {
|
@ -15,22 +15,22 @@
|
|||||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Strings for component 'theme_simple', language 'en'
|
* Strings for component 'theme_clean', language 'en'
|
||||||
*
|
*
|
||||||
* @package theme_simple
|
* @package theme_clean
|
||||||
* @copyright 2013 Bas Brands, www.basbrands.nl
|
* @copyright 2013 Moodle, moodle.org
|
||||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$string['choosereadme'] = '
|
$string['choosereadme'] = '
|
||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
<div class="well">
|
<div class="well">
|
||||||
<h2>Simple</h2>
|
<h2>Clean</h2>
|
||||||
<p><img class=img-polaroid src="simple/pix/screenshot.jpg" /></p>
|
<p><img class=img-polaroid src="clean/pix/screenshot.jpg" /></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="well">
|
<div class="well">
|
||||||
<h3>About</h3>
|
<h3>About</h3>
|
||||||
<p>Simple is a modified Moodle bootstrap theme which inherits styles and renderers from its parent theme.</p>
|
<p>Clean is a modified Moodle bootstrap theme which inherits styles and renderers from its parent theme.</p>
|
||||||
<h3>Parents</h3>
|
<h3>Parents</h3>
|
||||||
<p>This theme is based upon the Bootstrap theme, which was created for Moodle 2.5, with the help of:<br>
|
<p>This theme is based upon the Bootstrap theme, which was created for Moodle 2.5, with the help of:<br>
|
||||||
Stuart Lamour, Mark Aberdour, Paul Hibbitts, Mary Evans.</p>
|
Stuart Lamour, Mark Aberdour, Paul Hibbitts, Mary Evans.</p>
|
||||||
@ -42,10 +42,10 @@ Website: <a href="http://www.basbrands.nl">www.basbrands.nl</a>
|
|||||||
<h3>Report a bug:</h3>
|
<h3>Report a bug:</h3>
|
||||||
<p><a href="http://tracker.moodle.org">http://tracker.moodle.org</a></p>
|
<p><a href="http://tracker.moodle.org">http://tracker.moodle.org</a></p>
|
||||||
<h3>More information</h3>
|
<h3>More information</h3>
|
||||||
<p><a href="simple/README.txt">How to copy and customise this theme.</a></p>
|
<p><a href="clean/README.txt">How to copy and customise this theme.</a></p>
|
||||||
</div></div>';
|
</div></div>';
|
||||||
|
|
||||||
$string['configtitle'] = 'Simple';
|
$string['configtitle'] = 'Clean';
|
||||||
|
|
||||||
$string['customcss'] = 'Custom CSS';
|
$string['customcss'] = 'Custom CSS';
|
||||||
$string['customcssdesc'] = 'Whatever CSS rules you add to this textarea will be reflected in every page, making for easier customization of this theme.';
|
$string['customcssdesc'] = 'Whatever CSS rules you add to this textarea will be reflected in every page, making for easier customization of this theme.';
|
||||||
@ -61,7 +61,7 @@ $string['logodesc'] = 'Please upload your custom logo here if you want to add it
|
|||||||
If the height of your logo is more than 75px add the following CSS rule to the Custom CSS box below.<br>
|
If the height of your logo is more than 75px add the following CSS rule to the Custom CSS box below.<br>
|
||||||
a.logo {height: 100px;} or whatever height in pixels the logo is.';
|
a.logo {height: 100px;} or whatever height in pixels the logo is.';
|
||||||
|
|
||||||
$string['pluginname'] = 'Simple';
|
$string['pluginname'] = 'Clean';
|
||||||
|
|
||||||
$string['region-side-post'] = 'Right';
|
$string['region-side-post'] = 'Right';
|
||||||
$string['region-side-pre'] = 'Left';
|
$string['region-side-pre'] = 'Left';
|
@ -23,16 +23,16 @@
|
|||||||
* For full information about creating Moodle themes, see:
|
* For full information about creating Moodle themes, see:
|
||||||
* http://docs.moodle.org/dev/Themes_2.0
|
* http://docs.moodle.org/dev/Themes_2.0
|
||||||
*
|
*
|
||||||
* @package theme_simple
|
* @package theme_clean
|
||||||
* @copyright 2013 Moodle, moodle.org
|
* @copyright 2013 Moodle, moodle.org
|
||||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function simple_process_css($css, $theme) {
|
function clean_process_css($css, $theme) {
|
||||||
|
|
||||||
// Set the background image for the logo.
|
// Set the background image for the logo.
|
||||||
$logo = $theme->setting_file_url('logo', 'logo');
|
$logo = $theme->setting_file_url('logo', 'logo');
|
||||||
$css = simple_set_logo($css, $logo);
|
$css = clean_set_logo($css, $logo);
|
||||||
|
|
||||||
// Set custom CSS.
|
// Set custom CSS.
|
||||||
if (!empty($theme->settings->customcss)) {
|
if (!empty($theme->settings->customcss)) {
|
||||||
@ -40,12 +40,12 @@ function simple_process_css($css, $theme) {
|
|||||||
} else {
|
} else {
|
||||||
$customcss = null;
|
$customcss = null;
|
||||||
}
|
}
|
||||||
$css = simple_set_customcss($css, $customcss);
|
$css = clean_set_customcss($css, $customcss);
|
||||||
|
|
||||||
return $css;
|
return $css;
|
||||||
}
|
}
|
||||||
|
|
||||||
function simple_set_logo($css, $logo) {
|
function clean_set_logo($css, $logo) {
|
||||||
global $OUTPUT;
|
global $OUTPUT;
|
||||||
$tag = '[[setting:logo]]';
|
$tag = '[[setting:logo]]';
|
||||||
$replacement = $logo;
|
$replacement = $logo;
|
||||||
@ -58,16 +58,16 @@ function simple_set_logo($css, $logo) {
|
|||||||
return $css;
|
return $css;
|
||||||
}
|
}
|
||||||
|
|
||||||
function theme_simple_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
|
function theme_clean_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
|
||||||
if ($context->contextlevel == CONTEXT_SYSTEM and $filearea === 'logo') {
|
if ($context->contextlevel == CONTEXT_SYSTEM and $filearea === 'logo') {
|
||||||
$theme = theme_config::load('simple');
|
$theme = theme_config::load('clean');
|
||||||
return $theme->setting_file_serve('logo', $args, $forcedownload, $options);
|
return $theme->setting_file_serve('logo', $args, $forcedownload, $options);
|
||||||
} else {
|
} else {
|
||||||
send_file_not_found();
|
send_file_not_found();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function simple_set_customcss($css, $customcss) {
|
function clean_set_customcss($css, $customcss) {
|
||||||
$tag = '[[setting:customcss]]';
|
$tag = '[[setting:customcss]]';
|
||||||
$replacement = $customcss;
|
$replacement = $customcss;
|
||||||
if (is_null($replacement)) {
|
if (is_null($replacement)) {
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
@ -23,7 +23,7 @@
|
|||||||
* For full information about creating Moodle themes, see:
|
* For full information about creating Moodle themes, see:
|
||||||
* http://docs.moodle.org/dev/Themes_2.0
|
* http://docs.moodle.org/dev/Themes_2.0
|
||||||
*
|
*
|
||||||
* @package theme_simple
|
* @package theme_clean
|
||||||
* @copyright 2013 Moodle, moodle.org
|
* @copyright 2013 Moodle, moodle.org
|
||||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
*/
|
*/
|
||||||
@ -33,32 +33,32 @@ defined('MOODLE_INTERNAL') || die;
|
|||||||
if ($ADMIN->fulltree) {
|
if ($ADMIN->fulltree) {
|
||||||
|
|
||||||
// Invert Navbar to dark background.
|
// Invert Navbar to dark background.
|
||||||
$name = 'theme_simple/invert';
|
$name = 'theme_clean/invert';
|
||||||
$title = get_string('invert', 'theme_simple');
|
$title = get_string('invert', 'theme_clean');
|
||||||
$description = get_string('invertdesc', 'theme_simple');
|
$description = get_string('invertdesc', 'theme_clean');
|
||||||
$setting = new admin_setting_configcheckbox($name, $title, $description, 0);
|
$setting = new admin_setting_configcheckbox($name, $title, $description, 0);
|
||||||
$settings->add($setting);
|
$settings->add($setting);
|
||||||
|
|
||||||
// Logo file setting.
|
// Logo file setting.
|
||||||
$name = 'theme_simple/logo';
|
$name = 'theme_clean/logo';
|
||||||
$title = get_string('logo','theme_simple');
|
$title = get_string('logo','theme_clean');
|
||||||
$description = get_string('logodesc', 'theme_simple');
|
$description = get_string('logodesc', 'theme_clean');
|
||||||
$setting = new admin_setting_configstoredfile($name, $title, $description, 'logo');
|
$setting = new admin_setting_configstoredfile($name, $title, $description, 'logo');
|
||||||
$setting->set_updatedcallback('theme_reset_all_caches');
|
$setting->set_updatedcallback('theme_reset_all_caches');
|
||||||
$settings->add($setting);
|
$settings->add($setting);
|
||||||
|
|
||||||
// Custom CSS file.
|
// Custom CSS file.
|
||||||
$name = 'theme_simple/customcss';
|
$name = 'theme_clean/customcss';
|
||||||
$title = get_string('customcss', 'theme_simple');
|
$title = get_string('customcss', 'theme_clean');
|
||||||
$description = get_string('customcssdesc', 'theme_simple');
|
$description = get_string('customcssdesc', 'theme_clean');
|
||||||
$default = '';
|
$default = '';
|
||||||
$setting = new admin_setting_configtextarea($name, $title, $description, $default);
|
$setting = new admin_setting_configtextarea($name, $title, $description, $default);
|
||||||
$settings->add($setting);
|
$settings->add($setting);
|
||||||
|
|
||||||
// Footnote setting.
|
// Footnote setting.
|
||||||
$name = 'theme_simple/footnote';
|
$name = 'theme_clean/footnote';
|
||||||
$title = get_string('footnote', 'theme_simple');
|
$title = get_string('footnote', 'theme_clean');
|
||||||
$description = get_string('footnotedesc', 'theme_simple');
|
$description = get_string('footnotedesc', 'theme_clean');
|
||||||
$default = '';
|
$default = '';
|
||||||
$setting = new admin_setting_confightmleditor($name, $title, $description, $default);
|
$setting = new admin_setting_confightmleditor($name, $title, $description, $default);
|
||||||
$settings->add($setting);
|
$settings->add($setting);
|
@ -23,13 +23,13 @@
|
|||||||
* For full information about creating Moodle themes, see:
|
* For full information about creating Moodle themes, see:
|
||||||
* http://docs.moodle.org/dev/Themes_2.0
|
* http://docs.moodle.org/dev/Themes_2.0
|
||||||
*
|
*
|
||||||
* @package theme_simple
|
* @package theme_clean
|
||||||
* @copyright 2013 Moodle, moodle.org
|
* @copyright 2013 Moodle, moodle.org
|
||||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die;
|
defined('MOODLE_INTERNAL') || die;
|
||||||
|
|
||||||
$plugin->version = 2013041000;
|
$plugin->version = 2013042400;
|
||||||
$plugin->requires = 2013040500;
|
$plugin->requires = 2013040500;
|
||||||
$plugin->component = 'theme_simple';
|
$plugin->component = 'theme_clean';
|
Loading…
x
Reference in New Issue
Block a user