Skip to content

Commit

Permalink
Tidy-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Aug 9, 2006
1 parent aa31141 commit 927bf46
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 54 deletions.
14 changes: 3 additions & 11 deletions admin/roles/assign.html
@@ -1,25 +1,17 @@

<form name="studentform" id="studentform" method="post" action="assign.php">
<form name="assignform" id="assignform" method="post" action="assign.php">
<input type="hidden" name="previoussearch" value="<?php echo $previoussearch ?>" />
<input type="hidden" name="sesskey" value="<?php echo sesskey() ?>" />
<input type="hidden" name="contextid" value="<?php echo $contextid ?>" />
<input type="hidden" name="roleid" value="<?php echo $roleid ?>" />
<table align="center" border="0" cellpadding="5" cellspacing="0">
<tr>
<td valign="top">
<?php
$a->count = count($contextusers);
$a->items = $strexistingusers;
print_string('counteditems', '', $a);
?>
<?php print_string('existingusers', 'role', count($contextusers)); ?>
</td>
<td></td>
<td valign="top">
<?php
$a->count = $usercount;
$a->items = $strpotentialusers;
print_string('counteditems', '', $a);
?>
<?php print_string('potentialusers', 'role', count($usercount)); ?>
</td>
</tr>
<tr>
Expand Down
32 changes: 10 additions & 22 deletions admin/roles/assign.php
Expand Up @@ -32,34 +32,21 @@
* end of permission checking
*/

/*
if ($course->metacourse) {
redirect("$CFG->wwwroot/course/importstudents.php?id=$course->id");
}
*/
require_login($course->id);

if (!isteacheredit($course->id)) {
error("You must be an editing teacher in this course, or an admin");
}

$strassignusers = get_string('assignusers');
$strpotentialusers = get_string('potentialusers');
$strexistingusers = get_string('existingusers');
$strassignusers = get_string('assignusers', 'role');
$strpotentialusers = get_string('potentialusers', 'role');
$strexistingusers = get_string('existingusers', 'role');
$straction = get_string('assignroles', 'role');
$strcurrentrole = get_string('currentrole', 'role');
$strcurrentcontext = get_string('currentcontext', 'role');
$strsearch = get_string('search');
$strshowall = get_string('showall');
/*
if ($course && $course->id != SITEID) { // course header
print_header("$course->shortname: $strassignusers",
"$site->fullname",
"<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $strassignusers");
} else { // site header
print_header("$site->shortname: $strassignusers",
"$site->fullname",
"$strassignusers");
}
*/
$straction = get_string('roleassignment');

$context = get_record('context', 'id', $contextid);

$currenttab = '';
Expand Down Expand Up @@ -106,6 +93,7 @@
$existinguserarray = array();

$SQL = "select u.* from {$CFG->prefix}role_assignments r, {$CFG->prefix}user u where contextid = $contextid and roleid = $roleid and u.id = r.userid"; // join now so that we can just use fullname() later

if (!$contextusers = get_records_sql($SQL)) {
$contextusers = array();
}
Expand Down Expand Up @@ -146,8 +134,8 @@

// prints a form to swap roles
print ('<form name="rolesform" action="assign.php" method="post">');
print ('<div align="center">Current Context: '.print_context_name($contextid).'<br/>');
print ('<input type="hidden" name="contextid" value="'.$contextid.'">Select a Role: ');
print ('<div align="center">'.$strcurrentcontext.': '.print_context_name($contextid).'<br/>');
print ('<input type="hidden" name="contextid" value="'.$contextid.'">'.$strcurrentrole.': ');
choose_from_menu ($options, 'roleid', $roleid, 'choose', $script='rolesform.submit()');
print ('</div></form>');

Expand Down
36 changes: 18 additions & 18 deletions admin/roles/override.php
@@ -1,5 +1,4 @@
<?
/* interface page for writing role overrides */
<?php

require_once("../../config.php");

Expand All @@ -15,23 +14,24 @@
redirect("$CFG->wwwroot/$CFG->admin/index.php");
}

$stroverrides = get_string('roleoverries');
/*
if ($course && $course->id != SITEID) { // course header
print_header("$course->shortname: $stroverrides",
"$site->fullname",
"<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $stroverrides");
} else { // site header
print_header("$site->shortname: $stroverrides",
"$site->fullname",
"$stroverrides");
}
*/
$strassignusers = get_string('assignusers', 'role');
$strpotentialusers = get_string('potentialusers', 'role');
$strexistingusers = get_string('existingusers', 'role');
$straction = get_string('assignroles', 'role');
$strcurrentrole = get_string('currentrole', 'role');
$strcurrentcontext = get_string('currentcontext', 'role');
$strsearch = get_string('search');
$strshowall = get_string('showall');

$context = get_record('context', 'id', $contextid);
$straction = get_string('editoverride');

$straction = get_string('overrideroles', 'role');
$currenttab = '';

$tabsmode = 'override';
include_once('tabs.php');


/*************************
* form processing here *
*************************/
Expand Down Expand Up @@ -88,9 +88,9 @@
$options[$rolex->id] = $rolex->name;
}

print ('<form name="rolesform" action="override.php" method="post">');
print ('<div align="center">Current Context: '.print_context_name($contextid).'<br/>');
print ('<input type="hidden" name="contextid" value="'.$contextid.'">Select a Role: ');
print ('<form name="rolesform" action="override.php" method="post">');
print ('<div align="center">'.$strcurrentcontext.': '.print_context_name($contextid).'<br/>');
print ('<input type="hidden" name="contextid" value="'.$contextid.'">'.$strcurrentrole.': ');
choose_from_menu ($options, 'roleid', $roleid, 'choose', $script='rolesform.submit()');
print ('</div></form>');

Expand Down
7 changes: 4 additions & 3 deletions admin/roles/tabs.php
Expand Up @@ -87,12 +87,13 @@
if (isset($tabsmode)) {
$inactive[] = 'roles';

$secondrow[] = new tabobject('assign', $CFG->wwwroot.'/admin/roles/assign.php?contextid='.$context->id, get_string('roleassignments'));
$secondrow[] = new tabobject('assign', $CFG->wwwroot.'/admin/roles/assign.php?contextid='.$context->id, get_string('assignroles', 'role'));

if ($context->level == CONTEXT_SYSTEM) {
$secondrow[] = new tabobject('override', '', get_string('roleoverrides'));
$secondrow[] = new tabobject('override', '', get_string('overrideroles', 'role'));
} else {
$secondrow[] = new tabobject('override', $CFG->wwwroot.'/admin/roles/override.php?contextid='.$context->id, get_string('roleoverrides'));
$secondrow[] = new tabobject('override', $CFG->wwwroot.'/admin/roles/override.php?contextid='.$context->id,
get_string('overrideroles', 'role'));
}

if ($tabsmode == 'override') {
Expand Down

0 comments on commit 927bf46

Please sign in to comment.