Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Commit

Permalink
Improve and bug fix properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Jan 28, 2017
1 parent 85db54d commit 5030a95
Show file tree
Hide file tree
Showing 16 changed files with 101 additions and 78 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
*
* @package theme
* @subpackage essential
* @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195}
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @author Based on code originally written by Joby Harding, Bas Brands, David Scotson and many other contributors.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
65 changes: 28 additions & 37 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,66 +14,65 @@ on sites where Moodle would potentially serve as a company homepage rather than

Cool things to know about the theme.
- It attempts to load as many as possible icons from a font
- Most of what you think are "graphics" are actually the [Awesome font](http://fortawesome.github.io/Font-Awesome/)
- Most of what you think are "graphics" are actually the [Awesome font](fontawesome.io)
- The slider on the front page is completely customisable through theme settings.
- I am really trying to push what [Bootstrap](http://twitter.github.io/bootstrap/) Grids can do. As such the theme is fully
- I am really trying to push what [Bootstrap](twitter.github.io/bootstrap/) Grids can do. As such the theme is fully
responsive.
- The footer is all custom Moodle regions. This means blocks can be added.
- The theme can use [Google web fonts](http://www.google.com/fonts/) to give it that extra bit of shazam!
- The theme can use [Google web fonts](fonts.google.com) to give it that extra bit of shazam!
- Social network icons appear at the top of the page dynamically based on theme settings.
- The entire colour scheme can be modified with theme settings.

Developed and maintained by
===========================
Gareth J Barnard MSc. BSc(Hons)(Sndw). MBCS. CEng. CITP. PGCE.
Moodle profile | http://moodle.org/user/profile.php?id=442195
Web profile | http://about.me/gjbarnard
Moodle profile: moodle.org/user/profile.php?id=442195
Web profile: about.me/gjbarnard

Original Developer
==================
Julian Ridden
Moodle profile: https://moodle.org/user/profile.php?id=39680
Web profile: http://au.linkedin.com/in/eduridden/
Moodle profile: moodle.org/user/profile.php?id=39680
Web profile: au.linkedin.com/in/eduridden/

Previous Developer
==================
David Bezemer
Moodle profile | https://moodle.org/user/profile.php?id=1416592
Web profile | http://www.davidbezemer.nl
Moodle profile: moodle.org/user/profile.php?id=1416592
Web profile: www.davidbezemer.nl

Free Software
=============
The Essential theme is 'free' software under the terms of the GNU GPLv3 License, please see 'COPYING.txt'.

It can be obtained for free from:
http://moodle.org/plugins/view.php?plugin=theme_essential
moodle.org/plugins/view.php?plugin=theme_essential
and
https://github.com/gjb2048/moodle-theme_essential/releases
github.com/gjb2048/moodle-theme_essential/releases

You have all the rights granted to you by the GPLv3 license. If you are unsure about anything, then the
FAQ - http://www.gnu.org/licenses/gpl-faq.html - is a good place to look.
FAQ - www.gnu.org/licenses/gpl-faq.html - is a good place to look.

If you reuse any of the code then I kindly ask that you make reference to the theme.

If you make improvements or bug fixes then I would appreciate if you would send them back to me by forking from
https://github.com/gjb2048/moodle-theme_essential and doing a 'Pull Request' so that the rest of the
Moodle community benefits.
github.com/gjb2048/moodle-theme_essential and doing a 'Pull Request' so that the rest of the Moodle community benefits.

Support
=======
As Essential is licensed under the GNU GPLv3 License it comes with NO support. If you would like support from
me (Gareth) then I'm happy to provide it for a fee (please see my contact details above). Otherwise, the 'Themes' forum:
moodle.org/mod/forum/view.php?id=46 is an excellent place to ask questions.
me (Gareth) then I'm happy to provide it for a fee. Please contact me via my 'Moodle profile' in 'Developed and maintained by'
above. Otherwise, the 'Themes' forum: moodle.org/mod/forum/view.php?id=46 is an alternative.

Sponsorships
============
This theme is provided to you for free, and if you want to express your gratitude for using this theme, please consider sponsoring
by:

PayPal - Please contact me (Gareth) via my 'Moodle profile' (above) for details as I am an individual and therefore am unable to have
'buy me now' buttons under their terms.
PayPal - Please contact me (Gareth) via my 'Moodle profile' in 'Developed and maintained by' above for details as I am an individual
and therefore am unable to have 'buy me now' buttons under their terms.

Flattr - https://flattr.com/profile/gjb2048
Flattr - flattr.com/profile/gjb2048

Sponsorships help to facilitate maintenance and allow me to provide you with more and better features. Without your support the theme
cannot be maintained.
Expand Down Expand Up @@ -112,8 +111,8 @@ Toshimi Hatanaka
Customisation
=============
If you like this theme and would like me to customise it, transpose functionality to another theme, build a new theme from scratch
or create a child theme then I offer competitive rates. Please contact me via 'www.gjbarnard.co.uk/contact/' or
'gjbarnard at gmail dot com' or 'about.me/gjbarnard' to discuss your requirements.
or create a child theme then I offer competitive rates. Please contact me via my 'Moodle profile' in 'Developed and maintained by'
above to discuss your requirements.

Required version of Moodle
==========================
Expand Down Expand Up @@ -176,25 +175,18 @@ to do so:

CSlider
=======
The original version of Essential used 'CSlider' -
http://tympanus.net/codrops/2012/03/15/parallax-content-slider-with-css3-and-jquery/.
The original version of Essential used 'CSlider' - tympanus.net/codrops/2012/03/15/parallax-content-slider-with-css3-and-jquery/.

It has been removed because of licencing issues: https://github.com/gjb2048/moodle-theme_essential/issues/61
It has been removed because of licencing issues: github.com/gjb2048/moodle-theme_essential/issues/61

Please do not request that it be put back. The licence that CSlider has is incompatible with GPLv3 and therefore cannot be a part
of or redistributed with the theme.

Videos and FitVids
==================
Essential uses FitVids.js - http://fitvidsjs.com/ - to make embedded videos responsive. If you do not want this feature for a
Essential uses FitVids.js - fitvidsjs.com - to make embedded videos responsive. If you do not want this feature for a
particular video, then please add the class 'fitvidsignore' to the video element.

WOFF2 Font Support
==================
WOFF2 font support will automatically kick in if you are running Moodle 2.8.5+ (Build: 20150313) - 2014111005.01 or above. If you
are and the settings do not appear on the font setting page when using 'Custom font' for 'fontselect', then perform a
'Purge all caches'.

Category course title image in a course
=======================================
If you wish to override the category course title image in a course when this is enabled, then edit the course summary in the course
Expand All @@ -203,7 +195,7 @@ settings and add an image. Then edit in HTML mode, remove the surrounding 'p' t
the height (px) and the contained title text colour, background colour and opacity, use the following attributes: 'ctih', 'ctit',
'ctib' and ctio respectively, for example:

<img src="https://mymoodleinstall.mr/pluginfile.php/493/course/section/237/myimage.jpg" alt="Replacement image" class="categorycti"
<img src="mymoodleinstall.mr/pluginfile.php/493/course/section/237/myimage.jpg" alt="Replacement image" class="categorycti"
ctih="250" ctit="#afafaf" ctib="#222222" ctio="0.5">

This image will not be shown in the summary itself when viewing the list of courses.
Expand All @@ -215,8 +207,7 @@ that you are operating the required version of Moodle as stated at the top - thi
functionality that is out of its control.

When reporting an issue you can post in the theme's forum on Moodle.org (currently 'moodle.org/mod/forum/view.php?id=46')
or check the issue list https://github.com/gjb2048/moodle-theme_essential/issues and if the problem does not exist, create an
issue.
or check the issue list github.com/gjb2048/moodle-theme_essential/issues and if the problem does not exist, create an issue.

It is essential that you provide as much information as possible, the critical information being the contents of the theme's
'version.php' file. Other version information such as specific Moodle version, theme name and version also helps. A screen shot
Expand All @@ -228,9 +219,9 @@ Please look in CHANGES.txt.

See the theme in Action
=======================
A video showing many of the core features is available for viewing at https://www.youtube.com/watch?v=grhmR5PmWtA
A video showing many of the core features is available for viewing at www.youtube.com/watch?v=grhmR5PmWtA

Documentation
=============
As always, documentation is a work in progress. Available documentation is available at http://docs.moodle.org/31/en/Essential_theme
If you have questions you can post them in the issue tracker at https://github.com/gjb2048/moodle-theme_essential/issues
As always, documentation is a work in progress. Available documentation is available at docs.moodle.org/31/en/Essential_theme
If you have questions you can post them in the issue tracker at github.com/gjb2048/moodle-theme_essential/issues
50 changes: 36 additions & 14 deletions classes/toolbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,14 @@ static public function compile_properties($themename, $array = true) {

if ($array) {
$props['moodle_version'] = $CFG->version;
// Put the theme version next so that it will be at the top of the table.
foreach ($themeprops as $themeprop) {
if ($themeprop->name == 'version') {
$props['theme_version'] = $themeprop->value;
unset($themeprops[$themeprop->id]);
break;
}
}

foreach ($themeprops as $themeprop) {
$props[$themeprop->name] = $themeprop->value;
Expand All @@ -841,6 +849,18 @@ static public function compile_properties($themename, $array = true) {
$data->id = 0;
$data->value = $CFG->version;
$props['moodle_version'] = $data;
// Convert 'version' to 'theme_version'.
foreach ($themeprops as $themeprop) {
if ($themeprop->name == 'version') {
$data = new \stdClass();
$data->id = $themeprop->id;
$data->name = 'theme_version';
$data->value = $themeprop->value;
$props['theme_version'] = $data;
unset($themeprops[$themeprop->id]);
break;
}
}
foreach ($themeprops as $themeprop) {
$data = new \stdClass();
$data->id = $themeprop->id;
Expand All @@ -855,15 +875,24 @@ static public function compile_properties($themename, $array = true) {
static public function put_properties($themename, $props) {
global $DB;

$report = get_string('putpropertiereport', 'theme_essential').PHP_EOL;
$report .= 'Moodle '.get_string('putpropertieversion', 'theme_essential').' '.$props['moodle_version'].'.'.PHP_EOL;
unset($props['moodle_version']);
$report .= ucfirst($themename).' '.get_string('putpropertieversion', 'theme_essential').' '.$props['version'].'.'.PHP_EOL.PHP_EOL;
unset($props['version']);

// Get the current properties as a reference.
// Get the current properties as a reference and for theme version information.
$currentprops = self::compile_properties($themename, false);

// Build the report.
$report = get_string('putpropertyreport', 'theme_essential').PHP_EOL;
$report .= get_string('putpropertyproperties', 'theme_essential').' \'Moodle\' '.
get_string('putpropertyversion', 'theme_essential').' '.$props['moodle_version'].'.'.PHP_EOL;
unset($props['moodle_version']);
$report .= get_string('putpropertyour', 'theme_essential').' \'Moodle\' '.
get_string('putpropertyversion', 'theme_essential').' '.$currentprops['moodle_version']->value.'.'.PHP_EOL;
unset($currentprops['moodle_version']);
$report .= get_string('putpropertyproperties', 'theme_essential').' \''.ucfirst($themename).'\' '.
get_string('putpropertyversion', 'theme_essential').' '.$props['theme_version'].'.'.PHP_EOL;
unset($props['theme_version']);
$report .= get_string('putpropertyour', 'theme_essential').' \''.ucfirst($themename).'\' '.
get_string('putpropertyversion', 'theme_essential').' '.$currentprops['theme_version']->value.'.'.PHP_EOL.PHP_EOL;
unset($currentprops['theme_version']);

// Pre-process files - using 'theme_essential_pluginfile' in lib.php as a reference.
// TODO: refactor into one method for both this and that.
$filestoreport = '';
Expand Down Expand Up @@ -922,7 +951,6 @@ static public function put_properties($themename, $props) {

// Need to ignore and report on any unknown settings.
$report .= get_string('putpropertiessettingsreport', 'theme_essential').PHP_EOL;
$changedprops = array();
$changed = '';
$unchanged = '';
$added = '';
Expand All @@ -932,7 +960,6 @@ static public function put_properties($themename, $props) {
$settinglog = '\''.$propkey.'\' '.get_string('putpropertiesvalue', 'theme_essential').' \''.$propvalue.'\'';
if (array_key_exists($propkey, $currentprops)) {
if ($propvalue != $currentprops[$propkey]->value) {
$changedprops[] = $propkey;
$settinglog .= ' '.get_string('putpropertiesfrom', 'theme_essential').' \''.$currentprops[$propkey]->value.'\'';
$changed .= $settinglog.'.'.PHP_EOL;
$DB->update_record('config_plugins', array('id' => $currentprops[$propkey]->id, 'value' => $propvalue), true);
Expand Down Expand Up @@ -961,11 +988,6 @@ static public function put_properties($themename, $props) {
$report .= get_string('putpropertiesignored', 'theme_essential').PHP_EOL.$ignored.PHP_EOL;
}

if (!empty($changedprops)) {
// We need the 'id's for the records.
global $DB;
}

return $report;
}

Expand Down
2 changes: 1 addition & 1 deletion essential_admin_setting_configinteger.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @package theme
* @subpackage essential
* @copyright &copy; 2014-onwards G J Barnard.
* @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195}
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

Expand Down
2 changes: 1 addition & 1 deletion essential_admin_setting_configradio.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @package theme
* @subpackage essential
* @copyright &copy; 2016-onwards G J Barnard.
* @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195}
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

Expand Down
2 changes: 1 addition & 1 deletion essential_admin_setting_configselect.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @package theme
* @subpackage essential
* @copyright &copy; 2016-onwards G J Barnard.
* @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195}
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

Expand Down
2 changes: 1 addition & 1 deletion essential_admin_setting_configtext.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @package theme
* @subpackage essential
* @copyright &copy; 2016-onwards G J Barnard.
* @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195}
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

Expand Down
2 changes: 1 addition & 1 deletion essential_admin_setting_getprops.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @package theme
* @subpackage essential
* @copyright &copy; 2017-onwards G J Barnard.
* @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195}
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

Expand Down
32 changes: 20 additions & 12 deletions essential_admin_setting_putprops.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @package theme
* @subpackage essential
* @copyright &copy; 2017-onwards G J Barnard.
* @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195}
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

Expand Down Expand Up @@ -66,24 +66,32 @@ public function write_setting($data) {
}

/**
* Validate data before storage
* @param string data
* @return mixed true if ok string if error found
* Validate data before storage.
* @param string data.
* @return mixed true if alright, string if error found.
*/
public function validate($data) {
$validated = parent::validate($data); // Pass parent validation first.

if ($validated == true) {
$props = json_decode($data, true);
if ($props === null) {
if (function_exists('json_last_error_msg')) {
$validated = json_last_error_msg();
if (!empty($data)) {
// Only attempt decode if we have the start of a JSON string, otherwise will certainly be the saved report.
if ($data[0] == '{') {
$props = json_decode($data, true);
if ($props === null) {
if (function_exists('json_last_error_msg')) {
$validated = json_last_error_msg();
} else {
// Fall back to numeric error for older PHP version.
$validated = json_last_error();
}
} else {
$this->report = call_user_func($this->callable, $this->themename, $props);
}
} else {
// Fall back to numeric error for older PHP version.
$validated = json_last_error();
// Keep what we have.
$this->report = $data;
}
} else {
$this->report = call_user_func($this->callable, $this->themename, $props);
}
}

Expand Down
2 changes: 1 addition & 1 deletion essential_admin_setting_styleguide.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @package theme
* @subpackage essential
* @copyright &copy; 2016-onwards G J Barnard.
* @author G J Barnard - gjbarnard at gmail dot com and {@link http://moodle.org/user/profile.php?id=442195}
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @license PHP Code: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
* @license Source HTML Code: http://www.apache.org/licenses/LICENSE-2.0 Apache License v2.0:
*
Expand Down
Loading

0 comments on commit 5030a95

Please sign in to comment.