Add the project table lablels report

This commit is contained in:
james 2005-04-22 14:20:29 +00:00
parent ccb38c5aa7
commit 1d3c7294e4
2 changed files with 123 additions and 0 deletions

View File

@ -43,6 +43,13 @@ while($catr=mysql_fetch_object($catq))
echo "</tr>";
echo "</table>";
echo i18n("Project Table Labels").": ";
echo "<a href=\"reports_projects_tablelabels.php?type=pdf\">PDF</a> &nbsp; ";
echo "<br />";
echo "<br />";
echo i18n("Judges List").": ";
echo "<a href=\"reports_judges.php?type=csv\">Judge List (CSV)</a> &nbsp; ";

View 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(""),
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
);
$rep->newPage(11,8.5);
$rep->setFontSize(11);
}
else if($type=="csv")
{
$rep=new lcsv(i18n("Table Labels"));
}
$q=mysql_query("SELECT DISTINCT(date) AS d FROM judges_timeslots WHERE year='".$config['FAIRYEAR']."'");
if(mysql_num_rows($q)>1)
$show_date=true;
else
$show_date=false;
$projq=mysql_query("SELECT
registrations.id AS reg_id,
registrations.num AS reg_num,
projects.id,
projects.title,
projects.projectnumber,
projects.projectdivisions_id,
projects.projectcategories_id,
projectdivisions.division,
projectcategories.category
FROM
registrations
LEFT JOIN projectdivisions ON projectdivisions.id=projects.projectdivisions_id
LEFT JOIN projectcategories ON projectcategories.id=projects.projectcategories_id
LEFT JOIN projects on projects.registrations_id=registrations.id
WHERE
projects.year='".$config['FAIRYEAR']."'
AND registrations.status='complete'
ORDER BY
projects.projectnumber
");
echo mysql_error();
while($proj=mysql_fetch_object($projq))
{
$rep->setFontSize(22);
$rep->addtext($proj->title,"center");
$rep->setFontSize(150);
$rep->addtext($proj->projectnumber,"center");
$rep->setFontSize(22);
$sq=mysql_query("SELECT students.firstname,
students.lastname
FROM
students
WHERE
students.registrations_id='$proj->reg_id'
");
$students="";
$studnum=0;
while($studentinfo=mysql_fetch_object($sq))
{
if($studnum>0) $students.=", ";
$students.="$studentinfo->firstname $studentinfo->lastname";
$studnum++;
}
$rep->nextLine();
$rep->nextLine();
$rep->addText($students,"center");
$rep->nextLine();
$rep->nextLine();
$rep->addText(i18n($proj->category)." - ".i18n($proj->division),"center");
$rep->newPage();
}
$rep->output();
?>