Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 310] [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

   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          $current = $this->_customdata['current'];
  36  
  37          $mform->addElement('header', 'filtersettings', get_string('filter', 'tool_customlang'));
  38  
  39          // Component
  40          $options = array();
  41          foreach (tool_customlang_utils::list_components() as $component => $normalized) {
  42              list($type, $plugin) = core_component::normalize_component($normalized);
  43              if ($type == 'core' and is_null($plugin)) {
  44                  $plugin = 'moodle';
  45              }
  46              $options[$type][$normalized] = $component.'.php';
  47          }
  48          $mform->addElement('selectgroups', 'component', get_string('filtercomponent', 'tool_customlang'), $options,
  49                             array('multiple'=>'multiple', 'size'=>7));
  50  
  51          // Customized only
  52          $mform->addElement('advcheckbox', 'customized', get_string('filtercustomized', 'tool_customlang'));
  53          $mform->setType('customized', PARAM_BOOL);
  54          $mform->setDefault('customized', 0);
  55  
  56          // Only helps
  57          $mform->addElement('advcheckbox', 'helps', get_string('filteronlyhelps', 'tool_customlang'));
  58          $mform->setType('helps', PARAM_BOOL);
  59          $mform->setDefault('helps', 0);
  60  
  61          // Modified only
  62          $mform->addElement('advcheckbox', 'modified', get_string('filtermodified', 'tool_customlang'));
  63          $mform->setType('modified', PARAM_BOOL);
  64          $mform->setDefault('modified', 0);
  65  
  66          // Substring
  67          $mform->addElement('text', 'substring', get_string('filtersubstring', 'tool_customlang'));
  68          $mform->setType('substring', PARAM_RAW);
  69  
  70          // String identifier
  71          $mform->addElement('text', 'stringid', get_string('filterstringid', 'tool_customlang'));
  72          $mform->setType('stringid', PARAM_STRINGID);
  73  
  74          // Show strings - submit button
  75          $mform->addElement('submit', 'submit', get_string('filtershowstrings', 'tool_customlang'));
  76      }
  77  }
  78