Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 39 and 401]

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