|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00016 00024 require_once(dirname(__FILE__) . '/../config.php'); 00025 require_once($CFG->dirroot . '/message/lib.php'); 00026 require_once($CFG->libdir.'/adminlib.php'); 00027 00028 // This is an admin page 00029 admin_externalpage_setup('managemessageoutputs'); 00030 00031 // Require site configuration capability 00032 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)); 00033 00034 // Get the submitted params 00035 $disable = optional_param('disable', 0, PARAM_INT); 00036 $enable = optional_param('enable', 0, PARAM_INT); 00037 00038 if (!empty($disable) && confirm_sesskey()) { 00039 if (!$processor = $DB->get_record('message_processors', array('id'=>$disable))) { 00040 print_error('outputdoesnotexist', 'message'); 00041 } 00042 $DB->set_field('message_processors', 'enabled', '0', array('id'=>$processor->id)); // Disable output 00043 } 00044 00045 if (!empty($enable) && confirm_sesskey() ) { 00046 if (!$processor = $DB->get_record('message_processors', array('id'=>$enable))) { 00047 print_error('outputdoesnotexist', 'message'); 00048 } 00049 $DB->set_field('message_processors', 'enabled', '1', array('id'=>$processor->id)); // Enable output 00050 } 00051 00052 if ($disable || $enable) { 00053 $url = new moodle_url('message.php'); 00054 redirect($url); 00055 } 00056 // Page settings 00057 $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM)); 00058 00059 // Grab the renderer 00060 $renderer = $PAGE->get_renderer('core', 'message'); 00061 00062 // Display the manage message outputs interface 00063 $processors = get_message_processors(); 00064 $messageoutputs = $renderer->manage_messageoutputs($processors); 00065 00066 // Display the page 00067 echo $OUTPUT->header(); 00068 echo $OUTPUT->heading(get_string('managemessageoutputs', 'message')); 00069 echo $messageoutputs; 00070 echo $OUTPUT->footer();