source: moodle/trunk/fuentes/admin/tool/customlang/filter_form.php @ 136

Last change on this file since 136 was 136, checked in by mabarracus, 4 years ago

Ported code to xenial

File size: 3.0 KB
Line 
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
24defined('MOODLE_INTERNAL') || die();
25
26require_once($CFG->dirroot . '/lib/formslib.php');
27
28/**
29 * Form for filtering the strings to customize
30 */
31class 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
Note: See TracBrowser for help on using the repository browser.