moodle/admin/users.php
moodler 0468976c9a SWEEPING CLEANUP
The API was changed slightly so that has_capability now takes the
whole $context object (we almost always have it anyway)

The $kill thing was removed.   If you want to assert a capability
then use:

    require_capability('capname', $context);

with optional variables to modify the error message

Misc bugs here and there also removed and code tidied
2006-08-14 05:55:40 +00:00

62 lines
2.7 KiB
PHP

<?php // $Id$
require_once('../config.php');
require_login();
if (!isadmin()) {
error("Only admins can access this page");
}
if (!$site = get_site()) {
redirect("index.php");
}
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
$stradministration = get_string("administration");
$strusers = get_string("users");
print_header("$site->shortname: $stradministration: $strusers", "$site->fullname",
"<a href=\"index.php\">$stradministration</a> -> $strusers");
print_heading($strusers);
$table->align = array ("right", "left");
$table->data[] = array("<b><a href=\"auth.php?sesskey=$USER->sesskey\">".get_string("authentication")."</a></b>",
get_string("adminhelpauthentication"));
if (has_capability('moodle/user:update', $context)) {
$table->data[] = array("<b><a href=\"user.php\">".get_string("edituser")."</a></b>",
get_string("adminhelpedituser"));
}
if (has_capability('moodle/user:create', $context)) {
$table->data[] = array("<b><a href=\"$CFG->wwwroot/$CFG->admin/user.php?newuser=true&amp;sesskey=$USER->sesskey\">".get_string("addnewuser")."</a></b>",
get_string("adminhelpaddnewuser"));
}
if (has_capability('moodle/user:create', $context)) {
$table->data[] = array("<b><a href=\"$CFG->wwwroot/$CFG->admin/uploaduser.php?sesskey=$USER->sesskey\">".get_string("uploadusers")."</a></b>",
get_string("adminhelpuploadusers"));
}
$table->data[] = array('', '<hr />');
$table->data[] = array("<b><a href=\"enrol.php?sesskey=$USER->sesskey\">".get_string("enrolmentplugins")."</a></b>",
get_string("adminhelpenrolments"));
$table->data[] = array("<b><a href=\"../course/index.php?edit=off&amp;sesskey=$USER->sesskey\">".get_string("assignstudents")."</a></b>",
get_string("adminhelpassignstudents"));
$table->data[] = array("<b><a href=\"../course/index.php?edit=on&amp;sesskey=$USER->sesskey\">".get_string("assignteachers")."</a></b>",
get_string("adminhelpassignteachers")." <img src=\"../pix/t/user.gif\" height=\"11\" width=\"11\" alt=\"\" />");
$table->data[] = array("<b><a href=\"creators.php?sesskey=$USER->sesskey\">".get_string("assigncreators")."</a></b>",
get_string("adminhelpassigncreators"));
$table->data[] = array("<b><a href=\"admin.php?sesskey=$USER->sesskey\">".get_string("assignadmins")."</a></b>",
get_string("adminhelpassignadmins"));
print_table($table);
print_footer($site);
?>