Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | 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
/**
18
 * Message outputs configuration page
19
 *
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
23
 */
24
require_once(__DIR__ . '/../config.php');
25
require_once($CFG->dirroot . '/message/lib.php');
26
require_once($CFG->libdir.'/adminlib.php');
27
 
28
// This is an admin page.
29
admin_externalpage_setup('managemessageoutputs');
30
 
31
// Fetch processors.
32
$allprocessors = get_message_processors();
33
$processors = array_filter($allprocessors, function($processor) {
34
    return $processor->enabled;
35
});
36
$disabledprocessors = array_filter($allprocessors, function($processor) {
37
    return !$processor->enabled;
38
});
39
 
40
// Fetch message providers.
41
$providers = get_message_providers();
42
// Fetch the manage message outputs interface.
43
$preferences = get_message_output_default_preferences();
44
 
45
if (($form = data_submitted()) && confirm_sesskey()) {
46
 
47
    // Save processors enabled/disabled status.
48
    foreach ($allprocessors as $processor) {
49
        $enabled = isset($form->{$processor->name});
50
        $class = \core_plugin_manager::resolve_plugininfo_class('message');
51
        $class::enable_plugin($processor->name, $enabled);
52
    }
53
 
54
    $url = new moodle_url('message.php');
55
    redirect($url);
56
}
57
 
1441 ariadna 58
// Page settings.
1 efrain 59
$PAGE->set_context(context_system::instance());
60
$renderer = $PAGE->get_renderer('core', 'message');
61
 
62
// Display the page.
63
echo $OUTPUT->header();
64
echo $renderer->manage_messageoutput_settings($allprocessors, $processors, $providers, $preferences);
65
echo $OUTPUT->footer();