Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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
 * Defines the version and other meta-info about the plugin
18
 *
19
 * Setting the $plugin->version to 0 prevents the plugin from being installed.
20
 * See https://docs.moodle.org/dev/version.php for more info.
21
 */
22
require_once('../lib.php');
23
$systemcontext = context_system::instance();
24
require_login();
25
require_capability('report/training:managesettings', $systemcontext);
26
$pagename = 'report_training_settings';
27
$PAGE->set_context($systemcontext);
28
$PAGE->set_url('/report/training/admin/settings.php');
29
$PAGE->set_pagelayout('admin');
30
$PAGE->set_title(get_string('settings_title', 'report_training'));
31
$PAGE->set_heading(get_string('settings_title', 'report_training'), 3);
32
admin_externalpage_setup($pagename);
33
$settingsform = new training_settings_form();
34
if ($settingsform->is_cancelled()) {
35
    echo $OUTPUT->header();
36
        echo $OUTPUT->container(get_string('settings_cancelled', 'report_training'), 'important', 'notice');
37
        echo $OUTPUT->continue_button(new moodle_url('/report/training/admin/settings.php', array()));
38
    echo $OUTPUT->footer();
39
} else if ($fromform = $settingsform->get_data()) {
40
    $DB->update_record('report_training', $fromform);
41
    echo $OUTPUT->header();
42
        echo $OUTPUT->container(get_string('settings_updated', 'report_training'), 'important', 'notice');
43
        echo $OUTPUT->continue_button(new moodle_url('/report/training/admin/settings.php', array()));
44
    echo $OUTPUT->footer();
45
} else {
46
    global $timeformat;
47
    $dbdata = $DB->get_record('report_training', array(), '*');
48
    $settingsform->set_data($dbdata);
49
    echo $OUTPUT->header();
50
        echo $OUTPUT->heading(get_string('settings_title', 'report_training'));
51
        $settingsform->display();
52
    echo $OUTPUT->footer();
53
}