[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/user/ -> editor_form.php (source)

   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.
  13  //
  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/>.
  16  
  17  /**
  18   * Form to edit a users editor preferences.
  19   *
  20   * @copyright 1999 Martin Dougiamas  http://dougiamas.com
  21   * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  22   * @package core_user
  23   */
  24  
  25  if (!defined('MOODLE_INTERNAL')) {
  26      die('Direct access to this script is forbidden.');    //  It must be included from a Moodle page.
  27  }
  28  
  29  require_once($CFG->dirroot.'/lib/formslib.php');
  30  
  31  /**
  32   * Class user_edit_editor_form.
  33   *
  34   * @copyright 1999 Martin Dougiamas  http://dougiamas.com
  35   * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  36   */
  37  class user_edit_editor_form extends moodleform {
  38  
  39      /**
  40       * Define the form.
  41       */
  42      public function definition () {
  43          global $CFG, $COURSE;
  44  
  45          $mform = $this->_form;
  46  
  47          $editors = editors_get_enabled();
  48          if (count($editors) > 1) {
  49              $choices = array('' => get_string('defaulteditor'));
  50              $firsteditor = '';
  51              foreach (array_keys($editors) as $editor) {
  52                  if (!$firsteditor) {
  53                      $firsteditor = $editor;
  54                  }
  55                  $choices[$editor] = get_string('pluginname', 'editor_' . $editor);
  56              }
  57              $mform->addElement('select', 'preference_htmleditor', get_string('textediting'), $choices);
  58              $mform->addHelpButton('preference_htmleditor', 'textediting');
  59              $mform->setDefault('preference_htmleditor', '');
  60          } else {
  61              // Empty string means use the first chosen text editor.
  62              $mform->addElement('hidden', 'preference_htmleditor');
  63              $mform->setDefault('preference_htmleditor', '');
  64              $mform->setType('preference_htmleditor', PARAM_PLUGIN);
  65          }
  66  
  67          $this->add_action_buttons(true, get_string('savechanges'));
  68      }
  69  }
  70  
  71  


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1