forked from science-ation/science-ation
Update the account list with more details
This commit is contained in:
parent
74cfb14bf4
commit
518472136d
@ -34,173 +34,13 @@ if($_POST['show_types'])
|
|||||||
|
|
||||||
require_once('judges.inc.php');
|
require_once('judges.inc.php');
|
||||||
|
|
||||||
$user_what = array();
|
send_header("Account List",
|
||||||
$query = mysql_query("SELECT `type`, `name` FROM roles");
|
|
||||||
while($row = mysql_fetch_assoc($query)){
|
|
||||||
$user_what[$row['type']] = $row['name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$show_types = $_GET['show_types'];
|
|
||||||
if(user_valid_role($show_types) == false) $show_types = array('judge');
|
|
||||||
|
|
||||||
$show_complete = ($_GET['show_complete'] == 'yes') ? 'yes' : 'no';
|
|
||||||
$show_all = ($_GET['show_all'] == 'yes') ? 'yes' : 'no';
|
|
||||||
$uid = intval($_GET['uid']);
|
|
||||||
|
|
||||||
if($_GET['action']=='remove') {
|
|
||||||
if(!$uid) {
|
|
||||||
echo "Invalid uid for delete";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
user_delete($uid);
|
|
||||||
message_push(happy(i18n('User deleted.')));
|
|
||||||
}
|
|
||||||
|
|
||||||
send_header("Account Editor",
|
|
||||||
array('Committee Main' => 'committee_main.php',
|
array('Committee Main' => 'committee_main.php',
|
||||||
'Administration' => 'admin/index.php')
|
'Administration' => 'admin/index.php')
|
||||||
);
|
);
|
||||||
?>
|
|
||||||
<script language="javascript" type="text/javascript">
|
|
||||||
|
|
||||||
function toggleoptions()
|
$querystr = "SELECT * FROM accounts ORDER BY username";
|
||||||
{
|
|
||||||
if(document.getElementById('options').style.display == 'none') {
|
|
||||||
document.getElementById('options').style.display = 'block';
|
|
||||||
document.getElementById('optionstext').innerHTML = '- <?=i18n('Hide Display Options')?>';
|
|
||||||
|
|
||||||
} else {
|
|
||||||
document.getElementById('options').style.display = 'none';
|
|
||||||
document.getElementById('optionstext').innerHTML = '+ <?=i18n('Show Display Options')?>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function togglenew()
|
|
||||||
{
|
|
||||||
if(document.getElementById('new').style.display == 'none') {
|
|
||||||
document.getElementById('new').style.display = 'block';
|
|
||||||
document.getElementById('newtext').innerHTML = '<?=i18n('Cancel New User')?>';
|
|
||||||
|
|
||||||
} else {
|
|
||||||
document.getElementById('new').style.display = 'none';
|
|
||||||
document.getElementById('newtext').innerHTML = '<?=i18n('Add New User')?>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function neweditor()
|
|
||||||
{
|
|
||||||
var username = document.forms.newuser.new_email.value;
|
|
||||||
var usertype = document.forms.newuser.new_type.value;
|
|
||||||
window.open("../user_editor_window.php?type="+usertype+"&username="+username,"UserEditor","location=no,menubar=no,directories=no,toolbar=no,width=770,height=500,scrollbars=yes");
|
|
||||||
document.forms.newuser.new_email.value = "";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?
|
|
||||||
/*
|
|
||||||
echo "<div class=\"notice\">";
|
|
||||||
echo "<a id=\"optionstext\" onclick=\"toggleoptions();return false;\">- ".i18n('Show Display Options')."</a>";
|
|
||||||
|
|
||||||
echo "<form method=\"GET\" action=\"$PHP_SELF\">";
|
|
||||||
|
|
||||||
echo "<div id=\"options\" style=\"display: none;\" >";
|
|
||||||
echo "<table><tr><td>".i18n('Type').":</td>";
|
|
||||||
$x = 0;
|
|
||||||
foreach($user_what as $k=>$v ) {
|
|
||||||
$sel = (in_array($k, $show_types)) ? 'checked="checked"' : '';
|
|
||||||
echo "<td><input type=\"radio\" name=\"show_types[]\" value=\"$k\" $sel >".i18n($v)."</input></td>";
|
|
||||||
if($x) echo "</tr><tr><td></td>";
|
|
||||||
$x = ~$x;
|
|
||||||
}
|
|
||||||
echo "</tr>";
|
|
||||||
|
|
||||||
echo "<tr><td>".i18n('Complete').":</td><td>";
|
|
||||||
echo "<select name=\"show_complete\">";
|
|
||||||
$s = ($show_complete == 'yes') ? 'selected="selected"' : '';
|
|
||||||
echo "<option value=\"yes\" $s>".i18n('Show only complete registrations')."</option>";
|
|
||||||
$s = ($show_complete == 'no') ? 'selected="selected"' : '';
|
|
||||||
echo "<option value=\"no\" $s>".i18n('Show ALL registrations')."</option>";
|
|
||||||
echo "</select>";
|
|
||||||
|
|
||||||
echo "</tr>";
|
|
||||||
echo "<tr><td>".i18n('Conference').":</td><td>";
|
|
||||||
echo "<select name=\"show_all\">";
|
|
||||||
$s = ($show_all == 'no') ? 'selected="selected"' : '';
|
|
||||||
echo "<option value=\"no\" $s>".i18n('Show only registrations from this conference')."</option>";
|
|
||||||
$s = ($show_all == 'yes') ? 'selected="selected"' : '';
|
|
||||||
echo "<option value=\"yes\" $s>".i18n('Show ALL conferences')."</option>";
|
|
||||||
echo "</select>";
|
|
||||||
echo "</td></tr></table>";
|
|
||||||
echo "<br />";
|
|
||||||
echo "<input type=submit value=\"".i18n('Apply Filter')."\">";
|
|
||||||
echo "</div>";
|
|
||||||
echo "</form>";
|
|
||||||
|
|
||||||
echo "</div>";
|
|
||||||
|
|
||||||
|
|
||||||
echo "<br/><a id=\"newtext\" href=\"javascript:togglenew()\">".i18n('Add New User')."</a>";
|
|
||||||
echo '<div id="new" style="display: none;" class="notice">';
|
|
||||||
echo "<form name=\"newuser\" method=\"GET\" action=\"$PHP_SELF\">";
|
|
||||||
echo "<table><tr><td>".i18n('Type').":</td><td>";
|
|
||||||
echo "<select name=\"new_type\">";
|
|
||||||
$x = 0;
|
|
||||||
foreach($user_what as $k=>$v ) {
|
|
||||||
$sel = (in_array($k, $show_types)) ? 'selected="selected"' : '';
|
|
||||||
echo "<option value=\"$k\" $sel>".i18n($v)."</option>";
|
|
||||||
}
|
|
||||||
echo "</select>";
|
|
||||||
echo "</tr>";
|
|
||||||
echo "<tr><td>".i18n('Email').":</td><td>";
|
|
||||||
echo '<input type="text" name="new_email" value="" />';
|
|
||||||
echo '</td></tr>';
|
|
||||||
echo '</table>';
|
|
||||||
echo "<input type=submit onclick=\"neweditor();\" value=\"".i18n('Create New User')."\">";
|
|
||||||
|
|
||||||
echo '</form>';
|
|
||||||
|
|
||||||
echo '</div>';
|
|
||||||
echo "<br />";
|
|
||||||
echo "<br />";
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Grab a list of users */
|
|
||||||
$clauses = array();
|
|
||||||
$showroles = array();
|
|
||||||
foreach($show_types as $t){
|
|
||||||
$showroles[] = "type = '$t'";
|
|
||||||
}
|
|
||||||
if(count($showroles) > 0) $clauses[] = 'user_roles.roles_id IN(SELECT id FROM roles WHERE ' . implode(' OR ', $showroles) . ')';
|
|
||||||
if($show_complete == 'yes') $clauses[] = 'user_roles.complete = "yes"';
|
|
||||||
if($show_all == 'no') $clauses[] = "users.conferences_id={$conference['id']}";
|
|
||||||
|
|
||||||
$querystr =
|
|
||||||
"SELECT * FROM accounts ORDER BY username";
|
|
||||||
/*
|
/*
|
||||||
"SELECT users.*,
|
|
||||||
accounts.username,
|
|
||||||
accounts.email AS emailaddress,
|
|
||||||
user_roles.accounts_id, user_roles.roles_id, user_roles.active, user_roles.complete,
|
|
||||||
roles.type,
|
|
||||||
conferences.name AS conference_name
|
|
||||||
FROM users
|
|
||||||
JOIN user_roles ON user_roles.users_id = users.id
|
|
||||||
JOIN roles ON user_roles.roles_id=roles.id
|
|
||||||
JOIN conferences ON users.conferences_id = conferences.id
|
|
||||||
JOIN accounts ON user_roles.accounts_id=accounts.id";
|
|
||||||
|
|
||||||
if(count($clauses) > 0){
|
|
||||||
$querystr .= " WHERE " . implode(' AND ', $clauses) . " ";
|
|
||||||
}
|
|
||||||
|
|
||||||
$querystr .= "
|
|
||||||
ORDER BY lastname ASC, firstname ASC, conferences_id DESC ";
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
echo $querystr;
|
echo $querystr;
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
@ -215,10 +55,12 @@ function neweditor()
|
|||||||
echo "<table class=\"tableview\">";
|
echo "<table class=\"tableview\">";
|
||||||
echo "<thead>";
|
echo "<thead>";
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
|
echo " <th>".i18n("Account ID")."</th>";
|
||||||
echo " <th>".i18n("Username")."</th>";
|
echo " <th>".i18n("Username")."</th>";
|
||||||
echo " <th>".i18n("Email Address")."</th>";
|
echo " <th>".i18n("Email Address")."</th>";
|
||||||
echo " <th>".i18n("Pending Email")."</th>";
|
echo " <th>".i18n("Pending Email")."</th>";
|
||||||
echo " <th>".i18n("Actions")."</th>";
|
echo " <th>".i18n("Roles")."</th>";
|
||||||
|
// echo " <th>".i18n("Actions")."</th>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
echo "</thead>";
|
echo "</thead>";
|
||||||
echo "<tbody>";
|
echo "<tbody>";
|
||||||
@ -248,7 +90,27 @@ function neweditor()
|
|||||||
echo "</td><td>";
|
echo "</td><td>";
|
||||||
echo $r['pendingemail'];
|
echo $r['pendingemail'];
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
echo "<td></td></tr>";
|
echo "<td>";
|
||||||
|
$u=user_load_by_accounts_id($r['id']);
|
||||||
|
if($u) {
|
||||||
|
echo "<table>";
|
||||||
|
foreach($u['roles'] AS $r=>$rd) {
|
||||||
|
echo "<tr><td>";
|
||||||
|
echo $rd['name'];
|
||||||
|
echo "</td>";
|
||||||
|
if($rd['active']=="yes"){ $cl="happy"; $cls=""; } else { $cl="error"; $cls="not "; }
|
||||||
|
echo "<td class=\"$cl\">{$cls}active</td>";
|
||||||
|
if($rd['complete']=="yes"){ $cl="happy"; $cls=""; } else { $cl="error"; $cls="not "; }
|
||||||
|
echo "<td class=\"$cl\">{$cls}complete</td>";
|
||||||
|
echo "</tr>";
|
||||||
|
}
|
||||||
|
echo "</table>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "no roles";
|
||||||
|
}
|
||||||
|
echo "</td>";
|
||||||
|
echo "</tr>";
|
||||||
}
|
}
|
||||||
echo "</tbody>";
|
echo "</tbody>";
|
||||||
echo "</table>";
|
echo "</table>";
|
||||||
|
Loading…
Reference in New Issue
Block a user