forked from science-ation/science-ation
LCSV: add heading() and nextline()
Add judging teams list and judging teams view reports Fix judges team number assignments to assign new teams the next available number, filling empty/missing numbers.
This commit is contained in:
parent
ab424f244f
commit
44f40885e5
@ -350,6 +350,8 @@ function switchjudgeinfo()
|
||||
$teams=array();
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
$teamnumbers[$r->num]=1;
|
||||
|
||||
if($r->id!=$lastteamid)
|
||||
{
|
||||
$teams[$r->id]['id']=$r->id;
|
||||
@ -367,17 +369,20 @@ function switchjudgeinfo()
|
||||
}
|
||||
//echo nl2br(print_r($teams,true));
|
||||
|
||||
if($lastteamnum==-1) $newteamid=1;
|
||||
else $newteamid=$lastteamnum+1;
|
||||
|
||||
//start at 1, and find the next available team number
|
||||
$newteamnum=1;
|
||||
while($teamnumbers[$newteamnum]==1)
|
||||
{
|
||||
$newteamnum++;
|
||||
}
|
||||
|
||||
echo "<table>";
|
||||
echo "<tr><td valign=top>";
|
||||
echo "<input onclick=\"addbuttonclicked('$newteamid')\" type=\"button\" value=\"Add >>\">";
|
||||
echo "<input onclick=\"addbuttonclicked('$newteamnum')\" type=\"button\" value=\"Add >>\">";
|
||||
echo "</td><td>";
|
||||
|
||||
echo "<table>";
|
||||
echo "<tr><th align=\"left\">New #$newteamid: <input type=\"text\" name=\"new_team_name\" value=\"Team #$newteamid\" /></th></tr>";
|
||||
echo "<tr><th align=\"left\">New #$newteamnum: <input type=\"text\" name=\"new_team_name\" value=\"Team #$newteamnum\" /></th></tr>";
|
||||
echo "</table>";
|
||||
|
||||
echo "</td></tr></table>";
|
||||
|
@ -46,5 +46,12 @@ echo "</table>";
|
||||
echo i18n("Judges List").": ";
|
||||
echo "<a href=\"reports_judges.php?type=csv\">Judge List (CSV)</a> ";
|
||||
|
||||
echo "<br />";
|
||||
echo i18n("Judging Teams").": ";
|
||||
echo "<a href=\"reports_judges_teams.php?type=csv\">List (CSV)</a> ";
|
||||
echo "<a href=\"reports_judges_teams.php?type=pdf\">List (PDF)</a> ";
|
||||
echo "<a href=\"reports_judges_teams_view.php?type=csv\">Team View (CSV)</a> ";
|
||||
echo "<a href=\"reports_judges_teams_view.php?type=pdf\">Team View (PDF)</a> ";
|
||||
|
||||
send_footer();
|
||||
?>
|
||||
|
109
admin/reports_judges_teams.php
Normal file
109
admin/reports_judges_teams.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?
|
||||
/*
|
||||
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"),
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||||
);
|
||||
|
||||
$rep->newPage();
|
||||
$rep->setFontSize(11);
|
||||
}
|
||||
else if($type=="csv")
|
||||
{
|
||||
$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
|
||||
);
|
||||
}
|
||||
|
||||
$table=array();
|
||||
|
||||
$table['header']=array(i18n("Team Num"),i18n("Team Name"),i18n("Captain"),i18n("First Name"),i18n("Last Name"));
|
||||
$table['widths']=array(0.5, 1.5, 0.8, 2.0, 2.0);
|
||||
$table['dataalign']=array("left","left","center","left","left");
|
||||
|
||||
foreach($teams AS $team)
|
||||
{
|
||||
foreach($team['members'] AS $member)
|
||||
{
|
||||
$table['data'][]=array($team['num'],$team['name'],$member['captain'],$member['firstname'],$member['lastname']);
|
||||
}
|
||||
}
|
||||
|
||||
$rep->addTable($table);
|
||||
$rep->output();
|
||||
?>
|
116
admin/reports_judges_teams_view.php
Normal file
116
admin/reports_judges_teams_view.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?
|
||||
/*
|
||||
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();
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user