MDL-66332 too_capability: add show differences option
[moodle.git] / admin / tool / capability / classes / settings_form.php
CommitLineData
9935136f
SH
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;
46af2845
SH
44 $capabilities = $this->_customdata['capabilities'];
45 $roles = $this->_customdata['roles'];
9935136f
SH
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
46af2845
SH
55 $attributes = array('multiple' => 'multiple', 'size' => 10, 'data-search' => 'capability');
56 $form->addElement('select', 'capability', get_string('capabilitylabel', 'tool_capability'), $capabilities, $attributes);
9935136f
SH
57 $form->setType('capability', PARAM_CAPABILITY);
58
46af2845
SH
59 $attributes = array('multiple' => 'multiple', 'size' => 10);
60 $form->addElement('select', 'roles', get_string('roleslabel', 'tool_capability'), $roles, $attributes);
9935136f
SH
61 $form->setType('roles', PARAM_TEXT);
62
e96bbb53 63 $form->addElement('checkbox', 'onlydiff',
64 get_string('filters', 'tool_capability'),
65 get_string('onlydiff', 'tool_capability'));
66 $form->setType('onlydiff', PARAM_BOOL);
67
9935136f
SH
68 $form->addElement('submit', 'submitbutton', get_string('getreport', 'tool_capability'));
69 }
70
71}