science-ation/judge_special_awards.php
dave a0d27df91e - use the newer (faster) user load, and always load a full user.
- delete now deprecated code because of the new user loader
2008-10-19 21:42:57 +00:00

118 lines
3.8 KiB
PHP

<?
/*
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_once('common.inc.php');
require_once('user.inc.php');
require_once('judge.inc.php');
$u = user_load($_SESSION['users_id']);
//send the header
send_header('Special Awards',
array('Judge Registration' => 'judge_main.php')
);
if($_POST['action']=="save") {
//first delete all their old associations for this year..
mysql_query("DELETE FROM judges_specialaward_sel WHERE users_id='{$u['id']}'");
if(array_key_exists('spaward', $_POST)) {
foreach($_POST['spaward'] AS $aid) {
mysql_query("INSERT INTO judges_specialaward_sel (users_id, award_awards_id)
VALUES ('{$u['id']}','$aid')");
}
}
echo notice(i18n("Special Award preferences successfully saved"));
}
judge_status_update($u);
//output the current status
$newstatus=judge_status_special_awards($u);
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=\"judge_special_awards.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
if($u['special_award_only'] == 'yes') {
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 "&nbsp;&nbsp;";
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 users_id='{$u['id']}'");
$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,
award_sponsors.organization
FROM
award_awards,
award_types,
award_sponsors
WHERE
award_types.id=award_awards.award_types_id
AND award_sponsors.id=award_awards.award_sponsors_id
AND (award_types.type='Special' OR award_types.type='Other')
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> ({$r->organization})";
echo "</td></tr>";
echo "<tr><td>";
echo "{$r->criteria}";
echo "<br /><br />";
echo "</td></tr>";
}
echo "</table>";
echo "<input type=\"submit\" value=\"".i18n("Save Special Award Preferences")."\" />\n";
echo "</form>";
send_footer();
?>