forked from science-ation/science-ation
Get age category preference from judges as they register
Create scheduler configuration page to handle setup parameters for the automatic judge team assignments Create the annealer to handle the actual assignments of judges to judging teams based on the lowest cost function of each individual team. Currently takes into account: a) age category preference, b) divisional areas of expertise. still requires: years of experience, language preference, and 'team captain' scheduling.
This commit is contained in:
parent
33cb624154
commit
44a79493aa
@ -69,6 +69,7 @@ function getJudgingTeams()
|
||||
judges_teams_awards_link.award_awards_id=award_awards.id
|
||||
AND judges_teams_awards_link.judges_teams_id='$r->id'
|
||||
AND award_awards.award_types_id=award_types.id
|
||||
AND award_types.year='{$config['FAIRYEAR']}'
|
||||
ORDER BY
|
||||
name
|
||||
");
|
||||
@ -156,6 +157,7 @@ function getJudgingTeam($teamid)
|
||||
judges_teams_awards_link.award_awards_id=award_awards.id
|
||||
AND judges_teams_awards_link.judges_teams_id='$r->id'
|
||||
AND award_awards.award_types_id=award_types.id
|
||||
AND award_types.year='{$config['FAIRYEAR']}'
|
||||
ORDER BY
|
||||
name
|
||||
");
|
||||
|
@ -39,6 +39,9 @@
|
||||
echo "<a href=\"judges_timeslots.php\">".i18n("Manage Judging Timeslots")."</a><br />";
|
||||
echo "<a href=\"judges_teams_timeslots.php\">".i18n("Assign Timeslots to Judging Teams")."</a><br />";
|
||||
echo "<a href=\"judges_teams_projects.php\">".i18n("Assign Projects to Teams")."</a><br />";
|
||||
echo "<hr />";
|
||||
|
||||
echo "<a href=\"judges_schedulerconfig.php\">".i18n("Judging automatic scheduler")."</a><br />";
|
||||
|
||||
send_footer();
|
||||
|
||||
|
@ -27,16 +27,24 @@
|
||||
//thus, we do not need the normal header and footer
|
||||
require("../common.inc.php");
|
||||
auth_required('admin');
|
||||
|
||||
$preferencechoices=array(
|
||||
-2=>"Very Low",
|
||||
-1=>"Low",
|
||||
0=>"Indifferent",
|
||||
1=>"Medium",
|
||||
2=>"High"
|
||||
);
|
||||
|
||||
|
||||
if($_GET['id'])
|
||||
{
|
||||
//include "../register_judges.inc.php";
|
||||
|
||||
$q=mysql_query("SELECT
|
||||
judges.*,
|
||||
projectcategories.category AS catpref_name,
|
||||
projectdivisions.division AS divpref_name
|
||||
judges.*
|
||||
FROM
|
||||
judges
|
||||
LEFT JOIN projectcategories ON judges.catpref=projectcategories.id
|
||||
LEFT JOIN projectdivisions ON judges.divpref=projectdivisions.id
|
||||
WHERE
|
||||
judges.id='".$_GET['id']."'");
|
||||
echo mysql_error();
|
||||
@ -78,15 +86,16 @@
|
||||
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <th colspan=\"2\">".i18n("Age category preference")."</th><td colspan=\"2\">";
|
||||
echo "$judgeinfo->catpref_name";
|
||||
echo " <th valign=\"top\"colspan=\"2\">".i18n("Age category preference")."</th><td colspan=\"2\">";
|
||||
|
||||
$q=mysql_query("SELECT judges_catpref.*,projectcategories.category FROM judges_catpref,projectcategories WHERE judges_id='{$_GET['id']}' AND judges_catpref.year='".$config['FAIRYEAR']."' AND judges_catpref.projectcategories_id=projectcategories.id");
|
||||
echo mysql_error();
|
||||
while($r=mysql_fetch_object($q))
|
||||
echo i18n($r->category).": ".$preferencechoices[$r->rank]." <br />";
|
||||
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <th colspan=\"2\">".i18n("Division preference")."</th><td colspan=\"2\">";
|
||||
echo "$judgeinfo->divpref_name";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
@ -101,7 +110,7 @@
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <th colspan=\"2\">".i18n("Languages")."</th>";
|
||||
echo " <th colspan=\"2\" valign=\"top\">".i18n("Languages")."</th>";
|
||||
echo " <td colspan=\"2\">";
|
||||
|
||||
$q=mysql_query("SELECT languages_lang FROM judges_languages WHERE judges_id='$judgeinfo->id'");
|
||||
|
455
admin/judges_sa.php
Normal file
455
admin/judges_sa.php
Normal file
@ -0,0 +1,455 @@
|
||||
<?
|
||||
/*
|
||||
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");
|
||||
auth_required('admin');
|
||||
|
||||
function TRACE()
|
||||
{
|
||||
}
|
||||
function TRACE_R()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/* Given the team data, pick a judge, then pick a new team
|
||||
* for them */
|
||||
function pick_random_move(&$team)
|
||||
{
|
||||
//TRACE_R($team);
|
||||
/* Pick 2 random teams*/
|
||||
$tms = count($team);
|
||||
while(1) {
|
||||
$t1 = rand(0, $tms - 1);
|
||||
if(count($team[$t1]['judges']) > 0) break;
|
||||
}
|
||||
$t2 = rand(0, $tms - 2);
|
||||
if($t2 >= $t1) $t2++;
|
||||
|
||||
/* Pick a judge on team1 */
|
||||
$j1 = rand(0, count($team[$t1]['judges']) - 1);
|
||||
/* Pick a judge or the empty slot on team2 */
|
||||
$j2 = rand(0, count($team[$t2]['judges']));
|
||||
|
||||
if($j2 == count($team[$t2]['judges'])) {
|
||||
$j2 = -1;
|
||||
}
|
||||
|
||||
|
||||
TRACE("Random move: ($t1,$j1) ($t2,$j2)<br>");
|
||||
TRACE_R($team[$t1]['judges']);
|
||||
TRACE("<br>T2:");
|
||||
TRACE_R($team[$t2]['judges']);
|
||||
TRACE("<br>");
|
||||
/* The move is team1,judge1 <==> team2,judge2 */
|
||||
return array($t1, $j1, $t2, $j2);
|
||||
}
|
||||
|
||||
/* The cost function is:
|
||||
+ 200 * each judge below the min for each team
|
||||
+ 100 * each judge above the max for each team
|
||||
+ -20 * each level of preference away from the
|
||||
max level for each judge
|
||||
|
||||
( ex: if a judge has selected LS->2, PS->0, CS->-1
|
||||
then matching that judge with a:
|
||||
LS = -40,
|
||||
PS = 0,
|
||||
CS = -20,
|
||||
else = 0
|
||||
)
|
||||
*/
|
||||
|
||||
/* Compute the cost of adding a judge to a team */
|
||||
function compute_team_cost(&$teams, &$judges, $team_id)
|
||||
{
|
||||
$cost = 0;
|
||||
|
||||
$t =& $teams[$team_id];
|
||||
|
||||
/* Compute the over max / under min costs */
|
||||
$c = count($t['judges']);
|
||||
$min = ($c < $t['min']) ? $t['min'] - $c : 0;
|
||||
$max = ($c > $t['max']) ? $c - $t['max'] : 0;
|
||||
$cost += $min * 20;
|
||||
$cost += $max * 10;
|
||||
|
||||
// TRACE("Under min=$min, over max=$max<br>");
|
||||
|
||||
/* For each judge on the team, score their preferences */
|
||||
reset($t['judges']);
|
||||
while( list($key, $judge_id) = each($t['judges']) ) {
|
||||
$j = $judges[$judge_id];
|
||||
|
||||
/* Get the division, and see where it fits with this
|
||||
* judges preferences */
|
||||
$dpref = $j['divprefs'][$t['division']];
|
||||
$cpref = $j['catprefs'][$t['category']];
|
||||
|
||||
// TRACE("Judge $judge_id cp=$cpref, dp=$dpref<br>");
|
||||
|
||||
$cost += 2 * (-$dpref + 2);
|
||||
$cost += 2 * (-$cpref + 2);
|
||||
}
|
||||
|
||||
TRACE("Team $team_id, cost is $cost<br>");
|
||||
|
||||
return $cost;
|
||||
}
|
||||
|
||||
function compute_delta_cost(&$teams, &$judges, $move)
|
||||
{
|
||||
list($tid1, $jidx1, $tid2, $jidx2) = $move;
|
||||
|
||||
$t1 =& $teams[$tid1];
|
||||
$t2 =& $teams[$tid2];
|
||||
|
||||
$ja1 = $t1['judges'];
|
||||
$ja2 = $t2['judges'];
|
||||
|
||||
/* Turn the indexes into judge IDs */
|
||||
$jid1 = $t1['judges'][$jidx1];
|
||||
if($jidx2 == -1)
|
||||
$jid2 = -1;
|
||||
else
|
||||
$jid2 = $t2['judges'][$jidx2];
|
||||
|
||||
|
||||
$cost = 0;
|
||||
|
||||
/* Make new arrays for each judge list */
|
||||
$nj1 = array();
|
||||
for($x=0; $x<count($t1['judges']); $x++) {
|
||||
$id = $t1['judges'][$x];
|
||||
|
||||
if($x == $jidx1) {
|
||||
/* This is the index of the judge we're
|
||||
* supposed to swap (or remove) */
|
||||
if($jid2 != -1) $nj1[] = $jid2;
|
||||
} else {
|
||||
$nj1[] = $id;
|
||||
}
|
||||
}
|
||||
$t1['judges'] = $nj1;
|
||||
|
||||
$nj2 = array();
|
||||
for($x=0; $x<count($t2['judges']); $x++) {
|
||||
$id = $t2['judges'][$x];
|
||||
if($x == $jidx2) {
|
||||
/* if jidx2 is -1 we'll never get here, else
|
||||
* we might, meaning that this is where
|
||||
* we want to swap in the value from the first
|
||||
* array */
|
||||
$nj2[] = $jid1;
|
||||
} else {
|
||||
$nj2[] = $id;
|
||||
}
|
||||
}
|
||||
/* jidx2 may be -1 meaning that something was removed
|
||||
* from the first array, but not added back to this one,
|
||||
* do that now so we don't lose judges */
|
||||
if($jidx2 == -1) $nj2[] = $jid1;
|
||||
$t2['judges'] = $nj2;
|
||||
|
||||
/* Recompute the costs */
|
||||
$cost -= $t1['cost'];
|
||||
$cost -= $t2['cost'];
|
||||
$c1 = compute_team_cost($teams, $judges, $tid1);
|
||||
$c2 = compute_team_cost($teams, $judges, $tid2);
|
||||
$cost += $c1 + $c2;
|
||||
|
||||
TRACE("Team $tid1 cost {$t1['cost']} -> $c1<br>");
|
||||
TRACE("Team $tid2 cost {$t2['cost']} -> $c2<br>");
|
||||
TRACE("Delta = $cost<br>");
|
||||
|
||||
$t1['judges'] = $ja1;
|
||||
$t2['judges'] = $ja2;
|
||||
|
||||
return array($cost, array($nj1, $c1, $nj2, $c2)) ;
|
||||
}
|
||||
|
||||
function record_move(&$teams, $move, $movedata)
|
||||
{
|
||||
list($tid1, $jidx1, $tid2, $jidx2) = $move;
|
||||
list($judges1, $c1, $judges2, $c2) = $movedata;
|
||||
|
||||
$t1 =& $teams[$tid1];
|
||||
$t2 =& $teams[$tid2];
|
||||
|
||||
// TRACE_R($t1);
|
||||
|
||||
$t1['judges'] = $judges1;
|
||||
$t1['cost'] = $c1;
|
||||
$t2['judges'] = $judges2;
|
||||
$t2['cost'] = $c2;
|
||||
|
||||
TRACE("T1:");
|
||||
TRACE_R($t1['judges']);
|
||||
TRACE("<br>T2:");
|
||||
TRACE_R($t2['judges']);
|
||||
TRACE("<br>");
|
||||
|
||||
// TRACE_R($t1);
|
||||
// TRACE_R($t2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Inputs to annealer:
|
||||
* - data['min_per_team']
|
||||
* - 'max_per_team'
|
||||
* - 'teams' [division][category] = number of teams
|
||||
*
|
||||
* - judges
|
||||
*/
|
||||
function judges_assign_anneal($divisions, $categories, $judges, $data)
|
||||
{
|
||||
/* Create an array to hold the team data */
|
||||
$team = array();
|
||||
|
||||
|
||||
$t=0;
|
||||
reset($data['teams']);
|
||||
while( list($div, $c) = each($data['teams']) ){
|
||||
reset($c);
|
||||
while( list($cat, $num) = each($c) ) {
|
||||
for($x=0; $x<$num; $x++) {
|
||||
$team[$t]['division'] = $div;
|
||||
$team[$t]['category'] = $cat;
|
||||
$team[$t]['min'] = $data['min_judges_per_team'];
|
||||
$team[$t]['max'] = $data['max_judges_per_team'];
|
||||
$team[$t]['judges'] = array();
|
||||
$t++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$num_teams = $t;
|
||||
$x=0;
|
||||
/* Inital assignment of judges to teams */
|
||||
reset($judges);
|
||||
while( list($j, $ji) = each($judges)) {
|
||||
$team[$x % $num_teams]['judges'][] = $j;
|
||||
$x++;
|
||||
}
|
||||
|
||||
/* Compute inital costs */
|
||||
$current_cost = 0;
|
||||
// reset($team);
|
||||
for($x=0; $x<count($team); $x++) {
|
||||
$t =& $team[$x];
|
||||
$t['cost'] = compute_team_cost($team, $judges, $x);
|
||||
$current_cost += $t['cost'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Anneal */
|
||||
$temperature = 25.0;
|
||||
while(1) {
|
||||
$moves = 1000;
|
||||
for($m = 0; $m<$moves; $m++) {
|
||||
/* Pick 2 moves at random */
|
||||
$move = pick_random_move($team);
|
||||
/* See what the new cost is compared to the old */
|
||||
list($delta_c, $movedata) =
|
||||
compute_delta_cost($team, $judges, $move);
|
||||
|
||||
|
||||
$r = floatval(rand()) / floatval(getrandmax());
|
||||
/* Decide if we want to keep it */
|
||||
$e = exp(-$delta_c / $temperature);
|
||||
TRACE("r=$r, exp=$e<br>");
|
||||
if($r < exp(-$delta_c / $temperature)) {
|
||||
/* Yes, we do, record the move */
|
||||
record_move($team, $move, $movedata);
|
||||
$current_cost += $delta_c;
|
||||
$n_accepted++;
|
||||
if($current_cost < $best_cost)
|
||||
$best_cost = $current_cost;
|
||||
TRACE("Move accepted, cost=$current_cost<br>");
|
||||
} else {
|
||||
TRACE("Move rejected<br>");
|
||||
}
|
||||
|
||||
}
|
||||
TRACE("Cost is $current_cost<br>");
|
||||
$temperature *= 0.9;
|
||||
|
||||
if($temperature <= 0.05) break;
|
||||
}
|
||||
|
||||
|
||||
return $team;
|
||||
|
||||
}
|
||||
|
||||
|
||||
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
|
||||
while($r=mysql_fetch_object($q))
|
||||
$div[$r->id]=$r->division;
|
||||
|
||||
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
|
||||
while($r=mysql_fetch_object($q))
|
||||
$cat[$r->id]=$r->category;
|
||||
|
||||
|
||||
$configq=mysql_query("SELECT * FROM judges_schedulerconfig WHERE year='".$config['FAIRYEAR']."'");
|
||||
$data=array();
|
||||
while($configr=mysql_fetch_object($configq))
|
||||
$data[$configr->var]=$configr->val;
|
||||
|
||||
$data['teams'] = array();
|
||||
|
||||
foreach($div AS $d_id=>$d_val)
|
||||
{
|
||||
foreach($cat AS $c_id=>$c_val)
|
||||
{
|
||||
$numq=mysql_query("SELECT COUNT(id) AS num FROM projects WHERE projectcategories_id='$c_id' AND projectdivisions_id='$d_id'");
|
||||
$numr=mysql_fetch_object($numq);
|
||||
$numteams=ceil($numr->num/$data['max_projects_per_team']*$data['num_times_judged']);
|
||||
$data['teams'][$d_id][$c_id]=$numteams;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
$data = array( 'min_per_team' => 2,
|
||||
'max_per_team' => 4,
|
||||
'teams' => array() );
|
||||
$data['teams']['S']['LS'] = 4;
|
||||
$data['teams']['S']['PS'] = 4;
|
||||
$data['teams']['S']['Case'] = 3;
|
||||
$data['teams']['S']['CS'] = 2;
|
||||
$data['teams']['I']['LS'] = 3;
|
||||
$data['teams']['I']['PS'] = 3;
|
||||
$data['teams']['I']['Case'] = 2;
|
||||
$data['teams']['I']['CS'] = 1;
|
||||
$data['teams']['J']['LS'] = 2;
|
||||
$data['teams']['J']['PS'] = 2;
|
||||
$data['teams']['J']['Case'] = 1;
|
||||
$data['teams']['J']['CS'] = 4;
|
||||
*/
|
||||
|
||||
$q=mysql_query("SELECT * FROM judges ");
|
||||
|
||||
$judges=array();
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
unset($divprefs);
|
||||
unset($catprefs);
|
||||
|
||||
//get category preferences
|
||||
$q2=mysql_query("SELECT * FROM judges_catpref WHERE judges_id='$r->id' AND year='".$config['FAIRYEAR']."' ORDER BY projectcategories_id");
|
||||
$catprefs=array();
|
||||
while($r2=mysql_fetch_object($q2))
|
||||
$catprefs[$r2->projectcategories_id]=$r2->rank;
|
||||
|
||||
//get division preferences
|
||||
$q2=mysql_query("SELECT * FROM judges_expertise WHERE judges_id='$r->id' AND year='".$config['FAIRYEAR']."' AND projectsubdivisions_id IS NULL ORDER BY projectdivisions_id");
|
||||
//the areas of expertise are ranked from 1 to 5, and we need them as -2,-1,0,1,2 so we simply subtract 3
|
||||
$divprefs=array();
|
||||
while($r2=mysql_fetch_object($q2))
|
||||
$divprefs[$r2->projectdivisions_id]=$r2->val-3;
|
||||
|
||||
$judges[]=array(
|
||||
"judges_id"=>"$r->id",
|
||||
"name"=>"$r->firstname $r->lastname",
|
||||
"years_school"=>$r->years_school,
|
||||
"years_regional"=>$r->years_regional,
|
||||
"years_national"=>$r->years_national,
|
||||
"willing_chair"=>$r->willing_chair,
|
||||
"divprefs"=>$divprefs,
|
||||
"catprefs"=>$catprefs
|
||||
);
|
||||
}
|
||||
|
||||
//echo nl2br(TRACE_R($judges, true));
|
||||
|
||||
$teams = judges_assign_anneal($div,$cat, $judges, $data);
|
||||
|
||||
//TRACE_R( $teams);
|
||||
$teamnums=array();
|
||||
|
||||
send_header("Judging teams automatic scheduler");
|
||||
echo i18n("Judging teams successfully created. You can review the teams and modify as desired using the following links");
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
echo "<a href=\"judges_teams.php\">".i18n("Manage Judge Teams")."</a>";
|
||||
echo "<br />";
|
||||
echo "<a href=\"judges_teams_members.php\">".i18n("Manage Judge Members")."</a>";
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
|
||||
$totalcost=0;
|
||||
while(list($tn, $t) = each($teams)) {
|
||||
//team numbers start with 0 in the annealer, but we want them to start at 1, so just tn++ here.
|
||||
$tn++;
|
||||
|
||||
print("Team $tn: ({$div[$t['division']]}({$t['division']}),{$cat[$t['category']]}({$t['category']})) ".
|
||||
"(cost:{$t['cost']} )<br>");
|
||||
$totalcost+=$t['cost'];
|
||||
|
||||
if(!$teamnums[$t['division']][$t['category']]) $teamnums[$t['division']][$t['category']]=1;
|
||||
else $teamnums[$t['division']][$t['category']]++;
|
||||
|
||||
mysql_query("INSERT INTO judges_teams (num,name,autocreate_type_id,year) VALUES ('$tn','(Divisional) {$div[$t['division']]} - {$cat[$t['category']]} #{$teamnums[$t['division']][$t['category']]}','1','{$config['FAIRYEAR']}')");
|
||||
$team_id=mysql_insert_id();
|
||||
|
||||
while(list($key, $j) = each($t['judges']) ) {
|
||||
$judge = $judges[$j];
|
||||
print(" {$judge['name']}<br>");
|
||||
mysql_query("INSERT INTO judges_teams_link (judges_id,judges_teams_id,captain,year) VALUES ('{$judge['judges_id']}','$team_id','{$judge['willing_chair']}','{$config['FAIRYEAR']}')");
|
||||
}
|
||||
|
||||
//and finally, link the team to the award
|
||||
|
||||
$q=mysql_query("SELECT award_awards.id FROM
|
||||
award_awards,
|
||||
award_awards_projectcategories,
|
||||
award_awards_projectdivisions
|
||||
WHERE
|
||||
award_awards.year='{$config['FAIRYEAR']}'
|
||||
AND award_awards.id=award_awards_projectcategories.award_awards_id
|
||||
AND award_awards.id=award_awards_projectdivisions.award_awards_id
|
||||
AND award_awards_projectcategories.projectcategories_id='{$t['category']}'
|
||||
AND award_awards_projectdivisions.projectdivisions_id='{$t['division']}'
|
||||
AND award_awards.award_types_id='1'
|
||||
");
|
||||
if(mysql_num_rows($q)!=1)
|
||||
{
|
||||
echo error(i18n("Cannot find award for %1 - %2",array($cat[$t['category']],$div[$t['division']])));
|
||||
}
|
||||
else
|
||||
{
|
||||
$r=mysql_fetch_object($q);
|
||||
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,year) VALUES ('$r->id','$team_id','{$config['FAIRYEAR']}')");
|
||||
}
|
||||
}
|
||||
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
echo "<b>Total 'cost' for all teams: $totalcost</b>";
|
||||
|
||||
send_footer();
|
||||
?>
|
227
admin/judges_schedulerconfig.php
Normal file
227
admin/judges_schedulerconfig.php
Normal file
@ -0,0 +1,227 @@
|
||||
<?
|
||||
/*
|
||||
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");
|
||||
auth_required('admin');
|
||||
include "judges.inc.php";
|
||||
|
||||
send_header("Administration - Judge Scheduler Configuration");
|
||||
|
||||
echo "<a href=\"index.php\"><< ".i18n("Back to Administration")."</a>\n";
|
||||
echo "<a href=\"judges.php\"><< ".i18n("Back to Judges")."</a>\n";
|
||||
|
||||
if($_GET['edit']) $edit=$_GET['edit'];
|
||||
if($_POST['edit']) $edit=$_POST['edit'];
|
||||
if($_GET['action']) $action=$_GET['action'];
|
||||
if($_POST['action']) $action=$_POST['action'];
|
||||
|
||||
$q=mysql_query("SELECT * FROM judges_schedulerconfig WHERE year='-1'");
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
mysql_query("INSERT INTO judges_schedulerconfig (var,val,description,year) VALUES (
|
||||
'".mysql_escape_string($r->var)."',
|
||||
'".mysql_escape_string($r->val)."',
|
||||
'".mysql_escape_string($r->description)."',
|
||||
'".$config['FAIRYEAR']."')");
|
||||
}
|
||||
|
||||
if($_POST['action']=="save")
|
||||
{
|
||||
if($_POST['saveconfig'])
|
||||
{
|
||||
foreach($_POST['saveconfig'] as $key=>$val)
|
||||
{
|
||||
mysql_query("UPDATE judges_schedulerconfig SET val='".mysql_escape_string(stripslashes($val))."' WHERE year='".$config['FAIRYEAR']."' AND var='$key'");
|
||||
}
|
||||
}
|
||||
echo happy(i18n("Judges Scheduler Configuration successfully saved"));
|
||||
|
||||
|
||||
}
|
||||
$q=mysql_query("SELECT * FROM config WHERE year=0 ORDER BY var");
|
||||
echo "<form method=\"post\" action=\"judges_schedulerconfig.php\">";
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
||||
echo "<table>";
|
||||
|
||||
echo "<tr><td colspan=\"3\"><hr /><br /><h3>".i18n("Scheduler configuration settings for fair year %1",array($config['FAIRYEAR']))."</h3></td></tr>";
|
||||
|
||||
$q=mysql_query("SELECT * FROM judges_schedulerconfig WHERE year='".$config['FAIRYEAR']."' ORDER BY var");
|
||||
$schedulerconfig=array();
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
$schedulerconfig[$r->var]=$r->val;
|
||||
echo "<tr><td>$r->var</td><td>".i18n($r->description)."</td><td><input type=\"text\" name=\"saveconfig[$r->var]\" value=\"$r->val\" /></td></tr>";
|
||||
|
||||
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<input type=\"submit\" value=\"".i18n("Save Configuration")."\" />\n";
|
||||
echo "</form>";
|
||||
echo "<hr />";
|
||||
echo i18n("Based on your configuration data above, here are some calculations");
|
||||
echo "<br />";
|
||||
|
||||
$totalteams=0;
|
||||
$catq=mysql_query("SELECT * FROM projectcategories ORDER BY mingrade");
|
||||
while($catr=mysql_fetch_object($catq))
|
||||
{
|
||||
echo "<h3>$catr->category</h3>";
|
||||
echo "<table>";
|
||||
echo "<tr><th>Division</th><th>Projects</th><th>Teams</th></tr>";
|
||||
$divq=mysql_query("SELECT * FROM projectdivisions ORDER BY id");
|
||||
while($divr=mysql_fetch_object($divq))
|
||||
{
|
||||
$numq=mysql_query("SELECT COUNT(id) AS num FROM projects WHERE projectcategories_id='$catr->id' AND projectdivisions_id='$divr->id'");
|
||||
$numr=mysql_fetch_object($numq);
|
||||
echo "<tr><td>".i18n($divr->division)."</td>";
|
||||
echo "<td align=\"center\">$numr->num</td>";
|
||||
$numteams=ceil($numr->num/$schedulerconfig['max_projects_per_team']*$schedulerconfig['num_times_judged']);
|
||||
echo "<td align=\"center\">$numteams</td>";
|
||||
$totalteams+=$numteams;
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
}
|
||||
echo "<b>";
|
||||
echo "Total judging teams required: $totalteams";
|
||||
echo "<br />";
|
||||
$minjudges=($totalteams*$schedulerconfig['min_judges_per_team']);
|
||||
$maxjudges=($totalteams*$schedulerconfig['max_judges_per_team']);
|
||||
echo "Minimum number of judges required: $minjudges";
|
||||
echo "<br />";
|
||||
echo "Maximum number of judges acceptable: $maxjudges";
|
||||
echo "<br />";
|
||||
|
||||
$jq=mysql_query("SELECT COUNT(id) AS num FROM judges WHERE complete='yes'");
|
||||
$jr=mysql_fetch_object($jq);
|
||||
$currentjudges=$jr->num;
|
||||
echo "Current number of registered judges: $currentjudges";
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
$ok=true;
|
||||
if($currentjudges<$minjudges)
|
||||
{
|
||||
echo error(i18n("You do not have sufficient number of judges based on your parameters"));
|
||||
$ok=false;
|
||||
}
|
||||
else
|
||||
echo happy(i18n("You have a sufficient number of judges based on your parameters"));
|
||||
|
||||
//now check if we can find a divisional award for each division and category
|
||||
|
||||
|
||||
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
|
||||
while($r=mysql_fetch_object($q))
|
||||
$div[$r->id]=$r->division;
|
||||
|
||||
$q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
|
||||
while($r=mysql_fetch_object($q))
|
||||
$cat[$r->id]=$r->category;
|
||||
|
||||
$foundawards="";
|
||||
$notfoundawards="";
|
||||
$foundteams="";
|
||||
foreach($div AS $d_id=>$d_division)
|
||||
{
|
||||
foreach($cat AS $c_id=>$c_category)
|
||||
{
|
||||
$q=mysql_query("SELECT award_awards.id FROM
|
||||
award_awards,
|
||||
award_awards_projectcategories,
|
||||
award_awards_projectdivisions
|
||||
WHERE
|
||||
award_awards.year='{$config['FAIRYEAR']}'
|
||||
AND award_awards.id=award_awards_projectcategories.award_awards_id
|
||||
AND award_awards.id=award_awards_projectdivisions.award_awards_id
|
||||
AND award_awards_projectcategories.projectcategories_id='$c_id'
|
||||
AND award_awards_projectdivisions.projectdivisions_id='$d_id'
|
||||
AND award_awards.award_types_id='1'
|
||||
");
|
||||
echo mysql_error();
|
||||
if(mysql_num_rows($q)!=1)
|
||||
{
|
||||
while($r=mysql_fetch_object($q))
|
||||
print_r($r);
|
||||
$notfoundawards.="$c_category - $d_division, ";
|
||||
$ok=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$r=mysql_fetch_object($q);
|
||||
$foundawards.="$c_category - $d_division, ";
|
||||
//if we found an award thats good, but it would be bad if there's already a judges team
|
||||
//that is assigned to the award, so now lets check the judges teams to see if ones assigned
|
||||
//to this award.
|
||||
|
||||
$q=mysql_query("SELECT judges_teams.num,judges_teams.name
|
||||
FROM judges_teams,
|
||||
judges_teams_awards_link
|
||||
WHERE
|
||||
judges_teams_awards_link.award_awards_id='$r->id'
|
||||
AND judges_teams.year='".$config['FAIRYEAR']."'
|
||||
AND judges_teams_awards_link.judges_teams_id=judges_teams.id");
|
||||
if(mysql_num_rows($q))
|
||||
{
|
||||
$r=mysql_fetch_object($q);
|
||||
$ok=false;
|
||||
$foundteams.=i18n("(%1) %2, ",array($r->num,$r->name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$notfoundawards=substr($notfoundawards,0,-2);
|
||||
$foundawards=substr($foundawards,0,-2);
|
||||
$foundteams=substr($foundteams,0,-2);
|
||||
|
||||
if($notfoundawards)
|
||||
echo error(i18n("Cannot find awards for: %1. These awards must be created first",array($notfoundawards)));
|
||||
if($foundawards)
|
||||
echo happy(i18n("Found awards for: %1",array($foundawards)));
|
||||
if($foundteams)
|
||||
echo error(i18n("Found judging teams that are currently assigned to divisional awards: %1. These teams must be removed first",array($foundteams)));
|
||||
else
|
||||
echo happy(i18n("No judging teams are assigned to divisional awards (good!)"));
|
||||
|
||||
if($ok)
|
||||
{
|
||||
echo i18n("Everything looks in order, we're ready to create the divisional awards judging teams. Click 'Create Divisional Awards Judging Teams' below to start the scheduler. Please be patient as it may take 20-30 seconds to find an optimal solution to the judging team assignments");
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
echo "<a href=\"judges_sa.php\">".i18n("Create Divisional Awards Judging Teams")."</a>";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
echo "</b>";
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
|
||||
send_footer();
|
||||
|
||||
|
||||
?>
|
@ -58,6 +58,59 @@ function addclicked()
|
||||
echo happy(i18n("Judge team successfully removed, and all of its corresponding members, timeslots, projects and awards unlinked from team"));
|
||||
}
|
||||
|
||||
if($action=="deletealldivisional")
|
||||
{
|
||||
$q2=mysql_query("SELECT *
|
||||
FROM
|
||||
judges_teams
|
||||
WHERE
|
||||
year='".$config['FAIRYEAR']."'
|
||||
AND autocreate_type_id='1'
|
||||
");
|
||||
echo mysql_error();
|
||||
$numdeleted=0;
|
||||
while($r2=mysql_fetch_object($q2))
|
||||
{
|
||||
//okay now we can start deleting things! whew!
|
||||
//first delete any linkings to the team
|
||||
mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("DELETE FROM judges_teams_timeslots_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("DELETE FROM judges_teams_timeslots_projects_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("DELETE FROM judges_teams WHERE id='$r2->id' AND year='".$config['FAIRYEAR']."'");
|
||||
$numdeleted++;
|
||||
}
|
||||
if($numdeleted)
|
||||
echo happy(i18n("Successfully deleted %1 auto-created divisional team(s)",array($numdeleted)));
|
||||
else
|
||||
echo error(i18n("There were no auto-created divisional teams to delete"));
|
||||
}
|
||||
|
||||
if($action=="deleteall")
|
||||
{
|
||||
$q2=mysql_query("SELECT *
|
||||
FROM judges_teams
|
||||
WHERE
|
||||
year='".$config['FAIRYEAR']."'
|
||||
");
|
||||
$numdeleted=0;
|
||||
while($r2=mysql_fetch_object($q2))
|
||||
{
|
||||
//okay now we can start deleting things! whew!
|
||||
//first delete any linkings to the team
|
||||
mysql_query("DELETE FROM judges_teams_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("DELETE FROM judges_teams_timeslots_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("DELETE FROM judges_teams_timeslots_projects_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("DELETE FROM judges_teams_awards_link WHERE judges_teams_id='$r2->id' AND year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("DELETE FROM judges_teams WHERE id='$r2->id' AND year='".$config['FAIRYEAR']."'");
|
||||
$numdeleted++;
|
||||
}
|
||||
if($numdeleted)
|
||||
echo happy(i18n("Successfully deleted %1 team(s)",array($numdeleted)));
|
||||
else
|
||||
echo error(i18n("There were no teams to delete"));
|
||||
}
|
||||
|
||||
if(($action=="save" || $action=="assign") && $edit)
|
||||
{
|
||||
//if we're updating or assigning, it doesnt matter, lets do the same thing (save record, add award
|
||||
@ -141,22 +194,37 @@ function addclicked()
|
||||
|
||||
if($action=="createall")
|
||||
{
|
||||
//first make sure we're really empty (dont want people hitting refresh and adding all the teams twice
|
||||
$q=mysql_query("SELECT COUNT(*) AS c FROM judges_teams WHERE year='".$config['FAIRYEAR']."'");
|
||||
//first make sure we dont have any non-divisional award teams (dont want people hitting refresh and adding all the teams twice
|
||||
$q=mysql_query("SELECT COUNT(*) AS c FROM judges_teams WHERE autocreate_type_id!='1' AND year='".$config['FAIRYEAR']."'");
|
||||
$r=mysql_fetch_object($q);
|
||||
if($r->c)
|
||||
{
|
||||
echo error(i18n("Cannot 'Create All' teams when any teams currently exist. Try deleting all existing teams first."));
|
||||
echo error(i18n("Cannot 'Create All' teams when any divisional teams currently exist. Try deleting all existing non-divisional teams first."));
|
||||
}
|
||||
else
|
||||
{
|
||||
//grab all the awards
|
||||
$q=mysql_query("SELECT award_awards.*, award_types.type AS award_type, award_types.order AS award_types_order FROM award_awards,award_types WHERE award_awards.award_types_id=award_types.id AND award_awards.year='".$config['FAIRYEAR']."' ORDER BY award_types_order, name");
|
||||
$q=mysql_query("SELECT
|
||||
award_awards.*,
|
||||
award_types.type AS award_type,
|
||||
award_types.order AS award_types_order
|
||||
FROM
|
||||
award_awards,
|
||||
award_types
|
||||
WHERE
|
||||
award_awards.award_types_id=award_types.id
|
||||
AND award_awards.year='".$config['FAIRYEAR']."'
|
||||
AND award_types.year='".$config['FAIRYEAR']."'
|
||||
AND award_types_id!='1'
|
||||
ORDER BY
|
||||
award_types_order,
|
||||
name");
|
||||
$num=1;
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
// print_r($r);
|
||||
$name=mysql_escape_string("($r->award_type) $r->name");
|
||||
mysql_query("INSERT INTO judges_teams(num,name,year) VALUES ('$num','$name','".$config['FAIRYEAR']."')");
|
||||
mysql_query("INSERT INTO judges_teams(num,name,autocreate_type_id,year) VALUES ('$num','$name','$r->award_types_id','".$config['FAIRYEAR']."')");
|
||||
$team_id=mysql_insert_id();
|
||||
//now link the new team to the award
|
||||
mysql_query("INSERT INTO judges_teams_awards_link (award_awards_id,judges_teams_id,year) VALUES ('$r->id','$team_id','".$config['FAIRYEAR']."')");
|
||||
@ -196,10 +264,13 @@ function addclicked()
|
||||
echo "<tr><td>".i18n("Team Name").":</td><td><input type=\"text\" size=\"40\" name=\"team_name\" value=\"".$team['name']."\"></td></tr>";
|
||||
echo "<tr><td>".i18n("Awards").":</td><td>";
|
||||
|
||||
foreach($team['awards'] AS $award)
|
||||
if(count($team['awards']))
|
||||
{
|
||||
echo "<a onclick=\"return confirmClick('Are you sure you want to unassign this award from this team?')\" href=\"judges_teams.php?action=unassign&unassign=".$award['id']."&edit=".$team['id']."\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
|
||||
echo " (".$award['award_type'].") ".$award['name']." <br />";
|
||||
foreach($team['awards'] AS $award)
|
||||
{
|
||||
echo "<a onclick=\"return confirmClick('Are you sure you want to unassign this award from this team?')\" href=\"judges_teams.php?action=unassign&unassign=".$award['id']."&edit=".$team['id']."\"><img border=0 src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\"></a>";
|
||||
echo " (".$award['award_type'].") ".$award['name']." <br />";
|
||||
}
|
||||
}
|
||||
|
||||
echo "<table><tr>";
|
||||
@ -229,6 +300,7 @@ function addclicked()
|
||||
WHERE
|
||||
award_awards.year='".$config['FAIRYEAR']."'
|
||||
AND award_types.id=award_awards.award_types_id
|
||||
AND award_types.year='{$config['FAIRYEAR']}'
|
||||
ORDER BY
|
||||
award_type_order,
|
||||
name
|
||||
@ -249,6 +321,7 @@ function addclicked()
|
||||
award_awards.year='".$config['FAIRYEAR']."' AND
|
||||
judges_teams_awards_link.award_awards_id IS NULL
|
||||
AND award_types.id=award_awards.award_types_id
|
||||
AND award_types.year='{$config['FAIRYEAR']}'
|
||||
ORDER BY
|
||||
award_type_order,
|
||||
name";
|
||||
@ -284,10 +357,11 @@ function addclicked()
|
||||
echo "<br />";
|
||||
|
||||
$teams=getJudgingTeams();
|
||||
//print_r($teams);
|
||||
|
||||
if(!count($teams))
|
||||
{
|
||||
echo "<a href=\"judges_teams.php?action=createall\">".i18n("Automatically create one new team for every award")."</a><br />";
|
||||
echo "<a href=\"judges_teams.php?action=createall\">".i18n("Automatically create one new team for every non-divisional award")."</a><br />";
|
||||
echo "<a href=\"judges_teams.php?action=add&num=1\">".i18n("Manually add individual team")."</a><br />";
|
||||
}
|
||||
else
|
||||
@ -304,7 +378,15 @@ function addclicked()
|
||||
}
|
||||
|
||||
|
||||
echo "<table width=\"95%\">";
|
||||
echo "<tr><td>";
|
||||
echo "<a href=\"judges_teams.php?action=add&num=$newteamnum\">Add individual team</a><br />";
|
||||
echo "</td><td>";
|
||||
echo "<a onclick=\"return confirmClick('".i18n("Are you sure you want to delete all teams that are assigned to divisional awards?")."')\" href=\"judges_teams.php?action=deletealldivisional\">Delete all teams assigned to divisional awards</a>";
|
||||
echo "<br />";
|
||||
echo "<a onclick=\"return confirmClick('".i18n("Are you sure you want to delete all teams?")."')\" href=\"judges_teams.php?action=deleteall\">Delete all teams</a><br />";
|
||||
echo "</td></tr></table>";
|
||||
|
||||
echo "<table class=\"summarytable\">\n";
|
||||
echo "<tr><th>Num</th>";
|
||||
echo "<th>Team Name</th>";
|
||||
|
@ -33,10 +33,11 @@
|
||||
|
||||
if($_POST['action']=="save")
|
||||
{
|
||||
if($_POST['catpref']) $catpref="'".$_POST['catpref']."'";
|
||||
/* 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']))."', ".
|
||||
@ -52,8 +53,6 @@
|
||||
"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']))."', ".
|
||||
@ -75,6 +74,13 @@
|
||||
}
|
||||
|
||||
}
|
||||
mysql_query("DELETE FROM judges_catpref WHERE judges_id='".$_SESSION['judges_id']."'");
|
||||
|
||||
foreach($_POST['catpref'] AS $k=>$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'])));
|
||||
}
|
||||
$q=mysql_query("SELECT * FROM judges WHERE email='".$_SESSION['email']."' AND id='".$_SESSION['judges_id']."'");
|
||||
@ -128,37 +134,41 @@ 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\">";
|
||||
echo " <td colspan=\"4\"><b>".i18n("Age category preferences")."</b></td>";
|
||||
|
||||
$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 ORDER BY mingrade");
|
||||
echo "<select name=\"catpref\" onchange=\"fieldChanged()\" >";
|
||||
echo "<option value=\"\">".i18n("Doesn't Matter")."</option>\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="";
|
||||
// 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]\">";
|
||||
foreach($preferencechoices AS $val=>$str)
|
||||
{
|
||||
if($catprefs[$r->id]==$val) $sel="selected=\"selected\""; else $sel="";
|
||||
echo "<option $sel value=\"$val\">".i18n($str)."</option>\n";
|
||||
}
|
||||
echo "</select>";
|
||||
|
||||
echo "<option $sel value=\"$r->id\">".i18n("%1 (Grades %2-%3)",array(i18n($r->category),$r->mingrade,$r->maxgrade))."</option>\n";
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</select>";
|
||||
//echo "</select>";
|
||||
echo "</table>";
|
||||
echo "</td></tr>";
|
||||
|
||||
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><td colspan=\"4\"><hr /></td></tr>";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan=\"2\">".i18n("Highest post-secondary degree")."</td>";
|
||||
|
Loading…
Reference in New Issue
Block a user