Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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
 
49
        $mform->addElement('hidden', 'id');
50
        $mform->setType('id', PARAM_INT);
51
 
52
        if (count($editors) > 1) {
53
            $choices = array('' => get_string('defaulteditor'));
54
            $firsteditor = '';
55
            foreach (array_keys($editors) as $editor) {
56
                if (!$firsteditor) {
57
                    $firsteditor = $editor;
58
                }
59
                $choices[$editor] = get_string('pluginname', 'editor_' . $editor);
60
            }
61
            $mform->addElement('select', 'preference_htmleditor', get_string('textediting'), $choices);
62
            $mform->addHelpButton('preference_htmleditor', 'textediting');
63
            $mform->setDefault('preference_htmleditor', '');
64
        } else {
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);
69
        }
70
 
71
        $this->add_action_buttons(true, get_string('savechanges'));
72
    }
73
}
74
 
75