Put some superuser stuff on the participant invite page so alison can see whats going on

This commit is contained in:
james 2011-03-05 04:39:06 +00:00
parent b26d9a3dc4
commit caf1207fbf
4 changed files with 45 additions and 36 deletions

View File

@ -96,7 +96,12 @@ if($_POST['show_types'])
if(count($u['roles'])) {
echo "<b>";
echo "<a href=\"#\" onclick=\"return openeditor({$u['id']})\">";
if($u['firstname'] || $u['lastname']) {
echo $u['firstname']." ".$u['lastname'];
}
else {
echo i18n("No name specified");
}
echo "</a>";
echo "</b>";
echo "<table>";

View File

@ -167,19 +167,7 @@
echo "<br />";
/*
//FIXME: commente dby james 2010-12-21 - we need ta better way to know which types we can invite
$allowed_types = array('judge', 'volunteer');
if($type == '') $type = $_GET['type'];
if($type != '') {
if(!in_array($type, $allowed_types)) {
echo "Type $type not allowed for invite<br /><br/>";
exit;
}
}
*/
if($_POST['action']=="invitenew" && $_POST['email'] && $type != '') {
if( ($_POST['action']=="invitenew" || $_POST['action']=="inviteexisting") && $_POST['email'] && $type != '') {
$newUser=user_invite($_POST['email'], null, $_POST['email'], $type);
if(is_array($newUser)) {
echo happy(i18n("%1 successfully invited to be a %2",array($_POST['email'],$type)));
@ -188,16 +176,7 @@ if($_POST['action']=="invitenew" && $_POST['email'] && $type != '') {
echo error($newUser);
}
}
else if($_POST['action']=="inviteexisting" && $_POST['email'] && $type != '') {
$newUser=user_invite($_POST['email'], null, $_POST['email'], $type);
if(is_array($newUser)) {
echo happy(i18n("%1 successfully invited to be a %2",array($_POST['email'],$type)));
}
else {
echo error($newUser);
}
}
echo "<form method=\"post\" name=\"invite\" action=\"participant_invite.php\">\n";
echo "<input type=\"hidden\" name=\"action\" id=\"action\" value=\"invite\" />\n";
echo "<table>";
@ -224,6 +203,18 @@ if($_POST['action']=="invitenew" && $_POST['email'] && $type != '') {
echo "</form>\n";
if($_SESSION['superuser']=="yes") {
$q=mysql_query("SELECT users.id, users.firstname, users.lastname, accounts.username, accounts.email, accounts.pendingemail, users.schools_id, schools.school
FROM users
LEFT JOIN schools ON users.schools_id=schools.id
JOIN accounts on users.accounts_id=accounts.id
JOIN user_roles ON user_roles.users_id=users.id
JOIN roles ON user_roles.roles_id=roles.id
AND users.conferences_id='{$conference['id']}'
AND schools.conferences_id='{$conference['id']}'
AND roles.type='participant'");
}
else {
$q=mysql_query("SELECT users.id, users.firstname, users.lastname, accounts.username, accounts.email, accounts.pendingemail FROM users
JOIN accounts on users.accounts_id=accounts.id
JOIN user_roles ON user_roles.users_id=users.id
@ -231,12 +222,23 @@ if($_POST['action']=="invitenew" && $_POST['email'] && $type != '') {
WHERE schools_id='$schoolid'
AND conferences_id='{$conference['id']}'
AND roles.type='participant'");
}
echo mysql_error();
echo "<br />";
echo "<br />";
if($_SESSION['superuser']=="yes") {
echo "<h2>".i18n("The following participants have been invited from all school (you're a superuser!)")."</h2>\n";
}
else {
echo "<h2>".i18n("The following participants have been invited from your school")."</h2>\n";
}
echo "<table class=\"tableview\">\n";
echo "<tr><th>Username</th><th>Email Address</th><th>First Name</th><th>Last Name</th><th>Actions</th>";
echo "<tr><th>Username</th><th>Email Address</th><th>First Name</th><th>Last Name</th>";
if($_SESSION['superuser']=="yes") {
echo "<th>School</th>";
}
echo "<th>Actions</th>";
echo "</tr>\n";
while($r=mysql_fetch_object($q)) {
echo "<tr>";
@ -251,6 +253,10 @@ if($_POST['action']=="invitenew" && $_POST['email'] && $type != '') {
echo "</td>";
echo " <td>$r->firstname</td>";
echo " <td>$r->lastname</td>";
if($_SESSION['superuser']=="yes") {
echo "<td>$r->school</td>";
}
echo " <td><a href=\"#\" onclick=\"return uninvite($r->id)\">uninvite</a></td>";
echo "</tr>";

View File

@ -94,7 +94,7 @@ $tabs = array(
'school' => array(
'label' => 'School',
'name' => 'Select School Information',
'types' => array('teacher','participant','principal','parent'),
'types' => array('teacher','participant','principal'),
'file' => 'user_school.php',
'status_func' => false,
'enabled' => true,

View File

@ -25,10 +25,8 @@
require_once('common.inc.php');
require_once('user.inc.php');
/* Ensure they're logged in as something, anything */
user_auth_required();
$edit_id = isset($_GET['users_id']) ? intval($_GET['users_id']) : $_SESSION['users_id'];
if($edit_id != $_SESSION['users_id'])
user_auth_required('admin');
else