diff --git a/admin/judges_schedulerconfig_check.inc.php b/admin/judges_schedulerconfig_check.inc.php
index 1addd2f..a448bde 100644
--- a/admin/judges_schedulerconfig_check.inc.php
+++ b/admin/judges_schedulerconfig_check.inc.php
@@ -38,6 +38,7 @@ function checkPrerequisites()
echo "
$numr->num | ";
$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 "$numteams | ";
$totalteams+=$numteams;
diff --git a/admin/reports.php b/admin/reports.php
index 9036219..1b4d2b3 100644
--- a/admin/reports.php
+++ b/admin/reports.php
@@ -48,6 +48,11 @@ echo "";
echo "PDF ";
echo "CSV ";
+ echo "
";
+ echo i18n("Students/Projects From Each School").": ";
+ echo "PDF ";
+ echo "CSV ";
+
echo "
";
echo i18n("Project Table Labels").": ";
echo "PDF ";
diff --git a/admin/reports_schoolprojects.php b/admin/reports_schoolprojects.php
new file mode 100644
index 0000000..211cddd
--- /dev/null
+++ b/admin/reports_schoolprojects.php
@@ -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
+ Copyright (C) 2005 James Grant
+
+ 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();
+?>