science-ation/register_judges_main.php
2005-01-24 18:00:03 +00:00

148 lines
5.0 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("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 * 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;
}
$judgeinfo=mysql_fetch_object($q);
send_header("Judges Registration");
if($_GET['action']=="activate")
{
mysql_query("INSERT INTO judges_years (judges_id,year) VALUES ('".$_SESSION['judges_id']."','".$config['FAIRYEAR']."')");
echo happy(i18n("Judge profile for %1 successfully activated",array($config['FAIRYEAR'])));
}
if($_GET['action']=="deactivate")
{
mysql_query("DELETE FROM judges_years WHERE judges_id='".$_SESSION['judges_id']."' AND year='".$config['FAIRYEAR']."'");
echo happy(i18n("Judge profile for %1 successfully deactivated",array($config['FAIRYEAR'])));
}
//only display the named greeting if we have their name
if($judgeinfo->firstname)
{
echo i18n("Hello <b>%1</b>",array($judgeinfo->firstname));
echo "<br />";
}
echo "<br />";
//first, we need to see if they havec the current FAIRYEAR activated, if not, we'll keep their acocunt 'dormant' and it wont
//be used for anything, but will still be available for them to login in the following years.
$q=mysql_query("SELECT * FROM judges_years WHERE judges_id='".$_SESSION['judges_id']."' AND year='".$config['FAIRYEAR']."'");
if(!mysql_num_rows($q))
{
echo i18n("If you would like to participate as a judge in the %1 %2 please click the activate button below to activate your judges account for the fair",array($config['FAIRYEAR'],$config['fairname']));
echo "<br />";
echo "<br />";
echo "<form method=\"get\" action=\"".$_SERVER['PHP_SELF']."\">";
echo "<input type=\"hidden\" name=\"action\" value=\"activate\">\n";
echo "<input type=\"submit\" value=\"".i18n("Activate %1 Judge Profile",array($config['FAIRYEAR']))."\">";
echo "</form>";
}
else
{
echo i18n("Please use the checklist below to complete your registration. Click on an item in the table to edit that information. When you have entered all information, the <b>Status</b> field will change to <b>Complete</b>");
echo "<br />";
echo "<br />";
echo "<table class=\"summarytable\">";
echo "<tr><th>".i18n("Registration Item")."</th><th>".i18n("Status")."</th></tr>";
//judges personal information
echo "<tr><td>";
echo "<a href=\"register_judges_personal.php\">";
echo i18n("Personal Information");
echo "</a>";
echo "</td><td>";
//check to see if its complete
$statuspersonal=personalStatus();
echo outputStatus($statuspersonal);
echo "</td></tr>";
/*
//organization information
echo "<tr><td>";
echo "<a href=\"register_judges_organization.php\">";
echo i18n("Organization Information");
echo "</a>";
echo "</td><td>";
//check to see if its complete
$statusorganization=organizationStatus();
echo outputStatus($statusorganization);
echo "</td></tr>";
*/
//area of expertise
echo "<tr><td>";
echo "<a href=\"register_judges_expertise.php\">";
echo i18n("Areas of Expertise");
echo "</a>";
echo "</td><td>";
//check to see if its complete
$statusexpertise=expertiseStatus();
echo outputStatus($statusexpertise);
echo "</td></tr>";
echo "</table>";
echo "<br />";
echo "<br />";
echo i18n("If you are unable to participate as a judge in the %1 %2 please click the deactivate button below to deactivate your judges account for the fair",array($config['FAIRYEAR'],$config['fairname']));
echo "<br />";
echo "<br />";
echo "<form method=\"get\" action=\"".$_SERVER['PHP_SELF']."\">";
echo "<input type=\"hidden\" name=\"action\" value=\"deactivate\">\n";
echo "<input onclick=\"return confirmClick('".i18n("Are you sure you want to deactivate your judges profile for %1?",array($config['FAIRYEAR']))."')\" type=\"submit\" value=\"".i18n("Deactivate %1 Judge Profile",array($config['FAIRYEAR']))."\">";
echo "</form>";
}
echo "<br />";
echo "<a href=\"register_judges.php?action=logout\">".i18n("Logout")."</a>";
send_footer();
?>