- working judges_teams_members.php

This commit is contained in:
dave 2008-11-02 05:07:04 +00:00
parent 566fb9ea3c
commit f054ab69f9

View File

@ -236,79 +236,33 @@ function switchjudgeinfo()
echo "</tr></table>";
/*
//mysql 4.0 does not support subqueries - it is supported as of mysql 4.1
//this means we cant use NOT IN (SELECT..) so, we will have to workaround this
//at least for now.
$querystr="SELECT
judges.id,
judges.firstname,
judges.lastname
FROM
judges,
judges_years
WHERE
judges_years.year='".$config['FAIRYEAR']."' AND
judges.id=judges_years.users_id AND
judges.id NOT IN (SELECT users_id AS id FROM judges_teams_link WHERE judges_teams_link.year='".$config['FAIRYEAR']."')
ORDER BY
lastname,
firstname";
*/
/* Load all the judges (judge_complete=yes, deleted=no, year=fairyear) */
$judgelist = judges_load_all();
/* Load all the team links */
/* $querystr="SELECT
judges.id,
judges.firstname,
judges.lastname
FROM
judges,
judges_years
WHERE
judges_years.year='".$config['FAIRYEAR']."' AND
judges.id=judges_years.users_id AND
judges.complete='yes'
ORDER BY
lastname,
firstname";
$q=mysql_query($querystr);
$judgelist=array();
while($r=mysql_fetch_object($q)) {
$judgelist[$r->id]=$r;
/* Load all the teams */
$teams = array();
$q = mysql_query("SELECT * FROM judges_teams WHERE year='{$config['FAIRYEAR']}'");
while($i = mysql_fetch_assoc($q)) {
$teams[$i['id']] = $i;
}
*/
/* And the links */
$links = array();
$q = mysql_query("SELECT * FROM judges_teams_link WHERE year='{$config['FAIRYEAR']}'");
while($i = mysql_fetch_assoc($q)) {
$judgelist[$i['users_id']]['teams_links'][] = $i;
}
if($_SESSION['viewstate']['judges_teams_list_show']=='unassigned')
{
$querystr="SELECT
judges.id,
judges.firstname,
judges.lastname
FROM
judges,
judges_teams_link,
judges_years
WHERE
judges_years.year='".$config['FAIRYEAR']."'
AND judges_teams_link.year='".$config['FAIRYEAR']."'
AND judges.id=judges_years.users_id
AND judges.id=judges_teams_link.users_id
AND judges.complete='yes'
ORDER BY
lastname,
firstname";
$q=mysql_query($querystr);
while($r=mysql_fetch_object($q)) {
//remove anyone we find here from the list of all judges
unset($judgelist[$r->id]);
/* Remove all judges that have a link */
foreach($judgelist as $j) {
if(count($j['teams_links']) > 0) {
unset($judgelist[$j['id']]);
}
}
}
echo "<center>";
echo i18n("Listing %1 judges",array(count($judgelist)));
echo "<br />";