2 // This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
18 * Form to edit a users editor preferences.
20 * @copyright 1999 Martin Dougiamas http://dougiamas.com
21 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 if (!defined('MOODLE_INTERNAL')) {
26 die('Direct access to this script is forbidden.'); // It must be included from a Moodle page.
29 require_once($CFG->dirroot
.'/lib/formslib.php');
32 * Class user_edit_editor_form.
34 * @copyright 1999 Martin Dougiamas http://dougiamas.com
35 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
37 class user_edit_editor_form
extends moodleform
{
42 public function definition () {
45 $mform = $this->_form
;
47 $editors = editors_get_enabled();
49 $mform->addElement('hidden', 'id');
50 $mform->setType('id', PARAM_INT
);
52 if (count($editors) > 1) {
53 $choices = array('' => get_string('defaulteditor'));
55 foreach (array_keys($editors) as $editor) {
57 $firsteditor = $editor;
59 $choices[$editor] = get_string('pluginname', 'editor_' . $editor);
61 $mform->addElement('select', 'preference_htmleditor', get_string('textediting'), $choices);
62 $mform->addHelpButton('preference_htmleditor', 'textediting');
63 $mform->setDefault('preference_htmleditor', '');
65 // Empty string means use the first chosen text editor.
66 $mform->addElement('hidden', 'preference_htmleditor');
67 $mform->setDefault('preference_htmleditor', '');
68 $mform->setType('preference_htmleditor', PARAM_PLUGIN
);
71 $this->add_action_buttons(true, get_string('savechanges'));