Admin page cleanup (Google soc 2006)

This commit is contained in:
vinkmar
2006-08-18 07:25:17 +00:00
parent a7c72afc04
commit 90a73bb361
21 changed files with 1618 additions and 357 deletions
+15 -20
View File
@@ -1,6 +1,11 @@
<?php // $Id$
require_once('../config.php');
require_once('../config.php');
require_once($CFG->dirroot . '/admin/adminlib.php');
admin_externalpage_setup('editusers');
admin_externalpage_print_header();
$newuser = optional_param('newuser', 0, PARAM_BOOL);
$delete = optional_param('delete', 0, PARAM_INT);
@@ -106,7 +111,7 @@
if ($newuser && confirm_sesskey()) { // Create a new user
if (!has_capability('moodle/user:create', $context)) {
if (!has_capability('moodle/user:create', $context->id)) {
error('You do not have the required permission to create new users.');
}
@@ -130,7 +135,7 @@
} else { // List all users for editing
if (!has_capability('moodle/user:update', $context)) {
if (!has_capability('moodle/user:update', $context->id)) {
error('You do not have the required permission to edit users.');
}
@@ -143,16 +148,6 @@
$strsearch = get_string("search");
$strshowallusers = get_string("showallusers");
if ($firstinitial or $lastinitial or $search or $page) {
print_header("$site->shortname: $stredituser", $site->fullname,
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"users.php\">$strusers</a> -> ".
"<a href=\"user.php\">$stredituser</a>");
} else {
print_header("$site->shortname: $stredituser", $site->fullname,
"<a href=\"index.php\">$stradministration</a> -> ".
"<a href=\"users.php\">$strusers</a> -> $stredituser");
}
if ($confirmuser and confirm_sesskey()) {
if (!$user = get_record("user", "id", "$confirmuser")) {
@@ -172,7 +167,7 @@
} else if ($delete and confirm_sesskey()) { // Delete a selected user, after confirmation
if (!has_capability('moodle/user:delete', $context)) {
if (!has_capability('moodle/user:delete', $context->id)) {
error('You do not have the required permission to delete a user.');
}
@@ -344,7 +339,7 @@
if ($user->id == $USER->id or $user->username == "changeme") {
$deletebutton = "";
} else {
if (has_capability('moodle/user:delete', $context)) {
if (has_capability('moodle/user:delete', $context->id)) {
$deletebutton = "<a href=\"user.php?delete=$user->id&amp;sesskey=$USER->sesskey\">$strdelete</a>"; } else {
$deletebutton ="";
}
@@ -361,7 +356,7 @@
}
$fullname = fullname($user, true);
if (has_capability('moodle/user:edit', $context)) {
if (has_capability('moodle/user:edit', $context->id)) {
$table->data[] = array ("<a href=\"../user/view.php?id=$user->id&amp;course=$site->id\">$fullname</a>",
"$user->email",
@@ -394,7 +389,7 @@
echo "</form>";
echo "</td></tr></table>";
if (has_capability('moodle/user:create', $context)) {
if (has_capability('moodle/user:create', $context->id)) {
print_heading("<a href=\"user.php?newuser=true&amp;sesskey=$USER->sesskey\">".get_string("addnewuser")."</a>");
}
if (!empty($table)) {
@@ -402,13 +397,13 @@
print_paging_bar($usercount, $page, $perpage,
"user.php?sort=$sort&amp;dir=$dir&amp;perpage=$perpage".
"&amp;firstinitial=$firstinitial&amp;lastinitial=$lastinitial&amp;search=".urlencode(stripslashes($search))."&amp;");
if (has_capability('moodle/user:create', $context)) {
if (has_capability('moodle/user:create', $context->id)) {
print_heading("<a href=\"user.php?newuser=true&amp;sesskey=$USER->sesskey\">".get_string("addnewuser")."</a>");
}
}
print_footer();
admin_externalpage_print_footer();
}
?>
?>