See Release Notes
Long Term Support Release
Differences Between: [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]
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 $records->close(); 44 45 echo $OUTPUT->header(); 46 echo $renderer->messageinbound_handlers_table($instances); 47 echo $OUTPUT->footer(); 48 49 } else { 50 // Retrieve the handler and its record. 51 $handler = \core\message\inbound\manager::get_handler($classname); 52 $record = \core\message\inbound\manager::record_from_handler($handler); 53 54 $formurl = new moodle_url($PAGE->url, array('classname' => $classname)); 55 $mform = new tool_messageinbound_edit_handler_form($formurl, array( 56 'handler' => $handler, 57 )); 58 59 if ($mform->is_cancelled()) { 60 redirect($PAGE->url); 61 } else if ($data = $mform->get_data()) { 62 63 // Update the record from the form. 64 if ($handler->can_change_defaultexpiration()) { 65 $record->defaultexpiration = (int) $data->defaultexpiration; 66 } 67 68 if ($handler->can_change_validateaddress()) { 69 $record->validateaddress = !empty($data->validateaddress); 70 } 71 72 if ($handler->can_change_enabled()) { 73 $record->enabled = !empty($data->enabled); 74 } 75 $DB->update_record('messageinbound_handlers', $record); 76 redirect($PAGE->url); 77 } 78 79 // Add the breadcrumb. 80 $pageurl->param('classname', $handler->classname); 81 $PAGE->navbar->add($handler->name, $pageurl); 82 echo $OUTPUT->header(); 83 echo $OUTPUT->heading(get_string('editinghandler', 'tool_messageinbound', $handler->name)); 84 $mform->set_data($record); 85 $mform->display(); 86 echo $OUTPUT->footer(); 87 88 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body