MDL-61138 mod_quiz: remove YUI random question modal
[moodle.git] / admin / message.php
blob6924e61db308a8c64ac0fdd58d7966949fa839ca
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.
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/>.
17 /**
18 * Message outputs configuration page
20 * @package message
21 * @copyright 2011 Lancaster University Network Services Limited
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 require_once(__DIR__ . '/../config.php');
25 require_once($CFG->dirroot . '/message/lib.php');
26 require_once($CFG->libdir.'/adminlib.php');
28 // This is an admin page
29 admin_externalpage_setup('managemessageoutputs');
31 // Require site configuration capability
32 require_capability('moodle/site:config', context_system::instance());
34 // Get the submitted params
35 $disable = optional_param('disable', 0, PARAM_INT);
36 $enable = optional_param('enable', 0, PARAM_INT);
38 $headingtitle = get_string('managemessageoutputs', 'message');
40 if (!empty($disable) && confirm_sesskey()) {
41 if (!$processor = $DB->get_record('message_processors', array('id'=>$disable))) {
42 print_error('outputdoesnotexist', 'message');
44 \core_message\api::update_processor_status($processor, 0); // Disable output.
45 core_plugin_manager::reset_caches();
48 if (!empty($enable) && confirm_sesskey()) {
49 if (!$processor = $DB->get_record('message_processors', array('id'=>$enable))) {
50 print_error('outputdoesnotexist', 'message');
52 \core_message\api::update_processor_status($processor, 1); // Enable output.
53 core_plugin_manager::reset_caches();
56 if ($disable || $enable) {
57 $url = new moodle_url('message.php');
58 redirect($url);
60 // Page settings
61 $PAGE->set_context(context_system::instance());
63 // Grab the renderer
64 $renderer = $PAGE->get_renderer('core', 'message');
66 // Display the manage message outputs interface
67 $processors = get_message_processors();
68 $messageoutputs = $renderer->manage_messageoutputs($processors);
70 // Display the page
71 echo $OUTPUT->header();
72 echo $OUTPUT->heading($headingtitle);
73 echo $messageoutputs;
74 echo $OUTPUT->footer();