Skip to content

Commit

Permalink
Merge branch '44208-27' of git://github.com/samhemelryk/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Feb 19, 2014
2 parents bf9c946 + cb5e8d0 commit 6030ef5
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 15 deletions.
22 changes: 22 additions & 0 deletions theme/nonzero/layout/frontpage.php
@@ -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_nonzero
* @copyright 2010 Patrick Malley
* @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());
Expand Down
22 changes: 22 additions & 0 deletions theme/nonzero/layout/general.php
@@ -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_nonzero
* @copyright 2010 Patrick Malley
* @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());
Expand Down
20 changes: 8 additions & 12 deletions theme/nonzero/lib.php
Expand Up @@ -29,8 +29,7 @@

function nonzero_process_css($css, $theme) {


// Set the region-pre and region-post widths
// Set the region-pre and region-post widths.
if (!empty($theme->settings->regionprewidth) && !empty($theme->settings->regionpostwidth)) {
$regionprewidth = $theme->settings->regionprewidth;
$regionpostwidth = $theme->settings->regionpostwidth;
Expand All @@ -40,27 +39,26 @@ function nonzero_process_css($css, $theme) {
}
$css = nonzero_set_regionwidths($css, $regionprewidth, $regionpostwidth);


// Set the custom CSS
// Set the custom CSS.
if (!empty($theme->settings->customcss)) {
$customcss = $theme->settings->customcss;
} else {
$customcss = null;
}
$css = nonzero_set_customcss($css, $customcss);

// Return the CSS
// Return the CSS.
return $css;
}

/**
* Sets the region width variable in CSS
*
* @param string $css
* @param mixed $regionwidth
* @param string $regionprewidth
* @param string $regionpostwidth
* @return string
*/

function nonzero_set_regionwidths($css, $regionprewidth, $regionpostwidth) {
$tag1 = '[[setting:regionprewidth]]';
$tag2 = '[[setting:regionpostwidth]]';
Expand All @@ -74,20 +72,18 @@ function nonzero_set_regionwidths($css, $regionprewidth, $regionpostwidth) {
}
$css = str_replace($tag1, $replacement1.'px', $css);
$css = str_replace($tag2, $replacement2.'px', $css);
$css = str_replace($tag3, ($replacement1+$replacement2).'px', $css);
$css = str_replace($tag4, (2*$replacement1+$replacement2).'px', $css);
$css = str_replace($tag3, ($replacement1 + $replacement2).'px', $css);
$css = str_replace($tag4, (2 * $replacement1 + $replacement2).'px', $css);
return $css;
}


/**
* Sets the custom css variable in CSS
*
* @param string $css
* @param mixed $customcss
* @param string $customcss
* @return string
*/

function nonzero_set_customcss($css, $customcss) {
$tag = '[[setting:customcss]]';
$replacement = $customcss;
Expand Down
6 changes: 3 additions & 3 deletions theme/nonzero/settings.php
Expand Up @@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die;

if ($ADMIN->fulltree) {
// Block region-pre width
// Block region-pre width.
$name = 'theme_nonzero/regionprewidth';
$title = get_string('regionprewidth','theme_nonzero');
$description = get_string('regionprewidthdesc', 'theme_nonzero');
Expand All @@ -40,7 +40,7 @@
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);

// Block region-post width
// Block region-post width.
$name = 'theme_nonzero/regionpostwidth';
$title = get_string('regionpostwidth','theme_nonzero');
$description = get_string('regionpostwidthdesc', 'theme_nonzero');
Expand All @@ -50,7 +50,7 @@
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);

// Custom CSS file
// Custom CSS file.
$name = 'theme_nonzero/customcss';
$title = get_string('customcss','theme_nonzero');
$description = get_string('customcssdesc', 'theme_nonzero');
Expand Down

0 comments on commit 6030ef5

Please sign in to comment.