3 // This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
20 * Page to allow the administrator to delete networked hosts, with a confirm message
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
30 require(__DIR__
.'/../../config.php');
31 require_once($CFG->libdir
. '/adminlib.php');
33 $step = optional_param('step', 'verify', PARAM_ALPHA
);
34 $hostid = required_param('hostid', PARAM_INT
);
37 $mnet = get_mnet_environment();
39 $PAGE->set_url('/admin/mnet/delete.php');
40 admin_externalpage_setup('mnetpeer' . $hostid);
44 $mnet_peer = new mnet_peer();
45 $mnet_peer->set_id($hostid);
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));
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) {
59 redirect(new moodle_url('/admin/mnet/peers.php'), get_string('hostdeleted', 'mnet'), 5);