diff --git a/admin/judges.inc.php b/admin/judges.inc.php index fc4bd1e9..f194ebad 100644 --- a/admin/judges.inc.php +++ b/admin/judges.inc.php @@ -199,4 +199,23 @@ function getJudgingEligibilityCode() { } } +function judges_load_all() +{ + global $config; + + $ret = array(); + + $query = "SELECT id FROM users WHERE types LIKE '%judge%' + AND year='{$config['FAIRYEAR']}' + AND deleted='no'"; + $r = mysql_query($query); + while($i = mysql_fetch_assoc($r)) { + $u = user_load($i['id']); + if($u['judge_complete'] == 'no') continue; + + $ret[$i['id']] = $u; + } + return $ret; +} + ?> diff --git a/admin/judges_info.php b/admin/judges_info.php index 1e28ccd0..aaa2b95a 100644 --- a/admin/judges_info.php +++ b/admin/judges_info.php @@ -40,167 +40,165 @@ $preferencechoices=array( ); - if($_GET['id']) - { - //include "../register_judges.inc.php"; + $id = intval($_GET['id']); - $q=mysql_query("SELECT - judges.* - FROM - judges - WHERE - judges.id='".$_GET['id']."'"); - echo mysql_error(); - $judgeinfo=mysql_fetch_object($q); - - send_popup_header(i18n("Judge Information - %1 %2",array($judgeinfo->firstname,$judgeinfo->lastname))); - - echo "Complete for {$config['FAIRYEAR']}: ".(($judgeinfo->complete=="yes") ? "Yes" : "No"); - echo "
"; - - echo "

".i18n("Personal Info")."

"; - echo "\n"; - - echo "\n"; - echo " \n"; - echo " \n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo " \n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo " \n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo " \n"; - echo "\n"; - - echo "\n"; - echo " \n"; - echo " \n"; - echo ""; - - echo "\n"; - echo " \n"; - echo " \n"; - echo ""; - - echo ""; - - echo "\n"; - echo " \n"; - echo "\n"; - - echo "\n"; - echo "\n"; - - echo "\n"; - echo " "; - echo " \n"; - echo "\n"; - - echo "\n"; - echo " "; - echo " \n"; - echo "\n"; - - echo "\n"; - echo " "; - echo " \n"; - echo "\n"; - - questions_print_answers('judgereg',$judgeinfo->id, $config['FAIRYEAR']); - - echo "
".i18n("First Name")."$judgeinfo->firstname".i18n("Last Name")."$judgeinfo->lastname
".i18n("Email Address")."$judgeinfo->email".i18n("City")."$judgeinfo->city
".i18n("Address 1")."$judgeinfo->address".i18n($config['provincestate'])."$judgeinfo->province"; - echo "
".i18n("Address 2")."$judgeinfo->address2".i18n("Phone (Home)")."$judgeinfo->phonehome
".i18n($config['postalzip'])."$judgeinfo->postalcode".i18n("Phone (Work)")."$judgeinfo->phonework ext $judgeinfo->phoneworkext
".i18n("Organization")."$judgeinfo->organization".i18n("Phone (Cell)")."$judgeinfo->phonecell

".i18n("Age category preference").""; - -$q=mysql_query("SELECT judges_catpref.*,projectcategories.category FROM judges_catpref,projectcategories WHERE judges_id='{$_GET['id']}' AND judges_catpref.year='".$config['FAIRYEAR']."' AND projectcategories.year='".$config['FAIRYEAR']."' AND judges_catpref.projectcategories_id=projectcategories.id"); -echo mysql_error(); -while($r=mysql_fetch_object($q)) - echo i18n($r->category).": ".$preferencechoices[$r->rank]."
"; - - echo "
".i18n("Highest post-secondary degree")."$judgeinfo->highest_psd
".i18n("Other professional qualifications")."$judgeinfo->professional_quals
".i18n("Languages").""; - - $q=mysql_query("SELECT languages_lang FROM judges_languages WHERE judges_id='$judgeinfo->id'"); - while($r=mysql_fetch_object($q)) - { - echo $r->languages_lang; - echo "
"; - } - - echo "
"; - - - echo "
"; - echo "
"; - echo "

Areas of Expertise

"; - echo ""; - - //grab the list of divisions, because the last fields of the table will be the sub-divisions - $q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); - $divs=array(); - while($r=mysql_fetch_object($q)) - { - $divs[]=$r->id; - $divnames[$r->id]=$r->division; - } - - $subdivq=mysql_query("SELECT judges_expertise.*, - projectsubdivisions.subdivision, - projectsubdivisions.projectdivisions_id AS parent_id - FROM judges_expertise - LEFT JOIN projectsubdivisions ON judges_expertise.projectsubdivisions_id=projectsubdivisions.id - WHERE judges_id='$judgeinfo->id' - AND judges_expertise.year='".$config['FAIRYEAR']."' - ORDER BY projectdivisions_id, projectsubdivisions_id"); - echo mysql_error(); - $judge_divs=array(); - $judge_subdivs=array(); - $divdata=array(); - - while($subdivr=mysql_fetch_object($subdivq)) - { - if($subdivr->projectdivisions_id) - { - $judge_divs[$subdivr->projectdivisions_id]=$subdivr->val; - } - else - $judge_subdivs[$subdivr->parent_id][]=$subdivr->subdivision; - } - - - foreach($divs as $div) - { - echo ""; - echo " "; - - echo ""; - echo ""; - } - - echo "
".i18n($divnames[$div])."".$judge_divs[$div]."/5"; - if(count($judge_subdivs[$div])) - { - $divdata=implode(", ",$judge_subdivs[$div]); - echo "$divdata"; - } - else - echo " "; - echo "
"; - } - else - { - send_popup_header("Judge Information"); + send_popup_header("Judge Information"); + if($id < 1) { echo error(i18n("No Judge ID passed to Judges Info")); + send_popup_footer(); + exit; } + $judgeinfo = user_load($id); + + send_popup_header(i18n("Judge Information - %1 %2",array($judgeinfo['firstname'],$judgeinfo['lastname']))); + +echo "Complete for {$config['FAIRYEAR']}: ".(($judgeinfo['complete']=="yes") ? "Yes" : "No"); +echo "
"; + +echo "

".i18n("Personal Info")."

"; +echo "\n"; + +echo "\n"; +echo " \n"; +echo " \n"; +echo "\n"; +echo "\n"; +echo " \n"; +echo " \n"; +echo "\n"; +echo "\n"; +echo " \n"; +echo " \n"; +echo "\n"; +echo "\n"; +echo " \n"; +echo " \n"; +echo "\n"; + +echo "\n"; +echo " \n"; +echo " \n"; +echo ""; + +echo "\n"; +echo " \n"; +echo " \n"; +echo ""; + +echo ""; + +echo "
".i18n("First Name").": {$judgeinfo['firstname']}".i18n("Last Name").":{$judgeinfo['lastname']}
".i18n("Email Address").":{$judgeinfo['email']}".i18n("City").":{$judgeinfo['city']}
".i18n("Address 1").":{$judgeinfo['address']}".i18n($config['provincestate']).": {$judgeinfo['province']}
".i18n("Address 2").":{$judgeinfo['address2']}".i18n("Phone (Home)").":{$judgeinfo['phonehome']}
".i18n($config['postalzip']).":{$judgeinfo['postalcode']}".i18n("Phone (Work)").":{$judgeinfo['phonework']}
".i18n("Organization").":{$judgeinfo['organization']}".i18n("Phone (Cell)").":{$judgeinfo['phonecell']}

"; +echo ""; + +echo "\n"; +echo " \n"; +echo "\n"; + +echo "\n"; +echo "\n"; + +echo "\n"; +echo " "; +echo " \n"; +echo "\n"; + +echo "\n"; +echo " "; +echo " \n"; +echo "\n"; + +//questions_print_answers('judgereg',$judgeinfo['id'], $config['FAIRYEAR']); + +echo "
".i18n("Age category preference").":"; + +$q=mysql_query("SELECT * FROM projectcategories + WHERE year='{$config['FAIRYEAR']}'"); +echo mysql_error(); +while($r=mysql_fetch_object($q)) { + $p = intval($judgeinfo['cat_prefs'][$r->id]); + echo i18n($r->category).": {$preferencechoices[$p]}
"; +} + +echo "
".i18n("Highest post-secondary degree").":{$judgeinfo['highest_psd']}
".i18n("Languages").":".join(', ', $judgeinfo['languages']). "
"; +echo "
"; + + +echo "
"; +echo "
"; +echo "

Areas of Expertise

"; +echo ""; + +//grab the list of divisions, because the last fields of the table will be the sub-divisions +$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); +$divs=array(); +while($r=mysql_fetch_object($q)) +{ + $divs[]=$r->id; + $divnames[$r->id]=$r->division; +} + +/* +$subdivq=mysql_query("SELECT judges_expertise.*, + projectsubdivisions.subdivision, + projectsubdivisions.projectdivisions_id AS parent_id + FROM judges_expertise + LEFT JOIN projectsubdivisions ON judges_expertise.projectsubdivisions_id=projectsubdivisions.id + WHERE judges_id='{$judgeinfo['id']}' + AND judges_expertise.year='".$config['FAIRYEAR']."' + ORDER BY projectdivisions_id, projectsubdivisions_id"); + echo mysql_error(); +$judge_divs=array(); +$judge_subdivs=array(); +$divdata=array(); +*/ +/* +while($subdivr=mysql_fetch_object($subdivq)) +{ + if($subdivr->projectdivisions_id) + { + $judge_divs[$subdivr->projectdivisions_id]=$subdivr->val; + } + else + $judge_subdivs[$subdivr->parent_id][]=$subdivr->subdivision; +} +*/ + +foreach($divs as $div) +{ + $p = $judgeinfo['div_prefs'][$div]; + echo ""; + echo " "; + + echo ""; + echo ""; +} +echo "\n"; +echo " "; +echo " \n"; +echo "\n"; + +echo "
".i18n($divnames[$div]).":$p/5"; + $subq=mysql_query("SELECT * FROM projectsubdivisions WHERE + projectdivisions_id='$div' AND year='{$config['FAIRYEAR']}' ORDER BY subdivision"); + $sd = array(); + while($subr=mysql_fetch_object($subq)) { + if($u['div_prefs_sub'][$subr->id] == 1) { + $sd[] = $subdivr->subdivision; + } + } + + /* Only show subdiv if main div >=3 */ + if($p >= 3) echo implode(", ",$sd); + else echo " "; + + echo "
".i18n("Other").":{$judgeinfo['expertise_other']}
"; +echo "
"; - send_popup_footer(); + +send_popup_footer(); ?> diff --git a/admin/judges_teams_members.php b/admin/judges_teams_members.php index 60253439..11110185 100644 --- a/admin/judges_teams_members.php +++ b/admin/judges_teams_members.php @@ -22,10 +22,10 @@ */ ?> 'committee_main.php', @@ -98,7 +98,7 @@ function switchjudgeinfo() { //before we insert them, we need to make sure they dont already belong to this team. We can not have the same judge assigned to the same team multiple times. - $q=mysql_query("SELECT * FROM judges_teams_link WHERE judges_id='$selectedjudge' AND judges_teams_id='$team_id'"); + $q=mysql_query("SELECT * FROM judges_teams_link WHERE users_id='$selectedjudge' AND judges_teams_id='$team_id'"); if(mysql_num_rows($q)) { echo notice(i18n("Judge (%1) already belongs to judging team: %2",array($selectedjudge,$team_name))); @@ -107,7 +107,7 @@ function switchjudgeinfo() else { //lets make the first one we add a captain, the rest, non-captains :) - mysql_query("INSERT INTO judges_teams_link (judges_id,judges_teams_id,captain,year) VALUES ('$selectedjudge','$team_id','$captain','".$config['FAIRYEAR']."')"); + mysql_query("INSERT INTO judges_teams_link (users_id,judges_teams_id,captain,year) VALUES ('$selectedjudge','$team_id','$captain','".$config['FAIRYEAR']."')"); $added++; } //if this is alreayd no, then who cares, but if its the first one that is going into the new team, then @@ -122,9 +122,9 @@ function switchjudgeinfo() echo happy(i18n("%1 %2 added to team #%3 (%4)",array($added,$j,$_POST['team_num'],$team_name))); } - if($_GET['action']=="del" && $_GET['team_num'] && $_GET['team_id'] && $_GET['judges_id']) + if($_GET['action']=="del" && $_GET['team_num'] && $_GET['team_id'] && $_GET['users_id']) { - mysql_query("DELETE FROM judges_teams_link WHERE judges_id='".$_GET['judges_id']."' AND judges_teams_id='".$_GET['team_id']."' AND year='".$config['FAIRYEAR']."'"); + mysql_query("DELETE FROM judges_teams_link WHERE users_id='".$_GET['users_id']."' AND judges_teams_id='".$_GET['team_id']."' AND year='".$config['FAIRYEAR']."'"); echo happy(i18n("Removed judge from team #%1 (%2)",array($_GET['team_num'],$_GET['team_name']))); //if there is still members left in the team, make sure we have a captain still @@ -139,7 +139,7 @@ function switchjudgeinfo() { if($first) { - $firstjudge=$r->judges_id; + $firstjudge=$r->users_id; $first=false; } @@ -152,7 +152,7 @@ function switchjudgeinfo() if(!$gotcaptain) { //make the first judge the captain - mysql_query("UPDATE judges_teams_link SET captain='yes' WHERE judges_teams_id='".$_GET['team_id']."' AND judges_id='$firstjudge' AND year='".$config['FAIRYEAR']."'"); + mysql_query("UPDATE judges_teams_link SET captain='yes' WHERE judges_teams_id='".$_GET['team_id']."' AND users_id='$firstjudge' AND year='".$config['FAIRYEAR']."'"); echo notice(i18n("Team captain was removed. A new team captain has been automatically assigned")); } } @@ -181,7 +181,7 @@ function switchjudgeinfo() { //teams can have as many captains as they want, so just add it. - mysql_query("UPDATE judges_teams_link SET captain='yes' WHERE judges_teams_id='".$_GET['team_id']."' AND judges_id='".$_GET['judge_id']."'"); + mysql_query("UPDATE judges_teams_link SET captain='yes' WHERE judges_teams_id='".$_GET['team_id']."' AND users_id='".$_GET['judge_id']."'"); echo happy(i18n("Team captain assigned")); } @@ -195,7 +195,7 @@ function switchjudgeinfo() } else { - mysql_query("UPDATE judges_teams_link SET captain='no' WHERE judges_teams_id='".$_GET['team_id']."' AND judges_id='".$_GET['judge_id']."'"); + mysql_query("UPDATE judges_teams_link SET captain='no' WHERE judges_teams_id='".$_GET['team_id']."' AND users_id='".$_GET['judge_id']."'"); echo happy(i18n("Team captain removed")); } } @@ -211,7 +211,7 @@ function switchjudgeinfo() echo ""; echo ""; echo ""; - echo ""; + echo ""; echo ""; echo ""; echo "
".i18n("Judges List"); @@ -250,13 +250,21 @@ function switchjudgeinfo() judges_years WHERE judges_years.year='".$config['FAIRYEAR']."' AND - judges.id=judges_years.judges_id AND - judges.id NOT IN (SELECT judges_id AS id FROM judges_teams_link WHERE judges_teams_link.year='".$config['FAIRYEAR']."') + 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"; */ - $querystr="SELECT + + /* 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 @@ -265,7 +273,7 @@ function switchjudgeinfo() judges_years WHERE judges_years.year='".$config['FAIRYEAR']."' AND - judges.id=judges_years.judges_id AND + judges.id=judges_years.users_id AND judges.complete='yes' ORDER BY lastname, @@ -275,6 +283,7 @@ function switchjudgeinfo() while($r=mysql_fetch_object($q)) { $judgelist[$r->id]=$r; } + */ if($_SESSION['viewstate']['judges_teams_list_show']=='unassigned') { $querystr="SELECT @@ -288,8 +297,8 @@ function switchjudgeinfo() WHERE judges_years.year='".$config['FAIRYEAR']."' AND judges_teams_link.year='".$config['FAIRYEAR']."' - AND judges.id=judges_years.judges_id - AND judges.id=judges_teams_link.judges_id + AND judges.id=judges_years.users_id + AND judges.id=judges_teams_link.users_id AND judges.complete='yes' ORDER BY lastname, @@ -307,9 +316,9 @@ function switchjudgeinfo() echo mysql_error(); echo ""; @@ -337,7 +346,7 @@ function switchjudgeinfo() foreach($team['members'] AS $member) { echo "
"; - echo ""; + echo ""; echo ""; if($member['captain']=="yes") {