MDL-36620 - Blog, RSS - Preventing Guests from viewing the RSS of site level blogs
[moodle.git] / theme / mymobile / lib.php
blobabec9ffcb91e15a0bca202ba56f6479fceabab73
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * Lib file for mymobile theme
20 * @package theme
21 * @subpackage mymobile
22 * @copyright John Stabinger
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 /**
27 * Allow AJAX updating of the user defined columns for tablets or not
29 * @param moodle_page $page
31 function mymobile_initialise_colpos(moodle_page $page) {
32 user_preference_allow_ajax_update('theme_mymobile_chosen_colpos', PARAM_ALPHA);
35 /**
36 * Get the user preference for columns for tablets or not
38 * @param string $default
39 * @return mixed
41 function mymobile_get_colpos($default = 'on') {
42 return get_user_preferences('theme_mymobile_chosen_colpos', $default);
45 /**
46 * Makes our changes to the CSS
48 * @param string $css
49 * @param theme_config $theme
50 * @return string
52 function mymobile_user_settings($css, $theme) {
53 if (!empty($theme->settings->customcss)) {
54 $customcss = $theme->settings->customcss;
55 } else {
56 $customcss = null;
58 $css = mymobile_set_customcss($css, $customcss);
59 return $css;
62 function mymobile_set_customcss($css, $customcss) {
63 $tag = '[[setting:customcss]]';
64 $css = str_replace($tag, $customcss, $css);
65 return $css;