2005-04-18 17:56:46 +00:00
|
|
|
<?
|
|
|
|
function getJudgingTeams()
|
|
|
|
{
|
2010-10-20 21:58:26 +00:00
|
|
|
global $config, $conference;
|
2005-04-19 18:36:03 +00:00
|
|
|
|
2005-04-18 17:56:46 +00:00
|
|
|
$q=mysql_query("SELECT judges_teams.id,
|
|
|
|
judges_teams.num,
|
2005-05-06 16:13:37 +00:00
|
|
|
judges_teams.name
|
2005-04-18 17:56:46 +00:00
|
|
|
FROM
|
2005-05-06 16:13:37 +00:00
|
|
|
judges_teams
|
2005-04-18 17:56:46 +00:00
|
|
|
WHERE
|
2010-10-20 21:58:26 +00:00
|
|
|
judges_teams.conferences_id='".$conference['id']."'
|
2005-04-18 17:56:46 +00:00
|
|
|
ORDER BY
|
2005-05-06 16:13:37 +00:00
|
|
|
num,name
|
|
|
|
");
|
2005-04-18 17:56:46 +00:00
|
|
|
|
|
|
|
$lastteamid=-1;
|
|
|
|
$lastteamnum=-1;
|
|
|
|
echo mysql_error();
|
|
|
|
$teams=array();
|
|
|
|
while($r=mysql_fetch_object($q))
|
|
|
|
{
|
2005-05-06 16:13:37 +00:00
|
|
|
$teams[$r->id]['id']=$r->id;
|
|
|
|
$teams[$r->id]['num']=$r->num;
|
|
|
|
$teams[$r->id]['name']=$r->name;
|
|
|
|
$lastteamid=$r->id;
|
|
|
|
$lastteamnum=$r->num;
|
|
|
|
|
2010-04-04 01:38:50 +00:00
|
|
|
/* Load timeslots */
|
|
|
|
$rounds = array();
|
|
|
|
$tq = mysql_query("SELECT * FROM judges_teams_timeslots_link
|
|
|
|
LEFT JOIN judges_timeslots ON judges_timeslots.id=judges_teams_timeslots_link.judges_timeslots_id
|
|
|
|
WHERE judges_teams_timeslots_link.judges_teams_id='{$r->id}'");
|
|
|
|
$teams[$r->id]['timeslots'] = array();
|
|
|
|
$teams[$r->id]['rounds'] = array();
|
|
|
|
while($ts = mysql_fetch_assoc($tq)) {
|
|
|
|
$teams[$r->id]['timeslots'][] = $ts;
|
|
|
|
$rounds[$ts['round_id']] = $ts['round_id'];
|
|
|
|
}
|
|
|
|
foreach($rounds as $round_id) {
|
|
|
|
$tq = mysql_query("SELECT * FROM judges_timeslots WHERE id='{$round_id}'");
|
|
|
|
$teams[$r->id]['rounds'][] = mysql_fetch_assoc($tq);
|
|
|
|
}
|
|
|
|
|
2005-05-06 16:13:37 +00:00
|
|
|
//get the members for this team
|
|
|
|
$mq=mysql_query("SELECT
|
2009-09-09 00:26:12 +00:00
|
|
|
users.id AS judges_id,
|
|
|
|
users.firstname,
|
|
|
|
users.lastname,
|
2005-05-06 16:13:37 +00:00
|
|
|
judges_teams_link.captain
|
|
|
|
|
|
|
|
FROM
|
2009-09-09 00:26:12 +00:00
|
|
|
users,
|
2005-05-06 16:13:37 +00:00
|
|
|
judges_teams_link
|
|
|
|
WHERE
|
2009-09-09 00:26:12 +00:00
|
|
|
judges_teams_link.users_id=users.id AND
|
2005-05-06 16:13:37 +00:00
|
|
|
judges_teams_link.judges_teams_id='$r->id'
|
|
|
|
ORDER BY
|
|
|
|
captain DESC,
|
|
|
|
lastname,
|
|
|
|
firstname");
|
|
|
|
echo mysql_error();
|
|
|
|
|
|
|
|
|
2009-04-02 16:35:02 +00:00
|
|
|
$teamlangs=array();
|
2005-05-06 16:13:37 +00:00
|
|
|
while($mr=mysql_fetch_object($mq))
|
2005-04-18 17:56:46 +00:00
|
|
|
{
|
2009-09-09 00:26:12 +00:00
|
|
|
$u = user_load($mr->judges_id, false);
|
|
|
|
$judgelangs = join('/', $u['languages']);
|
2010-01-18 16:24:34 +00:00
|
|
|
foreach($u['languages'] AS $l) {
|
|
|
|
if(!in_array($l,$teamlangs))
|
|
|
|
$teamlangs[]=$l;
|
|
|
|
}
|
2009-09-09 00:26:12 +00:00
|
|
|
|
2005-05-06 16:13:37 +00:00
|
|
|
$teams[$lastteamid]['members'][]=array(
|
|
|
|
"id"=>$mr->judges_id,
|
|
|
|
"firstname"=>$mr->firstname,
|
|
|
|
"lastname"=>$mr->lastname,
|
2008-04-03 20:34:42 +00:00
|
|
|
"captain"=>$mr->captain,
|
2010-04-06 17:05:59 +00:00
|
|
|
"languages"=>$judgelangs,
|
|
|
|
"languages_array"=>$u['languages']
|
2005-05-06 16:13:37 +00:00
|
|
|
);
|
2005-04-18 17:56:46 +00:00
|
|
|
}
|
2010-04-06 17:05:59 +00:00
|
|
|
$teams[$r->id]['languages_members']=$teamlangs;
|
2010-04-06 16:15:48 +00:00
|
|
|
|
|
|
|
//we also need to add all the languages that the team must JUDGE to the teams languages.
|
|
|
|
$lq=mysql_query("SELECT projects.language
|
|
|
|
FROM judges_teams_timeslots_projects_link
|
|
|
|
LEFT JOIN projects ON judges_teams_timeslots_projects_link.projects_id=projects.id
|
2010-10-20 21:58:26 +00:00
|
|
|
WHERE judges_teams_timeslots_projects_link.conferences_id='{$conference['id']}' AND
|
2010-04-06 16:15:48 +00:00
|
|
|
judges_teams_id='$r->id' ");
|
|
|
|
echo mysql_error();
|
2010-04-06 17:05:59 +00:00
|
|
|
$projectlangs=array();
|
2010-04-06 16:15:48 +00:00
|
|
|
while($lr=mysql_fetch_object($lq)) {
|
2010-04-06 17:05:59 +00:00
|
|
|
if(!in_array($lr->language,$projectlangs))
|
|
|
|
$projectlangs[]=$lr->language;
|
2010-04-06 16:15:48 +00:00
|
|
|
if(!in_array($lr->language,$teamlangs))
|
|
|
|
$teamlangs[]=$lr->language;
|
|
|
|
}
|
2010-04-06 17:05:59 +00:00
|
|
|
$teams[$r->id]['languages_projects']=$projectlangs;
|
2009-04-02 16:35:02 +00:00
|
|
|
$teams[$r->id]['languages']=$teamlangs;
|
2005-05-06 16:13:37 +00:00
|
|
|
|
|
|
|
//get the awards for this team
|
|
|
|
$aq=mysql_query("SELECT award_awards.id,
|
|
|
|
award_awards.name,
|
2007-03-28 22:32:57 +00:00
|
|
|
award_awards.criteria,
|
2005-05-06 16:13:37 +00:00
|
|
|
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
|
2010-10-20 21:58:26 +00:00
|
|
|
AND award_types.conferences_id='{$conference['id']}'
|
2005-05-06 16:13:37 +00:00
|
|
|
ORDER BY
|
|
|
|
name
|
|
|
|
");
|
|
|
|
while($ar=mysql_fetch_object($aq))
|
|
|
|
{
|
|
|
|
$teams[$r->id]['awards'][]=array(
|
|
|
|
"id"=>$ar->id,
|
|
|
|
"name"=>$ar->name,
|
2007-03-28 22:32:57 +00:00
|
|
|
"criteria"=>$ar->criteria,
|
2005-05-06 16:13:37 +00:00
|
|
|
"award_types_id"=>$ar->award_types_id,
|
|
|
|
"award_type"=>$ar->award_type
|
2005-04-18 17:56:46 +00:00
|
|
|
);
|
2005-05-06 16:13:37 +00:00
|
|
|
}
|
2005-04-18 17:56:46 +00:00
|
|
|
}
|
|
|
|
return $teams;
|
|
|
|
}
|
|
|
|
|
2005-04-19 18:36:03 +00:00
|
|
|
function getJudgingTeam($teamid)
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
$q=mysql_query("SELECT judges_teams.id,
|
|
|
|
judges_teams.num,
|
2005-05-06 16:13:37 +00:00
|
|
|
judges_teams.name
|
2005-04-19 18:36:03 +00:00
|
|
|
|
|
|
|
FROM
|
2005-05-06 16:13:37 +00:00
|
|
|
judges_teams
|
2005-04-19 18:36:03 +00:00
|
|
|
WHERE
|
2010-10-20 21:58:26 +00:00
|
|
|
judges_teams.conferences_id='".$conference['id']."' AND
|
2005-04-19 18:36:03 +00:00
|
|
|
judges_teams.id='$teamid'
|
|
|
|
ORDER BY
|
|
|
|
num,
|
2005-05-06 16:13:37 +00:00
|
|
|
name
|
|
|
|
");
|
2005-04-19 18:36:03 +00:00
|
|
|
|
|
|
|
$team=array();
|
|
|
|
|
|
|
|
$first=true;
|
|
|
|
while($r=mysql_fetch_object($q))
|
|
|
|
{
|
2005-05-06 16:13:37 +00:00
|
|
|
$team['id']=$r->id;
|
|
|
|
$team['num']=$r->num;
|
|
|
|
$team['name']=$r->name;
|
|
|
|
|
|
|
|
//get the members for this team
|
|
|
|
$mq=mysql_query("SELECT
|
2009-09-09 00:26:12 +00:00
|
|
|
users.id AS judges_id,
|
|
|
|
users.firstname,
|
|
|
|
users.lastname,
|
2005-05-06 16:13:37 +00:00
|
|
|
judges_teams_link.captain
|
|
|
|
|
|
|
|
FROM
|
2009-09-09 00:26:12 +00:00
|
|
|
users,
|
2005-05-06 16:13:37 +00:00
|
|
|
judges_teams_link
|
|
|
|
WHERE
|
2009-09-09 00:26:12 +00:00
|
|
|
judges_teams_link.users_id=users.id AND
|
2005-05-06 16:13:37 +00:00
|
|
|
judges_teams_link.judges_teams_id='$r->id'
|
|
|
|
ORDER BY
|
|
|
|
captain DESC,
|
|
|
|
lastname,
|
|
|
|
firstname");
|
|
|
|
echo mysql_error();
|
|
|
|
|
|
|
|
|
|
|
|
while($mr=mysql_fetch_object($mq))
|
2005-04-19 18:36:03 +00:00
|
|
|
{
|
2005-05-06 16:13:37 +00:00
|
|
|
$team['members'][]=array(
|
|
|
|
"id"=>$mr->judges_id,
|
|
|
|
"firstname"=>$mr->firstname,
|
|
|
|
"lastname"=>$mr->lastname,
|
|
|
|
"captain"=>$mr->captain
|
|
|
|
);
|
2005-04-19 18:36:03 +00:00
|
|
|
}
|
|
|
|
|
2005-05-06 16:13:37 +00:00
|
|
|
|
|
|
|
//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
|
2010-10-20 21:58:26 +00:00
|
|
|
AND award_types.conferences_id='{$conference['id']}'
|
2005-05-06 16:13:37 +00:00
|
|
|
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
|
2005-04-19 18:36:03 +00:00
|
|
|
);
|
2005-05-06 16:13:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-19 18:36:03 +00:00
|
|
|
}
|
2005-05-06 16:13:37 +00:00
|
|
|
|
2005-04-19 18:36:03 +00:00
|
|
|
return $team;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-08-12 18:05:38 +00:00
|
|
|
function getJudgingEligibilityCode() {
|
|
|
|
global $config;
|
|
|
|
switch($config['project_status']) {
|
|
|
|
case 'open' :
|
|
|
|
return " AND registrations.status != 'open' ";
|
|
|
|
break;
|
|
|
|
case 'payment_pending' :
|
|
|
|
return " AND registrations.status IN ('paymentpending', 'complete')";
|
|
|
|
break;
|
|
|
|
case 'complete' :
|
|
|
|
return " AND registrations.status = 'complete'";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-10 16:51:43 +00:00
|
|
|
function teamMemberToName($member)
|
|
|
|
{
|
|
|
|
return $member["firstname"] . " " . $member["lastname"];
|
|
|
|
}
|
|
|
|
|
2009-09-09 00:26:12 +00:00
|
|
|
function judges_load_all()
|
|
|
|
{
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
$ret = array();
|
|
|
|
|
2010-10-20 21:58:26 +00:00
|
|
|
$r = mysql_query("
|
|
|
|
SELECT users.id FROM users JOIN user_roles ur ON ur.users_id = users.id
|
|
|
|
JOIN roles ON roles.id = ur.roles_id WHERE roles.type = 'judge'
|
|
|
|
AND conferences_id='{$conference['id']}'
|
|
|
|
AND deleted='no'
|
|
|
|
ORDER BY lastname, firstname
|
|
|
|
");
|
2009-09-09 00:26:12 +00:00
|
|
|
while($i = mysql_fetch_assoc($r)) {
|
|
|
|
$u = user_load($i['id']);
|
|
|
|
if($u['judge_complete'] == 'no') continue;
|
2010-02-10 16:15:12 +00:00
|
|
|
if($u['judge_active'] == 'no') continue;
|
2009-09-09 00:26:12 +00:00
|
|
|
|
|
|
|
$ret[$i['id']] = $u;
|
|
|
|
}
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
|
2005-04-18 17:56:46 +00:00
|
|
|
?>
|