mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
mnet: core libraries and admin pages
This commit is contained in:
parent
10daca92c5
commit
71558f8502
26 changed files with 4213 additions and 0 deletions
52
admin/mnet/delete.php
Normal file
52
admin/mnet/delete.php
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?PHP // $Id$
|
||||
|
||||
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
|
||||
include_once($CFG->dirroot.'/mnet/lib.php');
|
||||
$stradministration = get_string('administration');
|
||||
$strconfiguration = get_string('configuration');
|
||||
$strmnetsettings = get_string('mnetsettings', 'mnet');
|
||||
$strmnetservices = get_string('mnetservices', 'mnet');
|
||||
$strmnetlog = get_string('mnetlog', 'mnet');
|
||||
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
|
||||
require_login();
|
||||
|
||||
if (!isadmin()) {
|
||||
error('Only administrators can use this page!');
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
|
||||
require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
|
||||
|
||||
if (!$site = get_site()) {
|
||||
error('Site isn\'t defined!');
|
||||
}
|
||||
|
||||
/// Initialize variables.
|
||||
|
||||
// Step must be one of:
|
||||
// input Parse the details of a new host and fetch its public key
|
||||
// commit Save our changes (to a new OR existing host)
|
||||
$step = optional_param('step', 'verify', PARAM_ALPHA);
|
||||
$hostid = required_param('hostid', PARAM_INT);
|
||||
$warn = array();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||
redirect('index.php', "The delete function requires a POST request.",7);
|
||||
}
|
||||
|
||||
if ('verify' == $step) {
|
||||
$mnet_peer = new mnet_peer();
|
||||
$mnet_peer->set_id($hostid);
|
||||
$live_users = $mnet_peer->count_live_sessions();
|
||||
if ($live_users > 0) {
|
||||
$warn[] = get_string('usersareonline', 'mnet', $live_users);
|
||||
}
|
||||
include('delete.html');
|
||||
} elseif ('delete' == $step) {
|
||||
$mnet_peer = new mnet_peer();
|
||||
$mnet_peer->set_id($hostid);
|
||||
$mnet_peer->delete();
|
||||
redirect('peers.php', 'Ok - host deleted', 5);
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue