diff --git a/admin/judges.inc.php b/admin/judges.inc.php
new file mode 100644
index 0000000..f375ab7
--- /dev/null
+++ b/admin/judges.inc.php
@@ -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;
+}
+
+?>
diff --git a/admin/judges.php b/admin/judges.php
index 3fcc98e..d1767a2 100644
--- a/admin/judges.php
+++ b/admin/judges.php
@@ -32,6 +32,7 @@
echo "
";
echo "".i18n("Manage Judging Teams")."
";
echo "".i18n("Manage Judging Timeslots")."
";
+ echo "".i18n("Assign Timeslots to Judging Teams")."
";
echo "".i18n("Assign Projects to Teams")."
";
send_footer();
diff --git a/admin/judges_teams.php b/admin/judges_teams.php
index aa7a6ab..d50dbd9 100644
--- a/admin/judges_teams.php
+++ b/admin/judges_teams.php
@@ -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 "";
echo "
";
- $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;
diff --git a/admin/reports_judges_teams.php b/admin/reports_judges_teams.php
index 2e4d07b..b20d217 100644
--- a/admin/reports_judges_teams.php
+++ b/admin/reports_judges_teams.php
@@ -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();
diff --git a/admin/reports_judges_teams_view.php b/admin/reports_judges_teams_view.php
index 128bc35..ecf9c1c 100644
--- a/admin/reports_judges_teams_view.php
+++ b/admin/reports_judges_teams_view.php
@@ -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)
{
|