forked from science-ation/science-ation

- fieldChanged - confirmChanges call fieldChanged when any field in any of the registraiton forms are chagned call confirmChanges when the "back to summary" link is changed, to warn them if they have any unsaved changes remove "(discard changes") from the "back to summary" links.
242 lines
11 KiB
PHP
242 lines
11 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";
|
|
|
|
//send the header
|
|
send_header("Judges Registration - Personal Information");
|
|
|
|
echo "<a onclick=\"return confirmChanges();\" href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
|
echo "<br />";
|
|
|
|
if($_POST['action']=="save")
|
|
{
|
|
if($_POST['catpref']) $catpref="'".$_POST['catpref']."'";
|
|
else $catpref="null";
|
|
if($_POST['divpref']) $divpref="'".$_POST['divpref']."'";
|
|
else $divpref="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, ".
|
|
"divpref=$divpref, ".
|
|
"highest_psd='".mysql_escape_string(stripslashes($_POST['highest_psd']))."', ".
|
|
"professional_quals='".mysql_escape_string(stripslashes($_POST['professional_quals']))."', ".
|
|
"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();
|
|
|
|
//first we clear out their old languages
|
|
mysql_query("DELETE FROM judges_languages WHERE judges_id='".$_SESSION['judges_id']."'");
|
|
if(count($_POST['languages']))
|
|
{
|
|
//and now we add back any selected languages
|
|
foreach($_POST['languages'] AS $l)
|
|
{
|
|
mysql_query("INSERT INTO judges_languages (judges_id,languages_lang) VALUES ('".$_SESSION['judges_id']."','$l')");
|
|
}
|
|
|
|
}
|
|
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 onchange=\"fieldChanged()\" type=\"text\" name=\"firstname\" value=\"$judgeinfo->firstname\" /></td>\n";
|
|
echo " <td>".i18n("Last Name")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"lastname\" value=\"$judgeinfo->lastname\" /></td>\n";
|
|
echo "</tr>\n";
|
|
echo "<tr>\n";
|
|
echo " <td>".i18n("Email Address")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"email\" value=\"$judgeinfo->email\" /></td>\n";
|
|
echo " <td>".i18n("City")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"city\" value=\"$judgeinfo->city\" /></td>\n";
|
|
echo "</tr>\n";
|
|
echo "<tr>\n";
|
|
echo " <td>".i18n("Address 1")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"address\" value=\"$judgeinfo->address\" /></td>\n";
|
|
echo " <td>".i18n("Province")."</td><td>";
|
|
emit_province_selector("province",$judgeinfo->province,"onchange=\"fieldChanged()\"");
|
|
echo "</td>\n";
|
|
echo "</tr>\n";
|
|
echo "<tr>\n";
|
|
echo " <td>".i18n("Address 2")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"address2\" value=\"$judgeinfo->address2\" /></td>\n";
|
|
echo " <td>".i18n("Phone (Home)")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"phonehome\" value=\"$judgeinfo->phonehome\" /></td>\n";
|
|
echo "</tr>\n";
|
|
|
|
echo "<tr>\n";
|
|
echo " <td>".i18n("Postal Code")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"postalcode\" value=\"$judgeinfo->postalcode\" /></td>\n";
|
|
echo " <td>".i18n("Phone (Work)")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"phonework\" value=\"$judgeinfo->phonework\" /> ext<input size=\"5\" onchange=\"fieldChanged()\" type=\"text\" name=\"phoneworkext\" value=\"$judgeinfo->phoneworkext\" /></td>\n";
|
|
echo "</tr>";
|
|
|
|
echo "<tr>\n";
|
|
echo " <td>".i18n("Organization")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"organization\" value=\"$judgeinfo->organization\" /></td>\n";
|
|
echo " <td>".i18n("Phone (Cell)")."</td><td><input onchange=\"fieldChanged()\" 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 colspan=\"2\">";
|
|
$q=mysql_query("SELECT * FROM projectcategories ORDER BY mingrade");
|
|
echo "<select name=\"catpref\" onchange=\"fieldChanged()\" >";
|
|
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("Division preference")."</td><td colspan=\"2\">";
|
|
$q=mysql_query("SELECT * FROM projectdivisions ORDER BY division");
|
|
echo "<select name=\"divpref\" onchange=\"fieldChanged()\" >";
|
|
echo "<option value=\"\">".i18n("Doesn't Matter")."</option>\n";
|
|
while($r=mysql_fetch_object($q))
|
|
{
|
|
if($judgeinfo->divpref==$r->id) $sel="selected=\"selected\""; else $sel="";
|
|
|
|
echo "<option $sel value=\"$r->id\">".i18n($r->division)."</option>\n";
|
|
}
|
|
echo "</select>";
|
|
|
|
echo "</td>\n";
|
|
echo "</tr>\n";
|
|
|
|
echo "<tr>\n";
|
|
echo " <td colspan=\"2\">".i18n("Highest post-secondary degree")."</td>";
|
|
echo " <td colspan=\"2\"><input onchange=\"fieldChanged()\" type=\"text\" name=\"highest_psd\" size=\"35\" value=\"$judgeinfo->highest_psd\" /></td>\n";
|
|
echo "</tr>\n";
|
|
|
|
echo "<tr>\n";
|
|
echo " <td colspan=\"2\">".i18n("Other professional qualifications")."</td>";
|
|
echo " <td colspan=\"2\"><input onchange=\"fieldChanged()\" type=\"text\" name=\"professional_quals\" size=\"35\" value=\"$judgeinfo->professional_quals\" /></td>\n";
|
|
echo "</tr>\n";
|
|
|
|
echo "<tr>\n";
|
|
echo " <td colspan=\"2\">".i18n("I can judge in the following languages")."</td>";
|
|
echo " <td colspan=\"2\">";
|
|
|
|
//grab the current languages that are selected
|
|
$currentlanguages=array();
|
|
$q=mysql_query("SELECT languages_lang FROM judges_languages WHERE judges_id='".$_SESSION['judges_id']."'");
|
|
while($r=mysql_fetch_object($q))
|
|
{
|
|
$currentlanguages[]=$r->languages_lang;
|
|
}
|
|
|
|
$q=mysql_query("SELECT * FROM languages WHERE active='Y' ORDER BY langname");
|
|
while($r=mysql_fetch_object($q))
|
|
{
|
|
if(in_array($r->lang,$currentlanguages)) $ch="checked=\"checked\""; else $ch="";
|
|
|
|
echo "<input onclick=\"fieldChanged()\" $ch type=\"checkbox\" name=\"languages[]\" value=\"$r->lang\" /> $r->langname <br />";
|
|
}
|
|
|
|
echo " </td>\n";
|
|
echo "</tr>\n";
|
|
|
|
echo "<tr>\n";
|
|
echo " <td colspan=\"2\">".i18n("Years of judging experience at school/local level")."</td>\n";
|
|
echo " <td colspan=\"2\"><input onchange=\"fieldChanged()\" 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>\n";
|
|
echo " <td colspan=\"2\"><input onchange=\"fieldChanged()\" 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>\n";
|
|
echo " <td colspan=\"2\"><input onchange=\"fieldChanged()\" 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>\n";
|
|
echo " <td colspan=\"2\">";
|
|
if($judgeinfo->willing_chair=="no") $ch="checked=\"checked\""; else $ch="";
|
|
echo "<input onclick=\"fieldChanged()\" $ch type=\"radio\" name=\"willing_chair\" value=\"no\" />No";
|
|
echo " ";
|
|
if($judgeinfo->willing_chair=="yes") $ch="checked=\"checked\""; else $ch="";
|
|
echo "<input onclick=\"fieldChanged()\" $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>\n";
|
|
echo " <td colspan=\"2\">";
|
|
if($judgeinfo->attending_lunch=="no") $ch="checked=\"checked\""; else $ch="";
|
|
echo "<input onclick=\"fieldChanged()\" $ch type=\"radio\" name=\"attending_lunch\" value=\"no\" />No";
|
|
echo " ";
|
|
if($judgeinfo->attending_lunch=="yes") $ch="checked=\"checked\""; else $ch="";
|
|
echo "<input onclick=\"fieldChanged()\" $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>";
|
|
|
|
echo "<br />";
|
|
echo "<a onclick=\"return confirmChanges();\" href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
|
|
|
send_footer();
|
|
?>
|