[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/calendar/ -> preferences_form.php (source)

   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    */
  29  if (!defined('MOODLE_INTERNAL')) {
  30      die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
  31  }
  32  
  33  require_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   */
  41  class 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  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1