MDL-44194 theme_anomaly: unified @package use and improved coding style

This commit is contained in:
Sam Hemelryk 2014-02-17 11:13:57 +13:00
parent 692d247a3a
commit 83eb9e0e9d
9 changed files with 180 additions and 11 deletions

View File

@ -1,8 +1,26 @@
<?php
////////////////////////////////////////////////////////////////////////////////
/// This file contains a few configuration variables that control
/// how Moodle uses this theme.
////////////////////////////////////////////////////////////////////////////////
// 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 a few configuration variables that control how Moodle uses this theme.
*
* @package theme_anomaly
* @copyright 2010 Patrick Malley (http://newschoollearning.com/)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$THEME->name = 'anomaly';

View File

@ -1,5 +1,4 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify

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 for the Anomaly theme.
*
* @package theme_anomaly
* @copyright 2010 Patrick Malley (http://newschoollearning.com/)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$hassidepre = $PAGE->blocks->region_has_content('side-pre', $OUTPUT);
$hassidepost = $PAGE->blocks->region_has_content('side-post', $OUTPUT);

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 for the Anomaly theme.
*
* @package theme_anomaly
* @copyright 2010 Patrick Malley (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());

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 report layout for the Anomaly theme.
*
* @package theme_anomaly
* @copyright 2010 Patrick Malley (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());

View File

@ -1,8 +1,37 @@
<?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 Anomaly theme.
*
* @package theme_anomaly
* @copyright 2010 Patrick Malley (http://newschoollearning.com/)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Process CSS applying theme customisations before it is cached and delivered.
*
* @param string $css
* @param theme_config $theme
* @return string
*/
function anomaly_process_css($css, $theme) {
// Set custom CSS
// Set custom CSS.
if (!empty($theme->settings->customcss)) {
$customcss = $theme->settings->customcss;
} else {
@ -13,6 +42,13 @@ function anomaly_process_css($css, $theme) {
return $css;
}
/**
* Adds custom CSS set by the admin to the CSS for the Anomaly theme.
*
* @param string $css
* @param string $customcss
* @return string
*/
function anomaly_set_customcss($css, $customcss) {
$tag = '[[setting:customcss]]';
$replacement = $customcss;

View File

@ -1,5 +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 renderers overridden by the Anomaly theme.
*
* @package theme_anomaly
* @copyright 2010 Patrick Malley (http://newschoollearning.com/)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Class theme_anomaly_core_renderer
*
* @copyright 2010 Patrick Malley (http://newschoollearning.com/)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class theme_anomaly_core_renderer extends core_renderer {
/**

View File

@ -1,21 +1,43 @@
<?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/>.
/**
* Anomaly theme settings.
*
* @package theme_anomaly
* @copyright 2013 Mary Evans
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
// Tagline setting
// Tagline setting.
$name = 'theme_anomaly/tagline';
$title = get_string('tagline','theme_anomaly');
$title = get_string('tagline', 'theme_anomaly');
$description = get_string('taglinedesc', 'theme_anomaly');
$default = '';
$setting = new admin_setting_configtext($name, $title, $description, $default);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
// Custom CSS file
// Custom CSS file.
$name = 'theme_anomaly/customcss';
$title = get_string('customcss','theme_anomaly');
$title = get_string('customcss', 'theme_anomaly');
$description = get_string('customcssdesc', 'theme_anomaly');
$default = '';
$setting = new admin_setting_configtextarea($name, $title, $description, $default);

View File

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