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
 * Capability tool settings form.
19
 *
20
 * Do no include this file, it is automatically loaded by the class loader!
21
 *
22
 * @package    tool_capability
23
 * @copyright  2013 Sam Hemelryk
24
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25
 */
26
 
27
require_once($CFG->libdir.'/formslib.php');
28
 
29
/**
30
 * Class tool_capability_settings_form
31
 *
32
 * The settings form for the comparison of roles/capabilities.
33
 *
34
 * @copyright  2013 Sam Hemelryk
35
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36
 */
37
class tool_capability_settings_form extends moodleform {
38
 
39
    /**
40
     * The form definition.
41
     */
42
    public function definition() {
43
        $form = $this->_form;
44
        $capabilities = $this->_customdata['capabilities'];
45
        $roles = $this->_customdata['roles'];
46
 
47
        // Set the form ID.
48
        $form->setAttributes(array('id' => 'capability-overview-form') + $form->getAttributes());
49
 
50
        $form->addElement('header', 'reportsettings', get_string('reportsettings', 'tool_capability'));
51
        $form->addElement('html', html_writer::tag('p', get_string('intro', 'tool_capability'), array('id' => 'intro')));
52
 
53
        $attributes = array('multiple' => 'multiple', 'size' => 10, 'data-search' => 'capability');
54
        $form->addElement('select', 'capability', get_string('capabilitylabel', 'tool_capability'), $capabilities, $attributes);
55
        $form->setType('capability', PARAM_CAPABILITY);
56
 
57
        $strsearch = get_string('search');
58
        $form->addElement('text', 'search', $strsearch, ['data-action' => 'search', 'placeholder' => $strsearch])
59
            ->setHiddenLabel(true);
60
        $form->setType('search', PARAM_TEXT);
61
 
62
        $attributes = array('multiple' => 'multiple', 'size' => 10);
63
        $form->addElement('select', 'roles', get_string('roleslabel', 'tool_capability'), $roles, $attributes);
64
        $form->setType('roles', PARAM_TEXT);
65
 
66
        $filters = [];
67
        $filters[] = $form->createElement('checkbox', 'onlydiff',  get_string('onlydiff', 'tool_capability'));
68
        $form->setType('onlydiff', PARAM_BOOL);
69
        $form->addGroup($filters, 'filters', get_string('filters', 'tool_capability'), array('<br>'), false);
70
 
71
        $form->addElement('submit', 'submitbutton', get_string('getreport', 'tool_capability'));
72
    }
73
}