science-ation/register_judges_specialawards.php

123 lines
4.2 KiB
PHP
Raw Normal View History

2007-01-30 06:16:23 +00:00
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
?>
<?
require("common.inc.php");
include "register_judges.inc.php";
//send the header
send_header("Judges Registration - Special Awards");
echo "<a onclick=\"return confirmChanges();\" href=\"register_judges_main.php\">&lt;&lt; ".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_specialaward_sel WHERE judges_id='".$_SESSION['judges_id']."' AND year='".$config['FAIRYEAR']."'");
if(array_key_exists('spaward', $_POST)) {
foreach($_POST['spaward'] AS $aid)
{
mysql_query("INSERT INTO judges_specialaward_sel (judges_id, award_awards_id, year)
VALUES ('".$_SESSION['judges_id']."','$aid','{$config['FAIRYEAR']}')");
}
}
echo notice(i18n("Special Award preferences successfully saved"));
}
$q=mysql_query("SELECT * FROM judges WHERE email='".$_SESSION['email']."' AND id='".$_SESSION['judges_id']."'");
$judgeinfo=mysql_fetch_object($q);
updateJudgeCompleteStatus($judgeinfo);
//output the current status
$newstatus=specialawardStatus();
if($newstatus!="complete")
{
echo error(i18n("Special Award Preferences Incomplete"));
}
else
{
echo happy(i18n("Special Award Preferences Complete"));
}
echo "<form name=\"specialawardform\" method=\"post\" action=\"register_judges_specialawards.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
if($judgeinfo->typepref == 'speconly') {
echo i18n("Please select the special award you are supposed to judge.");
} else {
echo i18n("Please select any special awards you would prefer to judge.");
echo i18n(" We assign judges to divisional awards first. So please note that by selecting awards here it does not guarantee that you will be judging special awards. This selects your special award judging preferences IF you are not assigned to a divisional judging team.");
}
echo "<br />";
echo "<br />";
$q=mysql_query("SELECT * FROM judges_specialaward_sel WHERE judges_id='".$_SESSION['judges_id']."' AND year='".$config['FAIRYEAR']."'");
$spawards = array();
while($r=mysql_fetch_object($q))
{
$spawards[] = $r->award_awards_id;
}
echo "<table>\n";
//query all of the awards
$q=mysql_query("SELECT award_awards.id,
award_awards.name,
award_awards.criteria
FROM
award_awards,
award_types
WHERE
award_types.id=award_awards.award_types_id
AND award_types.type='Special'
AND award_awards.year='{$config['FAIRYEAR']}'
AND award_types.year='{$config['FAIRYEAR']}'
ORDER BY
name");
echo mysql_error();
while($r=mysql_fetch_object($q))
{
echo "<tr><td rowspan=\"2\">";
$ch = (in_array($r->id,$spawards)) ? "checked=\"checked\"" : "";
echo "<input onclick=\"checkboxclicked(this)\" $ch type=\"checkbox\" name=\"spaward[]\" value=\"{$r->id}\" />";
echo "</td><td>";
echo "<b>{$r->name}</b>";
echo "</td></tr>";
echo "<tr><td>";
echo "{$r->criteria}";
echo "<br /><br />";
echo "</td></tr>";
}
echo "</table>";
echo "<br />";
echo "<input type=\"submit\" value=\"".i18n("Save Areas of Expertise Information")."\" />\n";
echo "</form>";
echo "<br />";
echo "<a onclick=\"return confirmChanges();\" href=\"register_judges_main.php\">&lt;&lt; ".i18n("Back to Judges Registration Summary")."</a><br />";
send_footer();
?>