science-ation/judge_other.php

166 lines
5.6 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');
require_once("questions.inc.php");
$u = user_load($_SESSION['users_id'], true);
//send the header
$type = $_SESSION['users_type'];
send_header('Other Information',
array('Judge Registration' => 'judge_main.php')
);
if($_POST['action']=="save")
{
if(!is_array($_POST['division']))
$_POST['division']=array();
if(!is_array($_POST['subdivision']))
$_POST['subdivision']=array();
$u['divprefs'] = array();
foreach($_POST['division'] AS $key=>$val)
$u['divprefs'][$key] = $val;
$u['divprefs_sub'] = array();
foreach($_POST['subdivision'] AS $key=>$val)
$u['divprefs_sub'][$key] = $val;
if($_POST['other_other'])
$u['other_other'] = stripslashes($_POST['other_other']);
else
$u['other_other'] = NULL;
$u['catprefs'] = array();
if(is_array($_POST['catpref'])) {
foreach($_POST['catpref'] AS $k=>$v) {
if($v == '') continue;
$u['catprefs'][$k] = $v;
}
}
user_save($u);
message_push(notice(i18n("Preferences successfully saved")));
$u = user_load($_SESSION['users_id'], true);
}
// updateJudgeCompleteStatus($judgeinfo);
//output the current status
$newstatus=judge_status_other($u);
if($newstatus!="complete")
echo error(i18n("Other Information Incomplete"));
else
echo happy(i18n("Other Information Complete"));
echo "<form name=\"otherform\" method=\"post\" action=\"judge_other.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
echo "<table>\n";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("I can judge in the following languages")." ".REQUIREDFIELD."</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";
if($config['judges_specialaward_only_enable'] == 'yes') {
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("I am a judge for a specific special award")."<br /><font size=-1>(".i18n("Check this box if you are supposed to judge a specific special award, and please select that award on the Special Award Preferences page.").")</font></td>";
if($judgeinfo->typepref == "speconly") $ch = "checked=checked";
else $ch="";
echo " <td colspan=\"2\"><input $ch type=\"checkbox\" name=\"typepref\" value=\"speconly\" />";
echo " </td>";
echo "</tr>\n";
}
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Years of judging experience at a School level:")."</td>";
echo " <td colspan=\"2\"><input onchange=\"fieldChanged()\" type=\"text\" name=\"years_school\" size=\"5\" value=\"{$u['years_school']}\" /></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Years of judging experience at a Regional level:")."</td>";
echo " <td colspan=\"2\"><input onchange=\"fieldChanged()\" type=\"text\" name=\"years_regional\" size=\"5\" value=\"{$u['years_regional']}\" /></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"2\">".i18n("Years of judging experience at a National level:")."</td>";
echo " <td colspan=\"2\"><input onchange=\"fieldChanged()\" type=\"text\" name=\"years_national\" size=\"5\" value=\"{$u['years_national']}\" /></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";
questions_print_answer_editor('judgereg',
$_SESSION['judges_id'], $config['FAIRYEAR'], 'questions');
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 "</table>";
echo "<br />";
echo "<br />";
echo "<input type=\"submit\" value=\"".i18n("Save Information")."\" />\n";
echo "</form>";
send_footer();
?>