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
This commit is contained in:
james 2004-12-20 19:46:08 +00:00
parent 8e49f54230
commit 91e5323e5e
3 changed files with 107 additions and 15 deletions

View File

@ -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;

View File

@ -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 "<br />";
echo "<br />";
echo i18n("Once you save, any division that you specified as 3 or more will offer sub-divisions for you to choose from.");
echo "<br />";
echo "<br />";
$q=mysql_query("SELECT * FROM judges_expertise WHERE judges_id='".$_SESSION['judges_id']."' AND year='".$config['FAIRYEAR']."'");
while($r=mysql_fetch_object($q))
{
if($r->projectdivisions_id)
$expertise[$r->projectdivisions_id]=$r->val;
else if($r->projectsubdivisions_id)
$subexpertise[$r->projectsubdivisions_id]=$r->val;
}
echo "<table>\n";
echo "<tr><th>Division</th>";
for($x=1;$x<=5;$x++)
echo "<th>$x</th>";
echo "</tr>";
//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 "<tr><td>".i18n($r->division)."</td>";
echo "<tr><th></th>";
for($x=1;$x<=5;$x++)
echo "<th>$x</th>";
echo "</tr>";
echo "<tr><td><b>".i18n($r->division)."</b></td>";
for($x=1;$x<=5;$x++)
{
if($expertise[$r->id]==$x) $sel="checked=\"checked\""; else $sel="";
echo "<td><input $sel type=\"radio\" name=\"division[$r->id]\" value=\"$x\" /></td>";
echo "<td width=\"30\"><input $sel type=\"radio\" name=\"division[$r->id]\" value=\"$x\" /></td>";
}
echo "</tr>";
//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 "<tr>";
echo "<td>&nbsp;</td>";
if($subexpertise[$subr->id]) $ch="checked=\"checked\""; else $ch="";
echo "<td><input $ch type=\"checkbox\" name=\"subdivision[$subr->id]\" value=\"1\"></td>";
echo "<td colspan=\"4\">";
echo "$subr->subdivision";
echo "</td>";
echo "</tr>";
}
}
echo "<tr><td colspan=\"6\">&nbsp;</td></tr>";
}
echo "</table>";
echo "<br />";

View File

@ -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 " <td>".i18n("Province")."</td><td><input type=\"text\" name=\"province\" v
echo "</tr>\n";
echo "<tr>\n";
echo " <td>".i18n("Postal Code")."</td><td><input type=\"text\" name=\"postalcode\" value=\"$judgeinfo->postalcode\" /></td>\n";
echo " <td>".i18n("Phone")."</td><td><input type=\"text\" name=\"phone\" value=\"$judgeinfo->phone\" /></td>\n";
echo " <td>".i18n("Phone (Home)")."</td><td><input type=\"text\" name=\"phonehome\" value=\"$judgeinfo->phonehome\" /></td>\n";
echo "</tr>\n";
echo "<tr>\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 "</td></tr></table>\n";
echo " </td>\n";
echo " <td>".i18n("Organization")."</td><td><input type=\"text\" name=\"organization\" value=\"$judgeinfo->organization\" /></td>\n";
echo " <td>".i18n("Phone (Work)")."</td><td><input type=\"text\" name=\"phonework\" value=\"$judgeinfo->phonework\" /></td>\n";
echo "</tr>";
echo "<tr>\n";
echo " <td>".i18n("Organization")."</td><td><input type=\"text\" name=\"organization\" value=\"$judgeinfo->organization\" /></td>\n";
echo " <td>".i18n("Phone (Cell)")."</td><td><input type=\"text\" name=\"phonecell\" value=\"$judgeinfo->phonecell\" /></td>\n";
echo "</tr>";
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
echo "<tr>\n";
echo " <td colspan=\"3\">".i18n("Years of judging experience at school/local level")."</td><td><input type=\"text\" name=\"years_school\" value=\"$judgeinfo->years_school\" size=\"3\" ></td>\n";
echo " <td colspan=\"2\">".i18n("Age category preference")."</td><td>";
$q=mysql_query("SELECT * FROM projectcategories ORDER BY mingrade");
echo "<select name=\"catpref\">";
echo "<option value=\"\">".i18n("Doesn't Matter")."</option>\n";
while($r=mysql_fetch_object($q))
{
if($judgeinfo->catpref==$r->id) $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"$r->id\">".i18n("%1 (Grades %2-%3)",array(i18n($r->category),$r->mingrade,$r->maxgrade))."</option>\n";
}
echo "</select>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"3\">".i18n("Years of judging experience at regional level")."</td><td><input type=\"text\" name=\"years_regional\" value=\"$judgeinfo->years_regional\" size=\"3\" ></td>\n";
echo " <td colspan=\"2\">".i18n("Years of judging experience at school/local level")."</td><td><input type=\"text\" name=\"years_school\" value=\"$judgeinfo->years_school\" size=\"3\" ></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"3\">".i18n("Years of judging experience at national level")."</td><td><input type=\"text\" name=\"years_national\" value=\"$judgeinfo->years_national\" size=\"3\" ></td>\n";
echo " <td colspan=\"2\">".i18n("Years of judging experience at regional level")."</td><td><input type=\"text\" name=\"years_regional\" value=\"$judgeinfo->years_regional\" size=\"3\" ></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Years of judging experience at national level")."</td><td><input type=\"text\" name=\"years_national\" value=\"$judgeinfo->years_national\" size=\"3\" ></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Willing to act as a division chair?")."</td><td>";
if($judgeinfo->willing_chair=="no") $ch="checked=\"checked\""; else $ch="";
echo "<input $ch type=\"radio\" name=\"willing_chair\" value=\"no\">No";
echo "&nbsp; &nbsp; ";
if($judgeinfo->willing_chair=="yes") $ch="checked=\"checked\""; else $ch="";
echo "<input $ch type=\"radio\" name=\"willing_chair\" value=\"yes\">Yes";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Attending lunch?")."</td><td>";
if($judgeinfo->attending_lunch=="no") $ch="checked=\"checked\""; else $ch="";
echo "<input $ch type=\"radio\" name=\"attending_lunch\" value=\"no\">No";
echo "&nbsp; &nbsp; ";
if($judgeinfo->attending_lunch=="yes") $ch="checked=\"checked\""; else $ch="";
echo "<input $ch type=\"radio\" name=\"attending_lunch\" value=\"yes\">Yes";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<input type=\"submit\" value=\"".i18n("Save Personal Information")."\" />\n";