forked from science-ation/science-ation
e7d726355d
- Missing: Having a project judged more than once by different judging teams is untested, I don't htink it'll work properly, still working on that part. - Missing: Auto updating the configuration if any of the variables are missing. - Missing: A way to preserve judging questions (like willing_chair), so the user doesn't delete them and break the scheduler, OR, notice saying that the question has been deleted and the scheduler won't use the chair calculations, then we need a way to add them back in with the click of a button.
194 lines
3.9 KiB
PHP
194 lines
3.9 KiB
PHP
<?
|
|
function getJudgingTeams()
|
|
{
|
|
global $config;
|
|
|
|
$q=mysql_query("SELECT judges_teams.id,
|
|
judges_teams.num,
|
|
judges_teams.name
|
|
FROM
|
|
judges_teams
|
|
WHERE
|
|
judges_teams.year='".$config['FAIRYEAR']."'
|
|
ORDER BY
|
|
num,name
|
|
");
|
|
|
|
$lastteamid=-1;
|
|
$lastteamnum=-1;
|
|
echo mysql_error();
|
|
$teams=array();
|
|
while($r=mysql_fetch_object($q))
|
|
{
|
|
$teams[$r->id]['id']=$r->id;
|
|
$teams[$r->id]['num']=$r->num;
|
|
$teams[$r->id]['name']=$r->name;
|
|
$lastteamid=$r->id;
|
|
$lastteamnum=$r->num;
|
|
|
|
//get the members for this team
|
|
$mq=mysql_query("SELECT
|
|
judges.id AS judges_id,
|
|
judges.firstname,
|
|
judges.lastname,
|
|
judges_teams_link.captain
|
|
|
|
FROM
|
|
judges,
|
|
judges_teams_link
|
|
WHERE
|
|
judges_teams_link.judges_id=judges.id AND
|
|
judges_teams_link.judges_teams_id='$r->id'
|
|
ORDER BY
|
|
captain DESC,
|
|
lastname,
|
|
firstname");
|
|
echo mysql_error();
|
|
|
|
|
|
while($mr=mysql_fetch_object($mq))
|
|
{
|
|
$teams[$lastteamid]['members'][]=array(
|
|
"id"=>$mr->judges_id,
|
|
"firstname"=>$mr->firstname,
|
|
"lastname"=>$mr->lastname,
|
|
"captain"=>$mr->captain
|
|
);
|
|
}
|
|
|
|
//get the awards for this team
|
|
$aq=mysql_query("SELECT award_awards.id,
|
|
award_awards.name,
|
|
award_awards.award_types_id,
|
|
award_types.type AS award_type
|
|
FROM
|
|
award_awards,
|
|
judges_teams_awards_link,
|
|
award_types
|
|
WHERE
|
|
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
|
|
");
|
|
while($ar=mysql_fetch_object($aq))
|
|
{
|
|
$teams[$r->id]['awards'][]=array(
|
|
"id"=>$ar->id,
|
|
"name"=>$ar->name,
|
|
"award_types_id"=>$ar->award_types_id,
|
|
"award_type"=>$ar->award_type
|
|
);
|
|
}
|
|
}
|
|
return $teams;
|
|
}
|
|
|
|
function getJudgingTeam($teamid)
|
|
{
|
|
global $config;
|
|
|
|
$q=mysql_query("SELECT judges_teams.id,
|
|
judges_teams.num,
|
|
judges_teams.name
|
|
|
|
FROM
|
|
judges_teams
|
|
WHERE
|
|
judges_teams.year='".$config['FAIRYEAR']."' AND
|
|
judges_teams.id='$teamid'
|
|
ORDER BY
|
|
num,
|
|
name
|
|
");
|
|
|
|
$team=array();
|
|
|
|
$first=true;
|
|
while($r=mysql_fetch_object($q))
|
|
{
|
|
$team['id']=$r->id;
|
|
$team['num']=$r->num;
|
|
$team['name']=$r->name;
|
|
|
|
//get the members for this team
|
|
$mq=mysql_query("SELECT
|
|
judges.id AS judges_id,
|
|
judges.firstname,
|
|
judges.lastname,
|
|
judges_teams_link.captain
|
|
|
|
FROM
|
|
judges,
|
|
judges_teams_link
|
|
WHERE
|
|
judges_teams_link.judges_id=judges.id AND
|
|
judges_teams_link.judges_teams_id='$r->id'
|
|
ORDER BY
|
|
captain DESC,
|
|
lastname,
|
|
firstname");
|
|
echo mysql_error();
|
|
|
|
|
|
while($mr=mysql_fetch_object($mq))
|
|
{
|
|
$team['members'][]=array(
|
|
"id"=>$mr->judges_id,
|
|
"firstname"=>$mr->firstname,
|
|
"lastname"=>$mr->lastname,
|
|
"captain"=>$mr->captain
|
|
);
|
|
}
|
|
|
|
|
|
//get the awards for this team
|
|
$aq=mysql_query("SELECT award_awards.id,
|
|
award_awards.name,
|
|
award_awards.award_types_id,
|
|
award_types.type AS award_type
|
|
FROM
|
|
award_awards,
|
|
judges_teams_awards_link,
|
|
award_types
|
|
WHERE
|
|
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
|
|
");
|
|
while($ar=mysql_fetch_object($aq))
|
|
{
|
|
$team['awards'][]=array(
|
|
"id"=>$ar->id,
|
|
"name"=>$ar->name,
|
|
"award_types_id"=>$ar->award_types_id,
|
|
"award_type"=>$ar->award_type
|
|
);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
return $team;
|
|
|
|
}
|
|
|
|
function judges_scheduler_load_config()
|
|
{
|
|
global $config;
|
|
$configq=mysql_query("SELECT * FROM config WHERE year='".$config['FAIRYEAR']."' AND var LIKE 'JSCHEDULER_%'");
|
|
$data=array();
|
|
while($configr=mysql_fetch_object($configq)) {
|
|
$v = substr($configr->var, 11);
|
|
$data[$v]=$configr->val;
|
|
}
|
|
return $data;
|
|
}
|
|
|
|
?>
|