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
 * unilabel module.
19
 *
20
 * @package     mod_unilabel
21
 * @author      Andreas Grabs <info@grabs-edv.de>
22
 * @copyright   2018 onwards Grabs EDV {@link https://www.grabs-edv.de}
23
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
defined('MOODLE_INTERNAL') || die;
26
 
27
require_once($CFG->dirroot . '/course/moodleform_mod.php');
28
 
29
/**
30
 * Settings form for the activity instance.
31
 * @package     mod_unilabel
32
 * @author      Andreas Grabs <info@grabs-edv.de>
33
 * @copyright   2018 onwards Grabs EDV {@link https://www.grabs-edv.de}
34
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
35
 */
36
class mod_unilabel_mod_form extends moodleform_mod {
37
    /**
38
     * Definition of elements for the activity instance.
39
     *
40
     * @return void
41
     */
42
    public function definition() {
43
        global $PAGE;
44
 
45
        $PAGE->force_settings_menu();
46
 
47
        $mform = $this->_form;
48
 
49
        $mform->addElement('header', 'generalhdr', get_string('general'));
50
 
51
        $mform->addElement('text', 'name', get_string('name'), ['size' => '48']);
52
        $mform->setType('name', PARAM_TEXT);
53
        $mform->addRule('name', null, 'required', null, 'client');
54
        $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
55
 
56
        $this->standard_intro_elements(get_string('unilabeltext', 'mod_unilabel'));
57
 
58
        $plugins = \mod_unilabel\factory::get_plugin_list();
59
        $plugins = ['' => get_string('choose')] + $plugins;
60
        $mform->addElement('select', 'unilabeltype', get_string('labeltype', 'mod_unilabel'), $plugins);
61
        $mform->addRule('unilabeltype', get_string('required'), 'required', null, 'client');
62
        $mform->addHelpButton('unilabeltype', 'labeltype', 'mod_unilabel');
63
 
64
        // Unilabel does not add "Show description" checkbox meaning that 'intro' is always shown on the course page.
65
        $mform->addElement('hidden', 'showdescription', 1);
66
        $mform->setType('showdescription', PARAM_INT);
67
 
68
        $this->standard_coursemodule_elements();
69
 
70
        // The buttons.
71
        $this->add_action_buttons(true, false, null);
72
    }
73
}