From 91e5323e5ef498ddcd541e95ab96ac7fcebc8e04 Mon Sep 17 00:00:00 2001 From: james Date: Mon, 20 Dec 2004 19:46:08 +0000 Subject: [PATCH] Implement Patrick Whippey's suggestions for Judging Framework: - split phone into phonework, phonehome and phonecell - subdivisions of expertise - category preference for judging - willing to be division chair - attending lunch --- register_judges.inc.php | 4 +-- register_judges_expertise.php | 55 ++++++++++++++++++++++++++---- register_judges_personal.php | 63 +++++++++++++++++++++++++++++++---- 3 files changed, 107 insertions(+), 15 deletions(-) diff --git a/register_judges.inc.php b/register_judges.inc.php index 2e6cc61..cadf69f 100644 --- a/register_judges.inc.php +++ b/register_judges.inc.php @@ -2,7 +2,7 @@ function personalStatus() { global $config; - $required_fields=array("firstname","lastname","address","city","postalcode","phone","email","dateofbirth"); + $required_fields=array("firstname","lastname","address","city","postalcode","phonehome","email","dateofbirth"); $q=mysql_query("SELECT * FROM judges WHERE id='".$_SESSION['judges_id']."'"); @@ -33,7 +33,7 @@ function expertiseStatus() $r=mysql_fetch_object($q); $numdivisions=$r->num; - $q=mysql_query("SELECT COUNT(id) AS num FROM judges_expertise WHERE judges_id='".$_SESSION['judges_id']."' AND year='".$config['FAIRYEAR']."'"); + $q=mysql_query("SELECT COUNT(id) AS num FROM judges_expertise WHERE projectdivisions_id IS NOT NULL AND judges_id='".$_SESSION['judges_id']."' AND year='".$config['FAIRYEAR']."'"); $r=mysql_fetch_object($q); $numjudgesexpertise=$r->num; diff --git a/register_judges_expertise.php b/register_judges_expertise.php index 9165716..b641882 100644 --- a/register_judges_expertise.php +++ b/register_judges_expertise.php @@ -28,10 +28,22 @@ //first delete all their old associations for this year.. mysql_query("DELETE FROM judges_expertise WHERE judges_id='".$_SESSION['judges_id']."' AND year='".$config['FAIRYEAR']."'"); + if(!is_array($_POST['division'])) + $_POST['division']=array(); + if(!is_array($_POST['subdivision'])) + $_POST['subdivision']=array(); + foreach($_POST['division'] AS $key=>$val) { mysql_query("INSERT INTO judges_expertise (judges_id, projectdivisions_id, val, year) VALUES ('".$_SESSION['judges_id']."','$key','$val','".$config['FAIRYEAR']."')"); } + + foreach($_POST['subdivision'] AS $key=>$val) + { + mysql_query("INSERT INTO judges_expertise (judges_id, projectsubdivisions_id, val, year) VALUES ('".$_SESSION['judges_id']."','$key','$val','".$config['FAIRYEAR']."')"); + } + + echo notice(i18n("Areas of Expertise successfully saved")); } $q=mysql_query("SELECT * FROM judges WHERE email='".$_SESSION['email']."' AND id='".$_SESSION['judges_id']."'"); @@ -53,32 +65,61 @@ else echo i18n("Please rank the following divisions according to the amount of knowledge you have of each subject. A '1' indicates very little knowledge, and a '5' indicates you are very knowledgeable of the subject"); echo "
"; echo "
"; + echo i18n("Once you save, any division that you specified as 3 or more will offer sub-divisions for you to choose from."); + echo "
"; + echo "
"; $q=mysql_query("SELECT * FROM judges_expertise WHERE judges_id='".$_SESSION['judges_id']."' AND year='".$config['FAIRYEAR']."'"); while($r=mysql_fetch_object($q)) { - $expertise[$r->projectdivisions_id]=$r->val; + if($r->projectdivisions_id) + $expertise[$r->projectdivisions_id]=$r->val; + else if($r->projectsubdivisions_id) + $subexpertise[$r->projectsubdivisions_id]=$r->val; } echo "\n"; - echo ""; - for($x=1;$x<=5;$x++) - echo ""; - echo ""; //query all of the categories $q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY division"); while($r=mysql_fetch_object($q)) { - echo ""; + echo ""; + for($x=1;$x<=5;$x++) + echo ""; + echo ""; + + echo ""; for($x=1;$x<=5;$x++) { if($expertise[$r->id]==$x) $sel="checked=\"checked\""; else $sel=""; - echo ""; + echo ""; } echo ""; + + //only show the sub-divisions if the 'main' division is scored >1 + if($expertise[$r->id]>=3) + { + + $subq=mysql_query("SELECT * FROM projectsubdivisions WHERE projectdivisions_id='$r->id' ORDER BY subdivision"); + while($subr=mysql_fetch_object($subq)) + { + echo ""; + echo ""; + if($subexpertise[$subr->id]) $ch="checked=\"checked\""; else $ch=""; + + echo ""; + echo ""; + echo ""; + } + } + + echo ""; + } echo "
Division$x
".i18n($r->division)."
$x
".i18n($r->division)."id]\" value=\"$x\" />id]\" value=\"$x\" />
 id]\" value=\"1\">"; + echo "$subr->subdivision"; + echo "
 
