|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00018 00030 require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); 00031 require_once($CFG->libdir . '/adminlib.php'); 00032 00033 $step = optional_param('step', 'verify', PARAM_ALPHA); 00034 $hostid = required_param('hostid', PARAM_INT); 00035 00036 00037 require_login(); 00038 00039 $context = get_context_instance(CONTEXT_SYSTEM); 00040 require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions"); 00041 00042 $mnet = get_mnet_environment(); 00043 00044 $PAGE->set_url('/admin/mnet/delete.php'); 00045 admin_externalpage_setup('mnetpeer' . $hostid); 00046 00047 require_sesskey(); 00048 00049 $mnet_peer = new mnet_peer(); 00050 $mnet_peer->set_id($hostid); 00051 00052 if ('verify' == $step) { 00053 echo $OUTPUT->header(); 00054 echo $OUTPUT->heading(get_string('deleteaserver', 'mnet')); 00055 if ($live_users = $mnet_peer->count_live_sessions() > 0) { 00056 echo $OUTPUT->notification(get_string('usersareonline', 'mnet', $live_users)); 00057 } 00058 $yesurl = new moodle_url('/admin/mnet/delete.php', array('hostid' => $mnet_peer->id, 'step' => 'delete')); 00059 $nourl = new moodle_url('/admin/mnet/peers.php'); 00060 echo $OUTPUT->confirm(get_string('reallydeleteserver', 'mnet') . ': ' . $mnet_peer->name, $yesurl, $nourl); 00061 echo $OUTPUT->footer(); 00062 } elseif ('delete' == $step) { 00063 $mnet_peer->delete(); 00064 redirect(new moodle_url('/admin/mnet/peers.php'), get_string('hostdeleted', 'mnet'), 5); 00065 }