forked from science-ation/science-ation
117 lines
2.8 KiB
PHP
117 lines
2.8 KiB
PHP
|
<?
|
||
|
/*
|
||
|
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');
|
||
|
require("../lpdf.php");
|
||
|
require("../lcsv.php");
|
||
|
|
||
|
$type=$_GET['type'];
|
||
|
|
||
|
if($type=="pdf")
|
||
|
{
|
||
|
|
||
|
$rep=new lpdf( i18n($config['fairname']),
|
||
|
i18n("Judging Teams View"),
|
||
|
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||
|
);
|
||
|
|
||
|
$rep->newPage();
|
||
|
$rep->setFontSize(11);
|
||
|
}
|
||
|
else if($type=="csv")
|
||
|
{
|
||
|
$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
|
||
|
);
|
||
|
}
|
||
|
|
||
|
foreach($teams AS $team)
|
||
|
{
|
||
|
$table=array();
|
||
|
|
||
|
$table['header']=array(i18n("Captain"),i18n("First Name"),i18n("Last Name"));
|
||
|
$table['widths']=array( 1.0, 3.0, 3.0);
|
||
|
$table['dataalign']=array("center","left","left");
|
||
|
|
||
|
$rep->heading($team['name']." (".$team['num'].")");
|
||
|
|
||
|
foreach($team['members'] AS $member)
|
||
|
{
|
||
|
$table['data'][]=array($member['captain'],$member['firstname'],$member['lastname']);
|
||
|
}
|
||
|
|
||
|
$rep->addTable($table);
|
||
|
$rep->nextline();
|
||
|
|
||
|
unset($table);
|
||
|
|
||
|
}
|
||
|
|
||
|
$rep->output();
|
||
|
?>
|