MDL-52868 mod_quiz: New Web Service mod_quiz_get_attempt_review
[moodle.git] / calendar / preferences_form.php
blobff3a9e931b71e3817bc0a2fc15db1c3b3cf9c02a
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(365 => new lang_string('numyear', '', 1),
74 270 => get_string('nummonths', '', 9),
75 180 => get_string('nummonths', '', 6),
76 150 => get_string('nummonths', '', 5),
77 120 => get_string('nummonths', '', 4),
78 90 => get_string('nummonths', '', 3),
79 60 => get_string('nummonths', '', 2),
80 30 => get_string('nummonth', '', 1),
81 21 => get_string('numweeks', '', 3),
82 14 => get_string('numweeks', '', 2),
83 7 => get_string('numweek', '', 1),
84 6 => get_string('numdays', '', 6),
85 5 => get_string('numdays', '', 5),
86 4 => get_string('numdays', '', 4),
87 3 => get_string('numdays', '', 3),
88 2 => get_string('numdays', '', 2),
89 1 => get_string('numday', '', 1));
90 $mform->addElement('select', 'lookahead', get_string('pref_lookahead', 'calendar'), $options);
91 $mform->addHelpButton('lookahead', 'pref_lookahead', 'calendar');
93 $options = array(
94 0 => get_string('no'),
95 1 => get_string('yes')
97 $mform->addElement('select', 'persistflt', get_string('pref_persistflt', 'calendar'), $options);
98 $mform->addHelpButton('persistflt', 'pref_persistflt', 'calendar');
100 $this->add_action_buttons(false, get_string('savechanges'));