MDL-46227 Fix XSS in scheduled tasks
[moodle.git] / calendar / preferences_form.php
blob0ad0fb268ff3b7e9e263007227adf41b372ea529
1 <?php
3 // This file is part of Moodle - http://moodle.org/
4 //
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.
9 //
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/>.
18 /**
19 * The mform for settings user preferences
21 * @copyright 2010 Sam Hemelryk
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 * @package calendar
26 /**
27 * Always include formslib
29 if (!defined('MOODLE_INTERNAL')) {
30 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
33 require_once($CFG->dirroot.'/lib/formslib.php');
35 /**
36 * The mform class for setting user preferences
38 * @copyright 2010 Sam Hemelryk
39 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
41 class calendar_preferences_form extends moodleform {
43 function definition() {
44 $mform = $this->_form;
46 $options = array(
47 '0' => get_string('default', 'calendar'),
48 CALENDAR_TF_12 => get_string('timeformat_12', 'calendar'),
49 CALENDAR_TF_24 => get_string('timeformat_24', 'calendar')
51 $mform->addElement('select', 'timeformat', get_string('pref_timeformat', 'calendar'), $options);
52 $mform->addHelpButton('timeformat', 'pref_timeformat', 'calendar');
54 $options = array(
55 0 => get_string('sunday', 'calendar'),
56 1 => get_string('monday', 'calendar'),
57 2 => get_string('tuesday', 'calendar'),
58 3 => get_string('wednesday', 'calendar'),
59 4 => get_string('thursday', 'calendar'),
60 5 => get_string('friday', 'calendar'),
61 6 => get_string('saturday', 'calendar')
63 $mform->addElement('select', 'startwday', get_string('pref_startwday', 'calendar'), $options);
64 $mform->addHelpButton('startwday', 'pref_startwday', 'calendar');
66 $options = array();
67 for ($i=1; $i<=20; $i++) {
68 $options[$i] = $i;
70 $mform->addElement('select', 'maxevents', get_string('pref_maxevents', 'calendar'), $options);
71 $mform->addHelpButton('maxevents', 'pref_maxevents', 'calendar');
73 $options = array();
74 for ($i=1; $i<=99; $i++) {
75 $options[$i] = $i;
77 $mform->addElement('select', 'lookahead', get_string('pref_lookahead', 'calendar'), $options);
78 $mform->addHelpButton('lookahead', 'pref_lookahead', 'calendar');
80 $options = array(
81 0 => get_string('no'),
82 1 => get_string('yes')
84 $mform->addElement('select', 'persistflt', get_string('pref_persistflt', 'calendar'), $options);
85 $mform->addHelpButton('persistflt', 'pref_persistflt', 'calendar');
87 $this->add_action_buttons(false, get_string('savechanges'));