"; echo "
"; diff --git a/register_judges_personal.php b/register_judges_personal.php index 3e1fed7..4eed193 100644 --- a/register_judges_personal.php +++ b/register_judges_personal.php @@ -26,6 +26,9 @@ if($_POST['action']=="save") { $dob=$_POST['year']."-".$_POST['month']."-".$_POST['day']; + if($_POST['catpref']) $catpref="'".$_POST['catpref']."'"; + else $catpref="null"; + mysql_query("UPDATE judges SET ". "firstname='".mysql_escape_string(stripslashes($_POST['firstname']))."', ". "lastname='".mysql_escape_string(stripslashes($_POST['lastname']))."', ". @@ -34,11 +37,16 @@ "city='".mysql_escape_string(stripslashes($_POST['city']))."', ". "province='".mysql_escape_string(stripslashes($_POST['province']))."', ". "postalcode='".mysql_escape_string(stripslashes($_POST['postalcode']))."', ". - "phone='".mysql_escape_string(stripslashes($_POST['phone']))."', ". + "phonehome='".mysql_escape_string(stripslashes($_POST['phonehome']))."', ". + "phonework='".mysql_escape_string(stripslashes($_POST['phonework']))."', ". + "phonecell='".mysql_escape_string(stripslashes($_POST['phonecell']))."', ". "organization='".mysql_escape_string(stripslashes($_POST['organization']))."', ". + "catpref=$catpref, ". "years_school='".mysql_escape_string(stripslashes($_POST['years_school']))."', ". "years_regional='".mysql_escape_string(stripslashes($_POST['years_regional']))."', ". "years_national='".mysql_escape_string(stripslashes($_POST['years_national']))."', ". + "willing_chair='".mysql_escape_string(stripslashes($_POST['willing_chair']))."', ". + "attending_lunch='".mysql_escape_string(stripslashes($_POST['attending_lunch']))."', ". "dateofbirth='$dob' ". "WHERE id='".$_SESSION['judges_id']."'"); echo mysql_error(); @@ -76,7 +84,7 @@ echo " ".i18n("Province")."\n"; echo "\n"; echo " ".i18n("Postal Code")."postalcode\" />\n"; -echo " ".i18n("Phone")."phone\" />\n"; +echo " ".i18n("Phone (Home)")."phonehome\" />\n"; echo "\n"; echo "\n"; @@ -90,19 +98,62 @@ list($year,$month,$day)=split("-",$judgeinfo->dateofbirth); emit_year_selector("year",$year,date("Y")-$config['maxjudgeage'],date("Y")-$config['minjudgeage']); echo "\n"; echo " \n"; -echo " ".i18n("Organization")."organization\" />\n"; +echo " ".i18n("Phone (Work)")."phonework\" />\n"; echo ""; + +echo "\n"; +echo " ".i18n("Organization")."organization\" />\n"; +echo " ".i18n("Phone (Cell)")."phonecell\" />\n"; +echo ""; + echo "
"; echo "\n"; -echo " ".i18n("Years of judging experience at school/local level")."years_school\" size=\"3\" >\n"; +echo " ".i18n("Age category preference").""; +$q=mysql_query("SELECT * FROM projectcategories ORDER BY mingrade"); +echo ""; + +echo "\n"; echo "\n"; echo "\n"; -echo " ".i18n("Years of judging experience at regional level")."years_regional\" size=\"3\" >\n"; +echo " ".i18n("Years of judging experience at school/local level")."years_school\" size=\"3\" >\n"; echo "\n"; echo "\n"; -echo " ".i18n("Years of judging experience at national level")."years_national\" size=\"3\" >\n"; +echo " ".i18n("Years of judging experience at regional level")."years_regional\" size=\"3\" >\n"; echo "\n"; +echo "\n"; +echo " ".i18n("Years of judging experience at national level")."years_national\" size=\"3\" >\n"; +echo "\n"; + +echo "\n"; +echo " ".i18n("Willing to act as a division chair?").""; +if($judgeinfo->willing_chair=="no") $ch="checked=\"checked\""; else $ch=""; +echo "No"; +echo "    "; +if($judgeinfo->willing_chair=="yes") $ch="checked=\"checked\""; else $ch=""; +echo "Yes"; +echo "\n"; +echo "\n"; + +echo "\n"; +echo " ".i18n("Attending lunch?").""; +if($judgeinfo->attending_lunch=="no") $ch="checked=\"checked\""; else $ch=""; +echo "No"; +echo "    "; +if($judgeinfo->attending_lunch=="yes") $ch="checked=\"checked\""; else $ch=""; +echo "Yes"; +echo "\n"; +echo "\n"; + + echo ""; echo "\n";