forked from science-ation/science-ation
c8ee2bab56
xhtml compliance
132 lines
4.1 KiB
PHP
132 lines
4.1 KiB
PHP
<?
|
|
require("common.inc.php");
|
|
include "register_judges.inc.php";
|
|
|
|
//authenticate based on email address and registration number from the SESSION
|
|
if(! ($_SESSION['email'] && $_SESSION['judges_id']) )
|
|
{
|
|
header("Location: register_judges.php");
|
|
exit;
|
|
}
|
|
|
|
$q=mysql_query("SELECT id FROM judges WHERE email='".$_SESSION['email']."' AND id='".$_SESSION['judges_id']."'");
|
|
echo mysql_error();
|
|
|
|
if(mysql_num_rows($q)==0)
|
|
{
|
|
header("Location: register_judges.php?action=logout");
|
|
exit;
|
|
}
|
|
//send the header
|
|
send_header("Judges Registration - Areas of Expertise Information");
|
|
|
|
echo "<a href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
|
echo "<br />";
|
|
|
|
if($_POST['action']=="save")
|
|
{
|
|
//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']."'");
|
|
$judgeinfo=mysql_fetch_object($q);
|
|
|
|
//output the current status
|
|
$newstatus=expertiseStatus();
|
|
if($newstatus!="complete")
|
|
{
|
|
echo error(i18n("Areas of Expertise Information Incomplete"));
|
|
}
|
|
else
|
|
{
|
|
echo happy(i18n("Areas of Expertise Information Complete"));
|
|
}
|
|
|
|
echo "<form name=\"expertiseform\" method=\"post\" action=\"register_judges_expertise.php\">\n";
|
|
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
|
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";
|
|
|
|
|
|
//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><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 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 >=3
|
|
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> </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\"> </td></tr>";
|
|
|
|
}
|
|
echo "</table>";
|
|
echo "<br />";
|
|
echo "<input type=\"submit\" value=\"".i18n("Save Areas of Expertise Information")."\" />\n";
|
|
echo "</form>";
|
|
|
|
|
|
send_footer();
|
|
?>
|