source: moodle/trunk/fuentes/calendar/preferences_form.php @ 1331

Last change on this file since 1331 was 136, checked in by mabarracus, 4 years ago

Ported code to xenial

File size: 3.2 KB
Line 
1<?php
2
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.
14//
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/>.
17
18/**
19 * The mform for settings user preferences
20 *
21 * @copyright 2010 Sam Hemelryk
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 * @package calendar
24 */
25
26 /**
27  * Always include formslib
28  */
29if (!defined('MOODLE_INTERNAL')) {
30    die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
31}
32
33require_once($CFG->dirroot.'/lib/formslib.php');
34
35/**
36 * The mform class for setting user preferences
37 *
38 * @copyright 2010 Sam Hemelryk
39 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
40 */
41class calendar_preferences_form extends moodleform {
42
43    function definition() {
44        $mform = $this->_form;
45
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')
50        );
51        $mform->addElement('select', 'timeformat', get_string('pref_timeformat', 'calendar'), $options);
52        $mform->addHelpButton('timeformat', 'pref_timeformat', 'calendar');
53
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')
62        );
63        $mform->addElement('select', 'startwday', get_string('pref_startwday', 'calendar'), $options);
64        $mform->addHelpButton('startwday', 'pref_startwday', 'calendar');
65
66        $options = array();
67        for ($i=1; $i<=20; $i++) {
68            $options[$i] = $i;
69        }
70        $mform->addElement('select', 'maxevents', get_string('pref_maxevents', 'calendar'), $options);
71        $mform->addHelpButton('maxevents', 'pref_maxevents', 'calendar');
72
73        $options = array();
74        for ($i=1; $i<=99; $i++) {
75            $options[$i] = $i;
76        }
77        $mform->addElement('select', 'lookahead', get_string('pref_lookahead', 'calendar'), $options);
78        $mform->addHelpButton('lookahead', 'pref_lookahead', 'calendar');
79
80        $options = array(
81            0 => get_string('no'),
82            1 => get_string('yes')
83        );
84        $mform->addElement('select', 'persistflt', get_string('pref_persistflt', 'calendar'), $options);
85        $mform->addHelpButton('persistflt', 'pref_persistflt', 'calendar');
86
87        $this->add_action_buttons(false, get_string('savechanges'));
88    }
89
90}
Note: See TracBrowser for help on using the repository browser.