forked from science-ation/science-ation
204 lines
6.2 KiB
PHP
204 lines
6.2 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');
|
|
|
|
if($_SESSION['embed'] == true) {
|
|
$u = user_load($_SESSION['embed_edit_id']);
|
|
} else {
|
|
$u = user_load($_SESSION['users_id']);
|
|
}
|
|
|
|
|
|
if($_POST['action']=="save")
|
|
{
|
|
if(!is_array($_POST['division']))
|
|
$_POST['division']=array();
|
|
if(!is_array($_POST['subdivision']))
|
|
$_POST['subdivision']=array();
|
|
|
|
$u['div_prefs'] = array();
|
|
foreach($_POST['division'] AS $key=>$val)
|
|
$u['div_prefs'][$key] = $val;
|
|
|
|
$u['div_prefs_sub'] = array();
|
|
foreach($_POST['subdivision'] AS $key=>$val)
|
|
$u['div_prefs_sub'][$key] = $val;
|
|
|
|
if($_POST['expertise_other'])
|
|
$u['expertise_other'] = stripslashes($_POST['expertise_other']);
|
|
else
|
|
$u['expertise_other'] = NULL;
|
|
|
|
$u['cat_prefs'] = array();
|
|
if(is_array($_POST['catpref'])) {
|
|
foreach($_POST['catpref'] AS $k=>$v) {
|
|
if($v == '') continue;
|
|
|
|
$u['cat_prefs'][$k] = $v;
|
|
}
|
|
}
|
|
user_save($u);
|
|
message_push(notice(i18n("Preferences successfully saved")));
|
|
$u = user_load($u['id']);
|
|
}
|
|
|
|
if($_SESSION['embed'] == true) {
|
|
echo "<br />";
|
|
display_messages();
|
|
// echo "<h3>".i18n('Category and Division Preferences')."</h3>";
|
|
echo "<br />";
|
|
} else {
|
|
//send the header
|
|
send_header('Category and Division Preferences',
|
|
array('Judge Registration' => 'judge_main.php')
|
|
);
|
|
}
|
|
|
|
judge_status_update($u);
|
|
|
|
if($_SESSION['embed'] != true) {
|
|
//output the current status
|
|
$newstatus=judge_status_expertise($u);
|
|
if($newstatus!="complete")
|
|
echo error(i18n("Divisional Judging Information Incomplete"));
|
|
else
|
|
echo happy(i18n("Divisional Judging Information Complete"));
|
|
}
|
|
|
|
if($u['special_award_only'] == 'yes') {
|
|
echo i18n("You have specified that you are a judge for a specific special award. Divisional Judging preferences have been disabled because they do not apply to you.");
|
|
echo "<br />";
|
|
send_footer();
|
|
exit;
|
|
}
|
|
|
|
if($_SESSION['embed'] == true) {
|
|
echo "<form name=\"expertiseform\" method=\"post\" action=\"{$_SESSION['embed_submit_url']}\">\n";
|
|
} else {
|
|
echo "<form name=\"expertiseform\" method=\"post\" action=\"judge_expertise.php\">\n";
|
|
}
|
|
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
|
|
|
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY mingrade");
|
|
echo "<h3>".i18n("Age Category Preferences")."</h3><br>";
|
|
echo "<table>";
|
|
while($r=mysql_fetch_object($q))
|
|
{
|
|
echo "<tr><td> ";
|
|
echo i18n("%1 (Grades %2-%3)",array(i18n($r->category),$r->mingrade,$r->maxgrade));
|
|
echo "</td>";
|
|
echo "<td>";
|
|
echo "<select name=\"catpref[$r->id]\">";
|
|
echo "<option value=\"\">".i18n("Choose")."</option>\n";
|
|
foreach($preferencechoices AS $val=>$str)
|
|
{
|
|
if($u['cat_prefs'][$r->id]==$val && $u['cat_prefs'][$r->id]!="")
|
|
$sel="selected=\"selected\"";
|
|
else
|
|
$sel="";
|
|
echo "<option $sel value=\"$val\">".i18n($str)."</option>\n";
|
|
}
|
|
echo "</select>".REQUIREDFIELD;
|
|
|
|
echo "</td>";
|
|
echo "</tr>";
|
|
}
|
|
echo "</table>";
|
|
echo "<br />";
|
|
echo "<br />";
|
|
echo "<h3>".i18n("Division Expertise")."</h3><br>";
|
|
echo "<table>";
|
|
|
|
|
|
|
|
echo i18n("Please rank the following divisions according to the amount of knowledge you have of each subject. A '1' indicates very little knowledge, and a '5' indicates you are very knowledgeable of the subject");
|
|
echo "<br />";
|
|
echo "<br />";
|
|
echo i18n("Once you save, any division that you specified as 3 or more might offer sub-divisions for you to choose from.");
|
|
echo "<br />";
|
|
echo "<br />";
|
|
|
|
// echo "<table>\n";
|
|
|
|
|
|
//query all of the categories
|
|
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY division");
|
|
$first = true;
|
|
while($r=mysql_fetch_object($q)) {
|
|
|
|
$trclass = ($trclass == 'odd') ? 'even' : 'odd';
|
|
if($first == true) {
|
|
echo "<tr><td></td><td colspan=\"2\">".i18n("Novice")."</td><td colspan=\"3\" align=\"right\">".i18n("Expert")."</td></tr>";
|
|
echo "<tr><th></th>";
|
|
for($x=1;$x<=5;$x++)
|
|
echo "<th>$x</th>";
|
|
echo "<th></th>";
|
|
echo "</tr>";
|
|
$first = false;
|
|
}
|
|
|
|
echo "<tr class=\"$trclass\"><td><b>".i18n($r->division)."</b></td>";
|
|
|
|
for($x=1;$x<=5;$x++) {
|
|
$sel = ($u['div_prefs'][$r->id]==$x) ? "checked=\"checked\"" : '';
|
|
echo "<td width=\"30\"><input onclick=\"fieldChanged()\" $sel type=\"radio\" name=\"division[$r->id]\" value=\"$x\" /></td>";
|
|
}
|
|
echo "<td width=\"100\"></td>";
|
|
echo "</tr>";
|
|
|
|
//only show the sub-divisions if the 'main' division is scored >=3
|
|
if($u['div_prefs'][$r->id]>=3) {
|
|
|
|
$subq=mysql_query("SELECT * FROM projectsubdivisions WHERE projectdivisions_id='$r->id' AND year='".$config['FAIRYEAR']."' ORDER BY subdivision");
|
|
while($subr=mysql_fetch_object($subq)) {
|
|
echo "<tr>";
|
|
echo "<td> </td>";
|
|
$ch = ($u['div_prefs_sub'][$subr->id]) ? "checked=\"checked\"" : '';
|
|
|
|
echo "<td><input onclick=\"fieldChanged()\" $ch type=\"checkbox\" name=\"subdivision[$subr->id]\" value=\"1\" /></td>";
|
|
echo "<td colspan=\"5\">";
|
|
echo "$subr->subdivision";
|
|
echo "</td>";
|
|
echo "</tr>";
|
|
}
|
|
}
|
|
}
|
|
echo "</table>";
|
|
echo "<br />";
|
|
echo "<h3>".i18n("Other Areas of Expertise not listed above")."</h3>";
|
|
echo "<textarea name=\"expertise_other\" rows=\"4\" cols=\"60\">".htmlspecialchars($u['expertise_other'])."</textarea>";
|
|
echo "<br />";
|
|
echo "<br />";
|
|
|
|
echo "<input type=\"submit\" value=\"".i18n("Save Judging Preferences")."\" />\n";
|
|
echo "</form>";
|
|
|
|
|
|
if($_SESSION['embed'] != true) send_footer();
|
|
|
|
?>
|