forked from science-ation/science-ation
add judges languages, make sure at least one language is selected
This commit is contained in:
parent
920cb297b7
commit
5dc408da33
@ -40,6 +40,13 @@ function personalStatus()
|
||||
}
|
||||
}
|
||||
|
||||
//and they also have to select at least one language to judge in
|
||||
$q=mysql_query("SELECT COUNT(judges_id) AS num FROM judges_languages WHERE judges_id='".$_SESSION['judges_id']."'");
|
||||
$r=mysql_fetch_object($q);
|
||||
if($r->num==0)
|
||||
return "incomplete";
|
||||
|
||||
|
||||
//if it made it through without returning incomplete, then we must be complete
|
||||
return "complete";
|
||||
}
|
||||
|
@ -79,6 +79,18 @@
|
||||
"attending_lunch='".mysql_escape_string(stripslashes($_POST['attending_lunch']))."' ".
|
||||
"WHERE id='".$_SESSION['judges_id']."'");
|
||||
echo mysql_error();
|
||||
|
||||
//first we clear out their old languages
|
||||
mysql_query("DELETE FROM judges_languages WHERE judges_id='".$_SESSION['judges_id']."'");
|
||||
if(count($_POST['languages']))
|
||||
{
|
||||
//and now we add back any selected languages
|
||||
foreach($_POST['languages'] AS $l)
|
||||
{
|
||||
mysql_query("INSERT INTO judges_languages (judges_id,languages_lang) VALUES ('".$_SESSION['judges_id']."','$l')");
|
||||
}
|
||||
|
||||
}
|
||||
echo notice(i18n("%1 %2 successfully updated",array($_POST['firstname'],$_POST['lastname'])));
|
||||
}
|
||||
$q=mysql_query("SELECT * FROM judges WHERE email='".$_SESSION['email']."' AND id='".$_SESSION['judges_id']."'");
|
||||
@ -168,6 +180,29 @@ echo " <td colspan=\"2\">".i18n("Highest post-secondary degree")."</td>";
|
||||
echo " <td colspan=\"2\"><input type=\"text\" name=\"highest_psd\" size=\"35\" value=\"$judgeinfo->highest_psd\" /></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan=\"2\">".i18n("I can judge in the following languages")."</td>";
|
||||
echo " <td colspan=\"2\">";
|
||||
|
||||
//grab the current languages that are selected
|
||||
$currentlanguages=array();
|
||||
$q=mysql_query("SELECT languages_lang FROM judges_languages WHERE judges_id='".$_SESSION['judges_id']."'");
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
$currentlanguages[]=$r->languages_lang;
|
||||
}
|
||||
|
||||
$q=mysql_query("SELECT * FROM languages WHERE active='Y' ORDER BY langname");
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if(in_array($r->lang,$currentlanguages)) $ch="checked=\"checked\""; else $ch="";
|
||||
|
||||
echo "<input $ch type=\"checkbox\" name=\"languages[]\" value=\"$r->lang\" /> $r->langname <br />";
|
||||
}
|
||||
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan=\"2\">".i18n("Years of judging experience at school/local level")."</td>\n";
|
||||
echo " <td colspan=\"2\"><input type=\"text\" name=\"years_school\" value=\"$judgeinfo->years_school\" size=\"3\" /></td>\n";
|
||||
|
Loading…
Reference in New Issue
Block a user