forked from science-ation/science-ation
Factor getJudgesTeams into a function since we seem to need to use it all over the place :)
This commit is contained in:
parent
9b385a10fd
commit
57ed732bd0
51
admin/judges.inc.php
Normal file
51
admin/judges.inc.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?
|
||||
function getJudgingTeams()
|
||||
{
|
||||
$q=mysql_query("SELECT judges_teams.id,
|
||||
judges_teams.num,
|
||||
judges_teams.name,
|
||||
judges.id AS judges_id,
|
||||
judges.firstname,
|
||||
judges.lastname,
|
||||
judges_teams_link.captain
|
||||
|
||||
FROM
|
||||
judges,
|
||||
judges_teams,
|
||||
judges_teams_link
|
||||
WHERE
|
||||
judges_teams.year='".$config['FAIRYEAR']."' AND
|
||||
judges_teams_link.judges_id=judges.id AND
|
||||
judges_teams_link.judges_teams_id=judges_teams.id
|
||||
ORDER BY
|
||||
name,
|
||||
num,
|
||||
captain DESC,
|
||||
lastname,
|
||||
firstname");
|
||||
|
||||
$lastteamid=-1;
|
||||
$lastteamnum=-1;
|
||||
echo mysql_error();
|
||||
$teams=array();
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if($r->id!=$lastteamid)
|
||||
{
|
||||
$teams[$r->id]['id']=$r->id;
|
||||
$teams[$r->id]['num']=$r->num;
|
||||
$teams[$r->id]['name']=$r->name;
|
||||
$lastteamid=$r->id;
|
||||
$lastteamnum=$r->num;
|
||||
}
|
||||
$teams[$lastteamid]['members'][]=array(
|
||||
"id"=>$r->judges_id,
|
||||
"firstname"=>$r->firstname,
|
||||
"lastname"=>$r->lastname,
|
||||
"captain"=>$r->captain
|
||||
);
|
||||
}
|
||||
return $teams;
|
||||
}
|
||||
|
||||
?>
|
@ -32,6 +32,7 @@
|
||||
echo "<br />";
|
||||
echo "<a href=\"judges_teams.php\">".i18n("Manage Judging Teams")."</a><br />";
|
||||
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 />";
|
||||
|
||||
send_footer();
|
||||
|
@ -24,6 +24,7 @@
|
||||
<?
|
||||
require("../common.inc.php");
|
||||
auth_required('admin');
|
||||
include "judges.inc.php";
|
||||
|
||||
send_header("Administration - Judging Teams");
|
||||
?>
|
||||
@ -321,53 +322,11 @@ function switchjudgeinfo()
|
||||
echo "</td>";
|
||||
echo "<td valign=\"top\">";
|
||||
|
||||
$q=mysql_query("SELECT judges_teams.id,
|
||||
judges_teams.num,
|
||||
judges_teams.name,
|
||||
judges.id AS judges_id,
|
||||
judges.firstname,
|
||||
judges.lastname,
|
||||
judges_teams_link.captain
|
||||
|
||||
FROM
|
||||
judges,
|
||||
judges_teams,
|
||||
judges_teams_link
|
||||
WHERE
|
||||
judges_teams.year='".$config['FAIRYEAR']."' AND
|
||||
judges_teams_link.judges_id=judges.id AND
|
||||
judges_teams_link.judges_teams_id=judges_teams.id
|
||||
ORDER BY
|
||||
name,
|
||||
num,
|
||||
captain DESC,
|
||||
lastname,
|
||||
firstname");
|
||||
$teams=getJudgingTeams();
|
||||
|
||||
$lastteamid=-1;
|
||||
$lastteamnum=-1;
|
||||
echo mysql_error();
|
||||
$teams=array();
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
$teamnumbers[$r->num]=1;
|
||||
|
||||
if($r->id!=$lastteamid)
|
||||
{
|
||||
$teams[$r->id]['id']=$r->id;
|
||||
$teams[$r->id]['num']=$r->num;
|
||||
$teams[$r->id]['name']=$r->name;
|
||||
$lastteamid=$r->id;
|
||||
$lastteamnum=$r->num;
|
||||
}
|
||||
$teams[$lastteamid]['members'][]=array(
|
||||
"id"=>$r->judges_id,
|
||||
"firstname"=>$r->firstname,
|
||||
"lastname"=>$r->lastname,
|
||||
"captain"=>$r->captain
|
||||
);
|
||||
}
|
||||
//echo nl2br(print_r($teams,true));
|
||||
//grab an array of all the current team numbers
|
||||
foreach($teams AS $team)
|
||||
$teamnumers[$team['num']]=1;
|
||||
|
||||
//start at 1, and find the next available team number
|
||||
$newteamnum=1;
|
||||
|
@ -26,6 +26,7 @@
|
||||
auth_required('admin');
|
||||
require("../lpdf.php");
|
||||
require("../lcsv.php");
|
||||
require("judges.inc.php");
|
||||
|
||||
$type=$_GET['type'];
|
||||
|
||||
@ -45,50 +46,7 @@
|
||||
$rep=new lcsv(i18n("Judging Teams"));
|
||||
}
|
||||
|
||||
$q=mysql_query("SELECT judges_teams.id,
|
||||
judges_teams.num,
|
||||
judges_teams.name,
|
||||
judges.id AS judges_id,
|
||||
judges.firstname,
|
||||
judges.lastname,
|
||||
judges_teams_link.captain
|
||||
|
||||
FROM
|
||||
judges,
|
||||
judges_teams,
|
||||
judges_teams_link
|
||||
WHERE
|
||||
judges_teams.year='".$config['FAIRYEAR']."' AND
|
||||
judges_teams_link.judges_id=judges.id AND
|
||||
judges_teams_link.judges_teams_id=judges_teams.id
|
||||
ORDER BY
|
||||
name,
|
||||
num,
|
||||
captain DESC,
|
||||
lastname,
|
||||
firstname");
|
||||
|
||||
$lastteamid=-1;
|
||||
$lastteamnum=-1;
|
||||
echo mysql_error();
|
||||
$teams=array();
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if($r->id!=$lastteamid)
|
||||
{
|
||||
$teams[$r->id]['id']=$r->id;
|
||||
$teams[$r->id]['num']=$r->num;
|
||||
$teams[$r->id]['name']=$r->name;
|
||||
$lastteamid=$r->id;
|
||||
$lastteamnum=$r->num;
|
||||
}
|
||||
$teams[$lastteamid]['members'][]=array(
|
||||
"id"=>$r->judges_id,
|
||||
"firstname"=>$r->firstname,
|
||||
"lastname"=>$r->lastname,
|
||||
"captain"=>$r->captain
|
||||
);
|
||||
}
|
||||
$teams=getJudgingTeams();
|
||||
|
||||
$table=array();
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
auth_required('admin');
|
||||
require("../lpdf.php");
|
||||
require("../lcsv.php");
|
||||
require("judges.inc.php");
|
||||
|
||||
$type=$_GET['type'];
|
||||
|
||||
@ -45,50 +46,7 @@
|
||||
$rep=new lcsv(i18n("Judging Teams View"));
|
||||
}
|
||||
|
||||
$q=mysql_query("SELECT judges_teams.id,
|
||||
judges_teams.num,
|
||||
judges_teams.name,
|
||||
judges.id AS judges_id,
|
||||
judges.firstname,
|
||||
judges.lastname,
|
||||
judges_teams_link.captain
|
||||
|
||||
FROM
|
||||
judges,
|
||||
judges_teams,
|
||||
judges_teams_link
|
||||
WHERE
|
||||
judges_teams.year='".$config['FAIRYEAR']."' AND
|
||||
judges_teams_link.judges_id=judges.id AND
|
||||
judges_teams_link.judges_teams_id=judges_teams.id
|
||||
ORDER BY
|
||||
name,
|
||||
num,
|
||||
captain DESC,
|
||||
lastname,
|
||||
firstname");
|
||||
|
||||
$lastteamid=-1;
|
||||
$lastteamnum=-1;
|
||||
echo mysql_error();
|
||||
$teams=array();
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if($r->id!=$lastteamid)
|
||||
{
|
||||
$teams[$r->id]['id']=$r->id;
|
||||
$teams[$r->id]['num']=$r->num;
|
||||
$teams[$r->id]['name']=$r->name;
|
||||
$lastteamid=$r->id;
|
||||
$lastteamnum=$r->num;
|
||||
}
|
||||
$teams[$lastteamid]['members'][]=array(
|
||||
"id"=>$r->judges_id,
|
||||
"firstname"=>$r->firstname,
|
||||
"lastname"=>$r->lastname,
|
||||
"captain"=>$r->captain
|
||||
);
|
||||
}
|
||||
$teams=getJudgingTeams();
|
||||
|
||||
foreach($teams AS $team)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user