3 // This file is part of Moodle - http://moodle.org/
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
19 * This file contains the settings for the Nonzero theme.
21 * Currently you can set the following settings:
27 * @copyright 2010 Dietmar Wagner
28 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31 function nonzero_process_css($css, $theme) {
34 // Set the region-pre and region-post widths
35 if (!empty($theme->settings
->regionprewidth
) && !empty($theme->settings
->regionpostwidth
)) {
36 $regionprewidth = $theme->settings
->regionprewidth
;
37 $regionpostwidth = $theme->settings
->regionpostwidth
;
39 $regionprewidth = null;
40 $regionpostwidth = null;
42 $css = nonzero_set_regionwidths($css, $regionprewidth, $regionpostwidth);
46 if (!empty($theme->settings
->customcss
)) {
47 $customcss = $theme->settings
->customcss
;
51 $css = nonzero_set_customcss($css, $customcss);
58 * Sets the region width variable in CSS
61 * @param mixed $regionwidth
65 function nonzero_set_regionwidths($css, $regionprewidth, $regionpostwidth) {
66 $tag1 = '[[setting:regionprewidth]]';
67 $tag2 = '[[setting:regionpostwidth]]';
68 $tag3 = '[[setting:regionsumwidth]]';
69 $tag4 = '[[setting:regiondoublepresumwidth]]';
70 $replacement1 = $regionprewidth;
71 $replacement2 = $regionpostwidth;
72 if (is_null($replacement1) or is_null($replacement2)) {
76 $css = str_replace($tag1, $replacement1.'px', $css);
77 $css = str_replace($tag2, $replacement2.'px', $css);
78 $css = str_replace($tag3, ($replacement1+
$replacement2).'px', $css);
79 $css = str_replace($tag4, (2*$replacement1+
$replacement2).'px', $css);
85 * Sets the custom css variable in CSS
88 * @param mixed $customcss
92 function nonzero_set_customcss($css, $customcss) {
93 $tag = '[[setting:customcss]]';
94 $replacement = $customcss;
95 if (is_null($replacement)) {
98 $css = str_replace($tag, $replacement, $css);