PageRenderTime 125ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/admin/tool/capability/classes/settings_form.php

https://bitbucket.org/synergylearning/campusconnect
PHP | 66 lines | 21 code | 10 blank | 35 comment | 0 complexity | 2466bbff814dda048c6ee978e62317b2 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, LGPL-3.0, GPL-3.0, LGPL-2.1, Apache-2.0, BSD-3-Clause, AGPL-3.0
  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. * Capability tool settings form.
  18. *
  19. * Do no include this file, it is automatically loaded by the class loader!
  20. *
  21. * @package tool_capability
  22. * @copyright 2013 Sam Hemelryk
  23. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24. */
  25. require_once($CFG->libdir.'/formslib.php');
  26. /**
  27. * Class tool_capability_settings_form
  28. *
  29. * The settings form for the comparison of roles/capabilities.
  30. *
  31. * @copyright 2013 Sam Hemelryk
  32. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  33. */
  34. class tool_capability_settings_form extends moodleform {
  35. /**
  36. * The form definition.
  37. */
  38. public function definition() {
  39. $form = $this->_form;
  40. $capabilities = $this->_customdata['capabilities'];
  41. $roles = $this->_customdata['roles'];
  42. // Set the form ID.
  43. $form->setAttributes(array('id' => 'capability-overview-form') + $form->getAttributes());
  44. $form->addElement('header', 'reportsettings', get_string('reportsettings', 'tool_capability'));
  45. $form->addElement('html', html_writer::tag('p', get_string('intro', 'tool_capability'), array('id' => 'intro')));
  46. $form->addElement('hidden', 'search');
  47. $form->setType('search', PARAM_TEXT);
  48. $attributes = array('multiple' => 'multiple', 'size' => 10, 'data-search' => 'capability');
  49. $form->addElement('select', 'capability', get_string('capabilitylabel', 'tool_capability'), $capabilities, $attributes);
  50. $form->setType('capability', PARAM_CAPABILITY);
  51. $attributes = array('multiple' => 'multiple', 'size' => 10);
  52. $form->addElement('select', 'roles', get_string('roleslabel', 'tool_capability'), $roles, $attributes);
  53. $form->setType('roles', PARAM_TEXT);
  54. $form->addElement('submit', 'submitbutton', get_string('getreport', 'tool_capability'));
  55. }
  56. }