[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
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 * Inbound Message Settings pages. 19 * 20 * @package tool_messageinbound 21 * @copyright 2014 Andrew NIcols 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 require_once(__DIR__ . '/../../../config.php'); 26 require_once($CFG->libdir.'/adminlib.php'); 27 require_once($CFG->libdir.'/tablelib.php'); 28 29 admin_externalpage_setup('messageinbound_handlers'); 30 31 $classname = optional_param('classname', '', PARAM_RAW); 32 33 $pageurl = new moodle_url('/admin/tool/messageinbound/index.php'); 34 35 if (empty($classname)) { 36 $renderer = $PAGE->get_renderer('tool_messageinbound'); 37 38 $records = $DB->get_recordset('messageinbound_handlers', null, 'enabled desc', 'classname'); 39 $instances = array(); 40 foreach ($records as $record) { 41 $instances[] = \core\message\inbound\manager::get_handler($record->classname); 42 } 43 44 echo $OUTPUT->header(); 45 echo $renderer->messageinbound_handlers_table($instances); 46 echo $OUTPUT->footer(); 47 48 } else { 49 // Retrieve the handler and its record. 50 $handler = \core\message\inbound\manager::get_handler($classname); 51 $record = \core\message\inbound\manager::record_from_handler($handler); 52 53 $formurl = new moodle_url($PAGE->url, array('classname' => $classname)); 54 $mform = new tool_messageinbound_edit_handler_form($formurl, array( 55 'handler' => $handler, 56 )); 57 58 if ($mform->is_cancelled()) { 59 redirect($PAGE->url); 60 } else if ($data = $mform->get_data()) { 61 62 // Update the record from the form. 63 if ($handler->can_change_defaultexpiration()) { 64 $record->defaultexpiration = (int) $data->defaultexpiration; 65 } 66 67 if ($handler->can_change_validateaddress()) { 68 $record->validateaddress = !empty($data->validateaddress); 69 } 70 71 if ($handler->can_change_enabled()) { 72 $record->enabled = !empty($data->enabled); 73 } 74 $DB->update_record('messageinbound_handlers', $record); 75 redirect($PAGE->url); 76 } 77 78 // Add the breadcrumb. 79 $pageurl->param('classname', $handler->classname); 80 $PAGE->navbar->add($handler->name, $pageurl); 81 echo $OUTPUT->header(); 82 echo $OUTPUT->heading(get_string('editinghandler', 'tool_messageinbound', $handler->name)); 83 $mform->set_data($record); 84 $mform->display(); 85 echo $OUTPUT->footer(); 86 87 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |