2005-01-24 18:00:03 +00:00
< ?
/*
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 .
*/
?>
2004-12-19 23:16:46 +00:00
< ?
require ( " common.inc.php " );
include " register_judges.inc.php " ;
//send the header
send_header ( " Judges Registration - Areas of Expertise Information " );
2005-02-21 23:07:10 +00:00
echo " <a onclick= \" return confirmChanges(); \" href= \" register_judges_main.php \" ><< " . i18n ( " Back to Judges Registration Summary " ) . " </a><br /> " ;
2004-12-19 23:16:46 +00:00
echo " <br /> " ;
if ( $_POST [ 'action' ] == " save " )
{
//first delete all their old associations for this year..
mysql_query ( " DELETE FROM judges_expertise WHERE judges_id=' " . $_SESSION [ 'judges_id' ] . " ' AND year=' " . $config [ 'FAIRYEAR' ] . " ' " );
2004-12-20 19:46:08 +00:00
if ( ! is_array ( $_POST [ 'division' ]))
$_POST [ 'division' ] = array ();
if ( ! is_array ( $_POST [ 'subdivision' ]))
$_POST [ 'subdivision' ] = array ();
2004-12-19 23:16:46 +00:00
foreach ( $_POST [ 'division' ] AS $key => $val )
{
mysql_query ( " INSERT INTO judges_expertise (judges_id, projectdivisions_id, val, year) VALUES (' " . $_SESSION [ 'judges_id' ] . " ',' $key ',' $val ',' " . $config [ 'FAIRYEAR' ] . " ') " );
}
2004-12-20 19:46:08 +00:00
foreach ( $_POST [ 'subdivision' ] AS $key => $val )
{
mysql_query ( " INSERT INTO judges_expertise (judges_id, projectsubdivisions_id, val, year) VALUES (' " . $_SESSION [ 'judges_id' ] . " ',' $key ',' $val ',' " . $config [ 'FAIRYEAR' ] . " ') " );
}
2005-02-11 18:25:59 +00:00
if ( $_POST [ 'expertise_other' ])
{
mysql_query ( " UPDATE judges SET expertise_other=' " . mysql_escape_string ( stripslashes ( $_POST [ 'expertise_other' ])) . " ' WHERE id=' " . $_SESSION [ 'judges_id' ] . " ' " );
2004-12-20 19:46:08 +00:00
2005-02-11 18:25:59 +00:00
}
else
{
mysql_query ( " UPDATE judges SET expertise_other=NULL WHERE id=' " . $_SESSION [ 'judges_id' ] . " ' " );
}
2004-12-19 23:16:46 +00:00
echo notice ( i18n ( " Areas of Expertise successfully saved " ));
}
$q = mysql_query ( " SELECT * FROM judges WHERE email=' " . $_SESSION [ 'email' ] . " ' AND id=' " . $_SESSION [ 'judges_id' ] . " ' " );
$judgeinfo = mysql_fetch_object ( $q );
2005-03-10 19:43:49 +00:00
updateJudgeCompleteStatus ( $judgeinfo );
2004-12-19 23:16:46 +00:00
//output the current status
$newstatus = expertiseStatus ();
if ( $newstatus != " complete " )
{
echo error ( i18n ( " Areas of Expertise Information Incomplete " ));
}
else
{
2005-02-21 23:07:10 +00:00
echo happy ( i18n ( " Areas of Expertise Information Complete " ));
2004-12-19 23:16:46 +00:00
}
echo " <form name= \" expertiseform \" method= \" post \" action= \" register_judges_expertise.php \" > \n " ;
echo " <input type= \" hidden \" name= \" action \" value= \" save \" > \n " ;
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 /> " ;
2004-12-20 19:46:08 +00:00
echo i18n ( " Once you save, any division that you specified as 3 or more will offer sub-divisions for you to choose from. " );
echo " <br /> " ;
echo " <br /> " ;
2004-12-19 23:16:46 +00:00
$q = mysql_query ( " SELECT * FROM judges_expertise WHERE judges_id=' " . $_SESSION [ 'judges_id' ] . " ' AND year=' " . $config [ 'FAIRYEAR' ] . " ' " );
while ( $r = mysql_fetch_object ( $q ))
{
2004-12-20 19:46:08 +00:00
if ( $r -> projectdivisions_id )
$expertise [ $r -> projectdivisions_id ] = $r -> val ;
else if ( $r -> projectsubdivisions_id )
$subexpertise [ $r -> projectsubdivisions_id ] = $r -> val ;
2004-12-19 23:16:46 +00:00
}
echo " <table> \n " ;
//query all of the categories
$q = mysql_query ( " SELECT * FROM projectdivisions WHERE year=' " . $config [ 'FAIRYEAR' ] . " ' ORDER BY division " );
while ( $r = mysql_fetch_object ( $q ))
{
2005-02-21 22:40:02 +00:00
echo " <tr><td></td><td colspan= \" 2 \" > " . i18n ( " Novice " ) . " </td><td colspan= \" 3 \" align= \" right \" > " . i18n ( " Expert " ) . " </td></tr> " ;
2004-12-20 19:46:08 +00:00
echo " <tr><th></th> " ;
for ( $x = 1 ; $x <= 5 ; $x ++ )
echo " <th> $x </th> " ;
2005-02-11 18:25:59 +00:00
echo " <th></th> " ;
2004-12-20 19:46:08 +00:00
echo " </tr> " ;
echo " <tr><td><b> " . i18n ( $r -> division ) . " </b></td> " ;
2004-12-19 23:16:46 +00:00
for ( $x = 1 ; $x <= 5 ; $x ++ )
{
if ( $expertise [ $r -> id ] == $x ) $sel = " checked= \" checked \" " ; else $sel = " " ;
2005-02-21 23:07:10 +00:00
echo " <td width= \" 30 \" ><input onclick= \" fieldChanged() \" $sel type= \" radio \" name= \" division[ $r->id ] \" value= \" $x\ " /></ td > " ;
2004-12-19 23:16:46 +00:00
}
2005-02-11 18:25:59 +00:00
echo " <td width= \" 100 \" ></td> " ;
2004-12-19 23:16:46 +00:00
echo " </tr> " ;
2004-12-20 19:46:08 +00:00
2004-12-20 19:48:13 +00:00
//only show the sub-divisions if the 'main' division is scored >=3
2004-12-20 19:46:08 +00:00
if ( $expertise [ $r -> id ] >= 3 )
{
2006-02-07 20:54:30 +00:00
$subq = mysql_query ( " SELECT * FROM projectsubdivisions WHERE projectdivisions_id=' $r->id ' AND year=' " . $config [ 'FAIRYEAR' ] . " ' ORDER BY subdivision " );
2004-12-20 19:46:08 +00:00
while ( $subr = mysql_fetch_object ( $subq ))
{
echo " <tr> " ;
echo " <td> </td> " ;
if ( $subexpertise [ $subr -> id ]) $ch = " checked= \" checked \" " ; else $ch = " " ;
2005-02-21 23:07:10 +00:00
echo " <td><input onclick= \" fieldChanged() \" $ch type= \" checkbox \" name= \" subdivision[ $subr->id ] \" value= \" 1 \" /></td> " ;
2005-02-11 18:25:59 +00:00
echo " <td colspan= \" 5 \" > " ;
2004-12-20 19:46:08 +00:00
echo " $subr->subdivision " ;
echo " </td> " ;
echo " </tr> " ;
}
}
2005-02-11 18:25:59 +00:00
echo " <tr><td colspan= \" 7 \" > </td></tr> " ;
2004-12-20 19:46:08 +00:00
2004-12-19 23:16:46 +00:00
}
echo " </table> " ;
echo " <br /> " ;
2005-02-11 18:25:59 +00:00
echo " <h3>Other Areas of Expertise not listed above</h3> " ;
$q = mysql_query ( " SELECT expertise_other FROM judges WHERE id=' " . $_SESSION [ 'judges_id' ] . " ' " );
$judgeinfo = mysql_fetch_object ( $q );
echo " <textarea name= \" expertise_other \" rows= \" 4 \" cols= \" 60 \" > " . htmlspecialchars ( $judgeinfo -> expertise_other ) . " </textarea> " ;
echo " <br /> " ;
echo " <br /> " ;
2004-12-19 23:16:46 +00:00
echo " <input type= \" submit \" value= \" " . i18n ( " Save Areas of Expertise Information " ) . " \" /> \n " ;
echo " </form> " ;
2005-02-16 18:21:32 +00:00
echo " <br /> " ;
2005-02-21 23:07:10 +00:00
echo " <a onclick= \" return confirmChanges(); \" href= \" register_judges_main.php \" ><< " . i18n ( " Back to Judges Registration Summary " ) . " </a><br /> " ;
2004-12-19 23:16:46 +00:00
send_footer ();
?>