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. */ ?> << ".i18n("Back to Administration").""; echo "   "; echo "<< ".i18n("Back to Registration").""; echo "
"; echo "
"; echo i18n("Choose Status").":"; echo "
"; echo ""; echo "
"; if($_GET['showstatus']) $wherestatus="AND status='".$_GET['showstatus']."' "; else $wherestatus=""; switch($_GET['sort']) { case 'status': $ORDERBY="registrations.status DESC, projects.title"; break; case 'num': $ORDERBY="registrations.num"; break; case 'title': $ORDERBY="projects.title, registrations.status DESC"; break; case 'cat': $ORDERBY="projects.projectcategories_id, projects.title"; break; case 'div': $ORDERBY="projects.projectdivisions_id, projects.title"; break; default: $ORDERBY="registrations.status DESC, projects.title"; break; } $q=mysql_query("SELECT registrations.id AS reg_id, registrations.num AS reg_num, registrations.status, projects.title, projects.projectcategories_id, projects.projectdivisions_id FROM registrations left outer join projects on projects.registrations_id=registrations.id WHERE 1 AND registrations.year='".$config['FAIRYEAR']."' $wherestatus ORDER BY $ORDERBY "); echo mysql_error(); echo ""; echo ""; if($_GET['showstatus']) $stat="&showstatus=".$_GET['showstatus']; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $stats_totalprojects=0; $stats_totalstudents=0; $stats_divisions=array(); $stats_categories=array(); while($r=mysql_fetch_object($q)) { $stats_totalprojects++; $stats_divisions[$r->projectdivisions_id]++; $stats_categories[$r->projectcategories_id]++; switch($r->status) { case "new": $status_text="New"; break; case "open": $status_text="Open"; break; case "paymentpending": $status_text="Payment Pending"; break; case "complete": $status_text="Complete"; break; } $status_text=i18n($status_text); echo ""; echo ""; echo ""; echo ""; //now get thh category and division $catq=mysql_query("SELECT category FROM projectcategories WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectcategories_id."'"); $catr=mysql_fetch_object($catq); $divq=mysql_query("SELECT division FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' AND id='".$r->projectdivisions_id."'"); $divr=mysql_fetch_object($divq); echo ""; echo ""; $sq=mysql_query("SELECT students.firstname, students.lastname, schools.school FROM students,schools WHERE students.registrations_id='$r->reg_id' AND students.schools_id=schools.id "); echo mysql_error(); $studnum=1; $schools=""; $students=""; while($studentinfo=mysql_fetch_object($sq)) { $students.="$studentinfo->firstname $studentinfo->lastname
"; $schools.="$studentinfo->school
"; $stats_totalstudents++; } echo ""; echo ""; echo ""; } echo "
".i18n("Status")."".i18n("Reg Num")."".i18n("Project Title")."".i18n("Age Category")."".i18n("Division")."".i18n("School(s)")."".i18n("Student(s)")."
$status_text$r->reg_num$r->title".i18n("$catr->category")."".i18n("$divr->division")."$schools$students
\n"; echo "
"; echo ""; echo ""; echo "\n"; echo "\n"; echo ""; echo ""; $q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); while($r=mysql_fetch_object($q)) echo "\n"; echo ""; echo ""; $q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); while($r=mysql_fetch_object($q)) echo "\n"; echo "

".i18n("Project / Student totals")."

".i18n("Total Projects").":$stats_totalprojects
".i18n("Total Students").": $stats_totalstudents

".i18n("Projects per age category")."

".i18n($r->category).":".($stats_categories[$r->id]?$stats_categories[$r->id]:"0")."

".i18n("Projects per division")."

".i18n($r->division).":".($stats_divisions[$r->id]?$stats_divisions[$r->id]:"0")."
"; echo "
"; echo i18n("Note: statistics reflect the numbers of the current 'Status' selected at the top of the page"); echo "
"; echo "
"; send_footer(); ?>