PageRenderTime 76ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/tool/customlang/filter_form.php

https://bitbucket.org/synergylearning/campusconnect
PHP | 78 lines | 34 code | 14 blank | 30 comment | 3 complexity | 1550dde23b34477c4d177e41a017e3ea 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. * @package tool
  18. * @subpackage customlang
  19. * @copyright 2010 David Mudrak <david@moodle.com>
  20. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  21. */
  22. defined('MOODLE_INTERNAL') || die();
  23. require_once($CFG->dirroot . '/lib/formslib.php');
  24. /**
  25. * Form for filtering the strings to customize
  26. */
  27. class tool_customlang_filter_form extends moodleform {
  28. function definition() {
  29. $mform = $this->_form;
  30. $current = $this->_customdata['current'];
  31. $mform->addElement('header', 'filtersettings', get_string('filter', 'tool_customlang'));
  32. // Component
  33. $options = array();
  34. foreach (tool_customlang_utils::list_components() as $component => $normalized) {
  35. list($type, $plugin) = core_component::normalize_component($normalized);
  36. if ($type == 'core' and is_null($plugin)) {
  37. $plugin = 'moodle';
  38. }
  39. $options[$type][$normalized] = $component.'.php';
  40. }
  41. $mform->addElement('selectgroups', 'component', get_string('filtercomponent', 'tool_customlang'), $options,
  42. array('multiple'=>'multiple', 'size'=>7));
  43. // Customized only
  44. $mform->addElement('advcheckbox', 'customized', get_string('filtercustomized', 'tool_customlang'));
  45. $mform->setType('customized', PARAM_BOOL);
  46. $mform->setDefault('customized', 0);
  47. // Only helps
  48. $mform->addElement('advcheckbox', 'helps', get_string('filteronlyhelps', 'tool_customlang'));
  49. $mform->setType('helps', PARAM_BOOL);
  50. $mform->setDefault('helps', 0);
  51. // Modified only
  52. $mform->addElement('advcheckbox', 'modified', get_string('filtermodified', 'tool_customlang'));
  53. $mform->setType('modified', PARAM_BOOL);
  54. $mform->setDefault('modified', 0);
  55. // Substring
  56. $mform->addElement('text', 'substring', get_string('filtersubstring', 'tool_customlang'));
  57. $mform->setType('substring', PARAM_RAW);
  58. // String identifier
  59. $mform->addElement('text', 'stringid', get_string('filterstringid', 'tool_customlang'));
  60. $mform->setType('stringid', PARAM_STRINGID);
  61. // Show strings - submit button
  62. $mform->addElement('submit', 'submit', get_string('filtershowstrings', 'tool_customlang'));
  63. }
  64. }