forked from marxjohnson/moodle-local_configeditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
65 lines (60 loc) · 2.63 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Displays the form for selecting and editing config settings
*
* @package local_configeditor
* @author Mark Johnson <mark.johnson@tauntons.ac.uk>
* @copyright 2011 Tauntons College, UK
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');
require_once($CFG->dirroot.'/local/configeditor/lib.php');
use local_configeditor as ce;
require_login($SITE);
if (!is_siteadmin()) {
print_error(get_string('adminonly', 'local_configeditor'));
}
$PAGE->set_url('/local/configeditor/');
$PAGE->navbar->add(get_string('pluginname', 'local_configeditor'));
$jsmodule = array(
'name' => 'local_configeditor',
'fullpath' => '/local/configeditor/module.js',
'requires' => array('base', 'node', 'io', 'json')
);
$PAGE->requires->js_init_call('M.local_configeditor.init', null, false, $jsmodule);
$plugins = ce\get_plugins();
$default = array('core' => get_string('core', 'local_configeditor'));
$pluginselect = html_writer::select($plugins, 'plugin', '', $default);
$coresettings = ce\get_settings_for_plugin();
$settingselect = html_writer::select($coresettings, 'setting');
$valueinput = html_writer::empty_tag('input', array('id' => 'valueinput', 'name' => 'value'));
$saveattrs = array(
'id' => 'savebutton',
'type' => 'button',
'value' => get_string('savechanges'),
'disabled' => 'disabled'
);
$savebutton = html_writer::empty_tag('input', $saveattrs);
$loadingicon = $OUTPUT->pix_icon('i/loading_small',
get_string('loading', 'local_configeditor'),
'moodle',
array('id' => 'configeditor_loading'));
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('pluginname', 'local_configeditor'));
echo $OUTPUT->box($OUTPUT->error_text(get_string('warning', 'local_configeditor')));
echo html_writer::tag('form', $pluginselect.$settingselect.$valueinput.$savebutton.$loadingicon);
echo $OUTPUT->footer();