Fix a few problems with the requirement of the age categories preferences.

This commit is contained in:
james 2006-02-07 20:48:15 +00:00
parent a85faefe2d
commit 644911c075
2 changed files with 18 additions and 9 deletions

View File

@ -56,6 +56,19 @@ function personalStatus()
$r=mysql_fetch_object($q); $r=mysql_fetch_object($q);
if($r->num==0) if($r->num==0)
return "incomplete"; return "incomplete";
//and they need to rank all of the age categories
$q=mysql_query("SELECT COUNT(id) AS num FROM projectcategories WHERE year='".$config['FAIRYEAR']."'");
$r=mysql_fetch_object($q);
$numcats=$r->num;
$q=mysql_query("SELECT COUNT(id) AS num FROM judges_catpref WHERE year='".$config['FAIRYEAR']."' AND judges_id='".$_SESSION['judges_id']."'");
$r=mysql_fetch_object($q);
$numprefs=$r->num;
if($numcats!=$numprefs)
return "incomplete";
//if it made it through without returning incomplete, then we must be complete //if it made it through without returning incomplete, then we must be complete

View File

@ -33,12 +33,6 @@
if($_POST['action']=="save") if($_POST['action']=="save")
{ {
/* if($_POST['catpref']) $catpref="'".$_POST['catpref']."'";
else $catpref="null";
if($_POST['divpref']) $divpref="'".$_POST['divpref']."'";
else $divpref="null";
*/
mysql_query("UPDATE judges SET ". mysql_query("UPDATE judges SET ".
"firstname='".mysql_escape_string(stripslashes($_POST['firstname']))."', ". "firstname='".mysql_escape_string(stripslashes($_POST['firstname']))."', ".
"lastname='".mysql_escape_string(stripslashes($_POST['lastname']))."', ". "lastname='".mysql_escape_string(stripslashes($_POST['lastname']))."', ".
@ -80,7 +74,8 @@
{ {
foreach($_POST['catpref'] AS $k=>$v) foreach($_POST['catpref'] AS $k=>$v)
{ {
mysql_query("INSERT INTO judges_catpref (judges_id,projectcategories_id,rank,year) values ('".$_SESSION['judges_id']."','$k','$v','".$config['FAIRYEAR']."')"); if($v!="")
mysql_query("INSERT INTO judges_catpref (judges_id,projectcategories_id,rank,year) values ('".$_SESSION['judges_id']."','$k','$v','".$config['FAIRYEAR']."')");
} }
} }
@ -157,12 +152,13 @@ while($r=mysql_fetch_object($q))
echo "</td>"; echo "</td>";
echo "<td>"; echo "<td>";
echo "<select name=\"catpref[$r->id]\">"; echo "<select name=\"catpref[$r->id]\">";
echo "<option value=\"\">".i18n("Choose")."</option>\n";
foreach($preferencechoices AS $val=>$str) foreach($preferencechoices AS $val=>$str)
{ {
if($catprefs[$r->id]==$val) $sel="selected=\"selected\""; else $sel=""; if($catprefs[$r->id]==$val && $catprefs[$r->id]!="") $sel="selected=\"selected\""; else $sel="";
echo "<option $sel value=\"$val\">".i18n($str)."</option>\n"; echo "<option $sel value=\"$val\">".i18n($str)."</option>\n";
} }
echo "</select>"; echo "</select>".REQUIREDFIELD;
echo "</td>"; echo "</td>";
echo "</tr>"; echo "</tr>";