source: moodle/trunk/fuentes/admin/tool/capability/classes/settings_form.php @ 136

Last change on this file since 136 was 136, checked in by mabarracus, 4 years ago

Ported code to xenial

File size: 2.5 KB
Line 
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
27require_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 */
37class 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        // Set the form ID.
47        $form->setAttributes(array('id' => 'capability-overview-form') + $form->getAttributes());
48
49        $form->addElement('header', 'reportsettings', get_string('reportsettings', 'tool_capability'));
50        $form->addElement('html', html_writer::tag('p', get_string('intro', 'tool_capability'), array('id' => 'intro')));
51
52        $form->addElement('hidden', 'search');
53        $form->setType('search', PARAM_TEXT);
54
55        $attributes = array('multiple' => 'multiple', 'size' => 10, 'data-search' => 'capability');
56        $form->addElement('select', 'capability', get_string('capabilitylabel', 'tool_capability'), $capabilities, $attributes);
57        $form->setType('capability', PARAM_CAPABILITY);
58
59        $attributes = array('multiple' => 'multiple', 'size' => 10);
60        $form->addElement('select', 'roles', get_string('roleslabel', 'tool_capability'), $roles, $attributes);
61        $form->setType('roles', PARAM_TEXT);
62
63        $form->addElement('submit', 'submitbutton', get_string('getreport', 'tool_capability'));
64    }
65
66}
Note: See TracBrowser for help on using the repository browser.