<? /* 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 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 - Personal Information"); echo "<a href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />"; echo "<br />"; if($_POST['action']=="save") { $dob=$_POST['year']."-".$_POST['month']."-".$_POST['day']; if($_POST['catpref']) $catpref="'".$_POST['catpref']."'"; else $catpref="null"; mysql_query("UPDATE judges SET ". "firstname='".mysql_escape_string(stripslashes($_POST['firstname']))."', ". "lastname='".mysql_escape_string(stripslashes($_POST['lastname']))."', ". "email='".mysql_escape_string(stripslashes($_POST['email']))."', ". "address='".mysql_escape_string(stripslashes($_POST['address']))."', ". "address2='".mysql_escape_string(stripslashes($_POST['address2']))."', ". "city='".mysql_escape_string(stripslashes($_POST['city']))."', ". "province='".mysql_escape_string(stripslashes($_POST['province']))."', ". "postalcode='".mysql_escape_string(stripslashes($_POST['postalcode']))."', ". "phonehome='".mysql_escape_string(stripslashes($_POST['phonehome']))."', ". "phonework='".mysql_escape_string(stripslashes($_POST['phonework']))."', ". "phoneworkext='".mysql_escape_string(stripslashes($_POST['phoneworkext']))."', ". "phonecell='".mysql_escape_string(stripslashes($_POST['phonecell']))."', ". "organization='".mysql_escape_string(stripslashes($_POST['organization']))."', ". "catpref=$catpref, ". "years_school='".mysql_escape_string(stripslashes($_POST['years_school']))."', ". "years_regional='".mysql_escape_string(stripslashes($_POST['years_regional']))."', ". "years_national='".mysql_escape_string(stripslashes($_POST['years_national']))."', ". "willing_chair='".mysql_escape_string(stripslashes($_POST['willing_chair']))."', ". "attending_lunch='".mysql_escape_string(stripslashes($_POST['attending_lunch']))."' ". "WHERE id='".$_SESSION['judges_id']."'"); echo mysql_error(); 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']."'"); $judgeinfo=mysql_fetch_object($q); //output the current status $newstatus=personalStatus(); if($newstatus!="complete") { echo error(i18n("Personal Information Incomplete")); } else { echo happy(i18n("Personal Information Complete")); } echo "<form name=\"personalform\" method=\"post\" action=\"register_judges_personal.php\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"save\" />\n"; echo "<table>\n"; echo "<tr>\n"; echo " <td>".i18n("First Name")."</td><td><input type=\"text\" name=\"firstname\" value=\"$judgeinfo->firstname\" /></td>\n"; echo " <td>".i18n("Last Name")."</td><td><input type=\"text\" name=\"lastname\" value=\"$judgeinfo->lastname\" /></td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo " <td>".i18n("Email Address")."</td><td><input type=\"text\" name=\"email\" value=\"$judgeinfo->email\" /></td>\n"; echo " <td>".i18n("City")."</td><td><input type=\"text\" name=\"city\" value=\"$judgeinfo->city\" /></td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo " <td>".i18n("Address 1")."</td><td><input type=\"text\" name=\"address\" value=\"$judgeinfo->address\" /></td>\n"; echo " <td>".i18n("Province")."</td><td>"; emit_province_selector("province",$judgeinfo->province); echo "</td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo " <td>".i18n("Address 2")."</td><td><input type=\"text\" name=\"address2\" value=\"$judgeinfo->address2\" /></td>\n"; echo " <td>".i18n("Phone (Home)")."</td><td><input type=\"text\" name=\"phonehome\" value=\"$judgeinfo->phonehome\" /></td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo " <td>".i18n("Postal Code")."</td><td><input type=\"text\" name=\"postalcode\" value=\"$judgeinfo->postalcode\" /></td>\n"; echo " <td>".i18n("Phone (Work)")."</td><td><input type=\"text\" name=\"phonework\" value=\"$judgeinfo->phonework\" /> ext<input size=\"5\" type=\"text\" name=\"phoneworkext\" value=\"$judgeinfo->phoneworkext\" /></td>\n"; echo "</tr>"; echo "<tr>\n"; echo " <td>".i18n("Organization")."</td><td><input type=\"text\" name=\"organization\" value=\"$judgeinfo->organization\" /></td>\n"; echo " <td>".i18n("Phone (Cell)")."</td><td><input type=\"text\" name=\"phonecell\" value=\"$judgeinfo->phonecell\" /></td>\n"; echo "</tr>"; echo "<tr><td colspan=\"4\"><hr /></td></tr>"; echo "<tr>\n"; echo " <td colspan=\"2\">".i18n("Age category preference")."</td><td>"; $q=mysql_query("SELECT * FROM projectcategories ORDER BY mingrade"); echo "<select name=\"catpref\">"; echo "<option value=\"\">".i18n("Doesn't Matter")."</option>\n"; while($r=mysql_fetch_object($q)) { if($judgeinfo->catpref==$r->id) $sel="selected=\"selected\""; else $sel=""; echo "<option $sel value=\"$r->id\">".i18n("%1 (Grades %2-%3)",array(i18n($r->category),$r->mingrade,$r->maxgrade))."</option>\n"; } echo "</select>"; echo "</td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo " <td colspan=\"2\">".i18n("Years of judging experience at school/local level")."</td><td><input type=\"text\" name=\"years_school\" value=\"$judgeinfo->years_school\" size=\"3\" /></td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo " <td colspan=\"2\">".i18n("Years of judging experience at regional level")."</td><td><input type=\"text\" name=\"years_regional\" value=\"$judgeinfo->years_regional\" size=\"3\" /></td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo " <td colspan=\"2\">".i18n("Years of judging experience at national level")."</td><td><input type=\"text\" name=\"years_national\" value=\"$judgeinfo->years_national\" size=\"3\" /></td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo " <td colspan=\"2\">".i18n("Willing to act as a division chair?")."</td><td>"; if($judgeinfo->willing_chair=="no") $ch="checked=\"checked\""; else $ch=""; echo "<input $ch type=\"radio\" name=\"willing_chair\" value=\"no\" />No"; echo " "; if($judgeinfo->willing_chair=="yes") $ch="checked=\"checked\""; else $ch=""; echo "<input $ch type=\"radio\" name=\"willing_chair\" value=\"yes\" />Yes"; echo "</td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo " <td colspan=\"2\">".i18n("Attending lunch?")."</td><td>"; if($judgeinfo->attending_lunch=="no") $ch="checked=\"checked\""; else $ch=""; echo "<input $ch type=\"radio\" name=\"attending_lunch\" value=\"no\" />No"; echo " "; if($judgeinfo->attending_lunch=="yes") $ch="checked=\"checked\""; else $ch=""; echo "<input $ch type=\"radio\" name=\"attending_lunch\" value=\"yes\" />Yes"; echo "</td>\n"; echo "</tr>\n"; echo "</table>"; echo "<input type=\"submit\" value=\"".i18n("Save Personal Information")."\" />\n"; echo "</form>"; send_footer(); ?>