forked from science-ation/science-ation
- Move the judging age preferences to the expertise page... and rename that
page to "Divisional Preferences" - Add the ability for the judges to select special awards they would like to judge - Add the ability for a judge to specify that they are a judge for a specific (one or more) award, and disable the divisional selection for them
This commit is contained in:
parent
49c5704143
commit
50b4e146bd
@ -1 +1 @@
|
|||||||
39
|
40
|
||||||
|
16
db/db.update.40.sql
Normal file
16
db/db.update.40.sql
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
ALTER TABLE `judges` ADD `typepref` VARCHAR( 8 ) NOT NULL ;
|
||||||
|
|
||||||
|
INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year` ) VALUES ( 'judges_specialaward_enable', 'no', 'Judge Registration', 'yesno', '', '1000', 'Allow judges to specify their special award judging preferences (in addition to the divisional judging preferences)', '-1');
|
||||||
|
INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year` ) VALUES ( 'judges_specialaward_only_enable', 'no', 'Judge Registration', 'yesno', '', '1100', 'Allow judges to specify that they are a judge for a specific special award. If a judge selects this, it disables their divisional preference selection entirely', '-1');
|
||||||
|
INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year` ) VALUES ( 'judges_specialaward_min', '1', 'Judge Registration', 'number', '', '1200', 'Minimum number of special awards a judge must select when specifying special award preferences', '-1');
|
||||||
|
INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year` ) VALUES ( 'judges_specialaward_max', '6', 'Judge Registration', 'number', '', '1300', 'Maximum number of special awards a judge must select when specifying special award preferences', '-1');
|
||||||
|
|
||||||
|
CREATE TABLE `judges_specialaward_sel` (
|
||||||
|
`id` INT NOT NULL AUTO_INCREMENT,
|
||||||
|
`judges_id` INT NOT NULL ,
|
||||||
|
`award_awards_id` INT NOT NULL ,
|
||||||
|
`year` INT NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = MyISAM ;
|
||||||
|
|
||||||
|
|
@ -57,6 +57,21 @@ function personalStatus()
|
|||||||
if($r->num==0)
|
if($r->num==0)
|
||||||
return "incomplete";
|
return "incomplete";
|
||||||
|
|
||||||
|
|
||||||
|
//if it made it through without returning incomplete, then we must be complete
|
||||||
|
return "complete";
|
||||||
|
}
|
||||||
|
|
||||||
|
function expertiseStatus()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
/* If the judging special awards are active, and the judge has
|
||||||
|
* selected "I am a special awards judge", then disable this */
|
||||||
|
if($config['judges_specialaward_only_enable'] == 'yes') {
|
||||||
|
return "complete";
|
||||||
|
}
|
||||||
|
|
||||||
//and they need to rank all of the age categories
|
//and they need to rank all of the age categories
|
||||||
$q=mysql_query("SELECT COUNT(id) AS num FROM projectcategories WHERE year='".$config['FAIRYEAR']."'");
|
$q=mysql_query("SELECT COUNT(id) AS num FROM projectcategories WHERE year='".$config['FAIRYEAR']."'");
|
||||||
$r=mysql_fetch_object($q);
|
$r=mysql_fetch_object($q);
|
||||||
@ -69,15 +84,6 @@ function personalStatus()
|
|||||||
if($numcats!=$numprefs)
|
if($numcats!=$numprefs)
|
||||||
return "incomplete";
|
return "incomplete";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//if it made it through without returning incomplete, then we must be complete
|
|
||||||
return "complete";
|
|
||||||
}
|
|
||||||
|
|
||||||
function expertiseStatus()
|
|
||||||
{
|
|
||||||
global $config;
|
|
||||||
//easiest check here is to check the number of divisions, then check the number of entries
|
//easiest check here is to check the number of divisions, then check the number of entries
|
||||||
//that they have in the judges_expertise table. If they are the same, then we're good to go
|
//that they have in the judges_expertise table. If they are the same, then we're good to go
|
||||||
//if they are different, they forgot to fill one out (because it only gets inserted if a value)
|
//if they are different, they forgot to fill one out (because it only gets inserted if a value)
|
||||||
@ -95,8 +101,47 @@ function expertiseStatus()
|
|||||||
return "complete";
|
return "complete";
|
||||||
else
|
else
|
||||||
return "incomplete";
|
return "incomplete";
|
||||||
|
}
|
||||||
|
|
||||||
|
function specialawardStatus()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
/* Complete if:
|
||||||
|
* - judge has selected (none) "no special award preferences"
|
||||||
|
* - judge has selected (pref) "i would like to specify awards", and has
|
||||||
|
* selected between min and max preferences
|
||||||
|
* - judge has selected "i am a special awards judge, and has
|
||||||
|
* selected an award */
|
||||||
|
|
||||||
|
$q = mysql_query("SELECT typepref FROM judges WHERE
|
||||||
|
id='{$_SESSION['judges_id']}'");
|
||||||
|
$r = mysql_fetch_object($q);
|
||||||
|
if($r != 1) return "incomplete";
|
||||||
|
|
||||||
|
$qq = mysql_query("SELECT COUNT(id) AS num FROM judges_specialaward_sel
|
||||||
|
WHERE judges_id='{$_SESSION['judges_id']}'
|
||||||
|
AND year={$config['FAIRYEAR']}");
|
||||||
|
$rr = mysql_fetch_object($qq);
|
||||||
|
$awards_selected = $rr->num;
|
||||||
|
|
||||||
|
switch($r->typepref) {
|
||||||
|
case "speconly": /* Judge for special award */
|
||||||
|
/* They may judge more than one award, so don't limit them
|
||||||
|
* to one */
|
||||||
|
if($awards_selected >= 1) return "complete";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "pref": /* Special award preferences specified */
|
||||||
|
default:
|
||||||
|
if( ($awards_selected >= $config['judges_specialaward_min'])
|
||||||
|
&&($awards_selected <= $config['judges_specialaward_max']) ){
|
||||||
|
return "complete";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "incomplete";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
include "register_judges.inc.php";
|
include "register_judges.inc.php";
|
||||||
|
|
||||||
//send the header
|
//send the header
|
||||||
send_header("Judges Registration - Areas of Expertise Information");
|
send_header("Judges Registration - Divisional Judging Preferences");
|
||||||
|
|
||||||
echo "<a onclick=\"return confirmChanges();\" href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
echo "<a onclick=\"return confirmChanges();\" href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
@ -60,7 +60,19 @@
|
|||||||
{
|
{
|
||||||
mysql_query("UPDATE judges SET expertise_other=NULL WHERE id='".$_SESSION['judges_id']."'");
|
mysql_query("UPDATE judges SET expertise_other=NULL WHERE id='".$_SESSION['judges_id']."'");
|
||||||
}
|
}
|
||||||
echo notice(i18n("Areas of Expertise successfully saved"));
|
|
||||||
|
mysql_query("DELETE FROM judges_catpref WHERE judges_id='".$_SESSION['judges_id']."'");
|
||||||
|
|
||||||
|
if(is_array($_POST['catpref']))
|
||||||
|
{
|
||||||
|
foreach($_POST['catpref'] AS $k=>$v)
|
||||||
|
{
|
||||||
|
if($v!="")
|
||||||
|
mysql_query("INSERT INTO judges_catpref (judges_id,projectcategories_id,rank,year) values ('".$_SESSION['judges_id']."','$k','$v','".$config['FAIRYEAR']."')");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo notice(i18n("Preferences successfully saved"));
|
||||||
}
|
}
|
||||||
$q=mysql_query("SELECT * FROM judges WHERE email='".$_SESSION['email']."' AND id='".$_SESSION['judges_id']."'");
|
$q=mysql_query("SELECT * FROM judges WHERE email='".$_SESSION['email']."' AND id='".$_SESSION['judges_id']."'");
|
||||||
$judgeinfo=mysql_fetch_object($q);
|
$judgeinfo=mysql_fetch_object($q);
|
||||||
@ -70,15 +82,57 @@
|
|||||||
$newstatus=expertiseStatus();
|
$newstatus=expertiseStatus();
|
||||||
if($newstatus!="complete")
|
if($newstatus!="complete")
|
||||||
{
|
{
|
||||||
echo error(i18n("Areas of Expertise Information Incomplete"));
|
echo error(i18n("Divisional Judging Information Incomplete"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo happy(i18n("Areas of Expertise Information Complete"));
|
echo happy(i18n("Divisional Judging Information Complete"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($judgeinfo->typepref == "speconly") {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
echo "<form name=\"expertiseform\" method=\"post\" action=\"register_judges_expertise.php\">\n";
|
echo "<form name=\"expertiseform\" method=\"post\" action=\"register_judges_expertise.php\">\n";
|
||||||
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
||||||
|
|
||||||
|
$q=mysql_query("SELECT * FROM judges_catpref WHERE judges_id='".$_SESSION['judges_id']."' AND year='".$config['FAIRYEAR']."'");
|
||||||
|
$catprefs=array();
|
||||||
|
while($r=mysql_fetch_object($q))
|
||||||
|
$catprefs[$r->projectcategories_id]=$r->rank;
|
||||||
|
|
||||||
|
$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($catprefs[$r->id]==$val && $catprefs[$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 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 "<br />";
|
echo "<br />";
|
||||||
@ -94,7 +148,7 @@ else
|
|||||||
else if($r->projectsubdivisions_id)
|
else if($r->projectsubdivisions_id)
|
||||||
$subexpertise[$r->projectsubdivisions_id]=$r->val;
|
$subexpertise[$r->projectsubdivisions_id]=$r->val;
|
||||||
}
|
}
|
||||||
echo "<table>\n";
|
// echo "<table>\n";
|
||||||
|
|
||||||
|
|
||||||
//query all of the categories
|
//query all of the categories
|
||||||
@ -150,7 +204,7 @@ else
|
|||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
|
|
||||||
echo "<input type=\"submit\" value=\"".i18n("Save Areas of Expertise Information")."\" />\n";
|
echo "<input type=\"submit\" value=\"".i18n("Save Judging Preferences")."\" />\n";
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo "<a onclick=\"return confirmChanges();\" href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
echo "<a onclick=\"return confirmChanges();\" href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
||||||
|
@ -127,6 +127,21 @@
|
|||||||
if($statusexpertise!="complete") $overallstatus="incomplete";
|
if($statusexpertise!="complete") $overallstatus="incomplete";
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
|
|
||||||
|
// special awards
|
||||||
|
if($config['judges_specialaward_enable'] == 'yes') {
|
||||||
|
echo "<tr><td>";
|
||||||
|
echo "<a href=\"register_judges_specialawards.php\">";
|
||||||
|
echo i18n("Special Award Preferences");
|
||||||
|
echo "</a>";
|
||||||
|
echo "</td><td>";
|
||||||
|
//check to see if its complete
|
||||||
|
$statusspecialawards=specialawardStatus();
|
||||||
|
echo outputStatus($statusspecialawards);
|
||||||
|
if($statusspecialawards!="complete") $overallstatus="incomplete";
|
||||||
|
echo "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
echo "<tr><td colspan=\"2\"><hr></td></tr>";
|
echo "<tr><td colspan=\"2\"><hr></td></tr>";
|
||||||
echo "<tr><td>".i18n("Overall Status")."</td><td>";
|
echo "<tr><td>".i18n("Overall Status")."</td><td>";
|
||||||
echo outputStatus($overallstatus);
|
echo outputStatus($overallstatus);
|
||||||
|
@ -49,7 +49,8 @@
|
|||||||
"phonecell='".mysql_escape_string(stripslashes($_POST['phonecell']))."', ".
|
"phonecell='".mysql_escape_string(stripslashes($_POST['phonecell']))."', ".
|
||||||
"organization='".mysql_escape_string(stripslashes($_POST['organization']))."', ".
|
"organization='".mysql_escape_string(stripslashes($_POST['organization']))."', ".
|
||||||
"highest_psd='".mysql_escape_string(stripslashes($_POST['highest_psd']))."', ".
|
"highest_psd='".mysql_escape_string(stripslashes($_POST['highest_psd']))."', ".
|
||||||
"professional_quals='".mysql_escape_string(stripslashes($_POST['professional_quals']))."' ".
|
"professional_quals='".mysql_escape_string(stripslashes($_POST['professional_quals']))."', ".
|
||||||
|
"typepref='".mysql_escape_string(stripslashes($_POST['typepref']))."' ".
|
||||||
"WHERE id='".$_SESSION['judges_id']."'");
|
"WHERE id='".$_SESSION['judges_id']."'");
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
|
|
||||||
@ -69,17 +70,6 @@
|
|||||||
questions_save_answers('judgereg', $_SESSION['judges_id'],
|
questions_save_answers('judgereg', $_SESSION['judges_id'],
|
||||||
$config['FAIRYEAR'], $ans);
|
$config['FAIRYEAR'], $ans);
|
||||||
|
|
||||||
mysql_query("DELETE FROM judges_catpref WHERE judges_id='".$_SESSION['judges_id']."'");
|
|
||||||
|
|
||||||
if(is_array($_POST['catpref']))
|
|
||||||
{
|
|
||||||
foreach($_POST['catpref'] AS $k=>$v)
|
|
||||||
{
|
|
||||||
if($v!="")
|
|
||||||
mysql_query("INSERT INTO judges_catpref (judges_id,projectcategories_id,rank,year) values ('".$_SESSION['judges_id']."','$k','$v','".$config['FAIRYEAR']."')");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo notice(i18n("%1 %2 successfully updated",array($_POST['firstname'],$_POST['lastname'])));
|
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']."'");
|
$q=mysql_query("SELECT * FROM judges WHERE email='".$_SESSION['email']."' AND id='".$_SESSION['judges_id']."'");
|
||||||
@ -130,43 +120,17 @@ echo " <td>".i18n("Organization")."</td><td><input onchange=\"fieldChanged()\" t
|
|||||||
echo " <td>".i18n("Phone (Cell)")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"phonecell\" value=\"$judgeinfo->phonecell\" /></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>";
|
||||||
|
|
||||||
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
|
|
||||||
|
|
||||||
echo "<tr>\n";
|
if($config['judges_specialaward_only_enable'] == 'yes') {
|
||||||
echo " <td colspan=\"4\"><b>".i18n("Age category preferences")."</b></td>";
|
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
|
||||||
|
echo "<tr>\n";
|
||||||
$q=mysql_query("SELECT * FROM judges_catpref WHERE judges_id='".$_SESSION['judges_id']."' AND year='".$config['FAIRYEAR']."'");
|
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>";
|
||||||
$catprefs=array();
|
if($judgeinfo->typepref == "speconly") $ch = "checked=checked";
|
||||||
while($r=mysql_fetch_object($q))
|
else $ch="";
|
||||||
$catprefs[$r->projectcategories_id]=$r->rank;
|
echo " <td colspan=\"2\"><input $ch type=\"checkbox\" name=\"typepref\" value=\"speconly\" />";
|
||||||
|
echo " </td>";
|
||||||
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY mingrade");
|
echo "</tr>\n";
|
||||||
echo "<tr><td colspan=\"4\">";
|
|
||||||
echo "<table>";
|
|
||||||
//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 "<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($catprefs[$r->id]==$val && $catprefs[$r->id]!="") $sel="selected=\"selected\""; else $sel="";
|
|
||||||
echo "<option $sel value=\"$val\">".i18n($str)."</option>\n";
|
|
||||||
}
|
|
||||||
echo "</select>".REQUIREDFIELD;
|
|
||||||
|
|
||||||
echo "</td>";
|
|
||||||
echo "</tr>";
|
|
||||||
}
|
}
|
||||||
//echo "</select>";
|
|
||||||
echo "</table>";
|
|
||||||
echo "</td></tr>";
|
|
||||||
|
|
||||||
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
|
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user