Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
// This file is part of Moodle - http://moodle.org/
4
//
5
// Moodle is free software: you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation, either version 3 of the License, or
8
// (at your option) any later version.
9
//
10
// Moodle is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
// GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
17
 
18
 
19
/**
20
 * Page to allow the administrator to delete networked hosts, with a confirm message
21
 *
22
 * @package    core
23
 * @subpackage mnet
24
 * @copyright  2007 Donal McMullan
25
 * @copyright  2007 Martin Langhoff
26
 * @copyright  2010 Penny Leach
27
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28
 */
29
 
30
require(__DIR__.'/../../config.php');
31
require_once($CFG->libdir . '/adminlib.php');
32
 
33
$step   = optional_param('step', 'verify', PARAM_ALPHA);
34
$hostid = required_param('hostid', PARAM_INT);
35
 
36
 
37
$mnet = get_mnet_environment();
38
 
39
$PAGE->set_url('/admin/mnet/delete.php');
40
admin_externalpage_setup('mnetpeer' . $hostid);
41
 
42
require_sesskey();
43
 
44
$mnet_peer = new mnet_peer();
45
$mnet_peer->set_id($hostid);
46
 
47
if ('verify' == $step) {
48
    echo $OUTPUT->header();
49
    echo $OUTPUT->heading(get_string('deleteaserver', 'mnet'));
50
    if ($live_users = $mnet_peer->count_live_sessions() > 0) {
51
        echo $OUTPUT->notification(get_string('usersareonline', 'mnet', $live_users));
52
    }
53
    $yesurl = new moodle_url('/admin/mnet/delete.php', array('hostid' => $mnet_peer->id, 'step' => 'delete'));
54
    $nourl = new moodle_url('/admin/mnet/peers.php');
55
    echo $OUTPUT->confirm(get_string('reallydeleteserver', 'mnet')  . ': ' .  $mnet_peer->name, $yesurl, $nourl);
56
    echo $OUTPUT->footer();
57
} elseif ('delete' == $step) {
58
    $mnet_peer->delete();
59
    redirect(new moodle_url('/admin/mnet/peers.php'), get_string('hostdeleted', 'mnet'), 5);
60
}