forked from science-ation/science-ation
Add a new report that shows each project/students on a per school basis, one school per page.
This commit is contained in:
parent
95c6381007
commit
f0fdca1ba0
@ -38,6 +38,7 @@ function checkPrerequisites()
|
||||
echo "<td align=\"center\">$numr->num</td>";
|
||||
$numteams=ceil($numr->num/$schedulerconfig['max_projects_per_team']*$schedulerconfig['num_times_judged']);
|
||||
if($numteams<$schedulerconfig['num_times_judged']) $numteams=$schedulerconfig['num_times_judged'];
|
||||
if($numr->num==0) $numteams=0;
|
||||
|
||||
echo "<td align=\"center\">$numteams</td>";
|
||||
$totalteams+=$numteams;
|
||||
|
@ -48,6 +48,11 @@ echo "</table>";
|
||||
echo "<a href=\"reports_emergencycontact.php?type=pdf\">PDF</a> ";
|
||||
echo "<a href=\"reports_emergencycontact.php?type=csv\">CSV</a> ";
|
||||
|
||||
echo "<br />";
|
||||
echo i18n("Students/Projects From Each School").": ";
|
||||
echo "<a href=\"reports_schoolprojects.php?type=pdf\">PDF</a> ";
|
||||
echo "<a href=\"reports_schoolprojects.php?type=csv\">CSV</a> ";
|
||||
|
||||
echo "<br />";
|
||||
echo i18n("Project Table Labels").": ";
|
||||
echo "<a href=\"reports_projects_tablelabels.php?type=pdf\">PDF</a> ";
|
||||
|
120
admin/reports_schoolprojects.php
Normal file
120
admin/reports_schoolprojects.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?
|
||||
/*
|
||||
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("School Projects"),
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||||
);
|
||||
|
||||
$rep->newPage();
|
||||
$rep->setFontSize(11);
|
||||
}
|
||||
else if($type=="csv")
|
||||
{
|
||||
$rep=new lcsv(i18n("School Projects"));
|
||||
}
|
||||
|
||||
$projq=mysql_query("SELECT
|
||||
schools.school,
|
||||
projects.title,
|
||||
projects.projectnumber,
|
||||
registrations.id AS reg_id
|
||||
FROM
|
||||
schools,
|
||||
projects,
|
||||
registrations,
|
||||
students
|
||||
WHERE
|
||||
projects.registrations_id=registrations.id
|
||||
AND students.registrations_id=registrations.id
|
||||
AND students.schools_id=schools.id
|
||||
AND registrations.year='".$config['FAIRYEAR']."'
|
||||
AND ( registrations.status='complete'
|
||||
OR registrations.status='paymentpending' )
|
||||
ORDER BY school,projectnumber
|
||||
");
|
||||
|
||||
echo mysql_Error();
|
||||
$oldschool="nothing";
|
||||
$first=true;
|
||||
$havealready=array();
|
||||
while($proj=mysql_fetch_object($projq))
|
||||
{
|
||||
if(in_array($proj->reg_id,$havealready))
|
||||
continue;
|
||||
else
|
||||
$havealready[]=$proj->reg_id;
|
||||
|
||||
$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++;
|
||||
}
|
||||
if($oldschool!=$proj->school)
|
||||
{
|
||||
if(!$first)
|
||||
{
|
||||
$rep->addTable($table);
|
||||
unset($table);
|
||||
$rep->newPage();
|
||||
}
|
||||
|
||||
$rep->heading($proj->school);
|
||||
$rep->nextline();
|
||||
$oldschool=$proj->school;
|
||||
$table=array();
|
||||
$table['header']=array(i18n("Proj Num"),i18n("Project Title"),i18n("Students"));
|
||||
$table['widths']=array( 0.8, 3.75, 2.75);
|
||||
$table['dataalign']=array("left","left","left");
|
||||
$first=false;
|
||||
}
|
||||
|
||||
$table['data'][]=array($proj->projectnumber,$proj->title,$students);
|
||||
}
|
||||
$rep->addTable($table);
|
||||
unset($table);
|
||||
|
||||
$rep->output();
|
||||
?>
|
Loading…
Reference in New Issue
Block a user