Copyright (C) 2005-2006 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. */ ?> 'committee_main.php', 'Administration' => 'admin/index.php', 'Participant Registration' => 'admin/registration.php') ); echo "
"; echo i18n("Choose Status").":"; echo "
"; echo ""; echo "
"; $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='$conferences_id' ORDER BY id"); while($r=mysql_fetch_object($q)) $cats[$r->id]=$r->category; $q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='$conferences_id' ORDER BY id"); while($r=mysql_fetch_object($q)) $divs[$r->id]=$r->division; if($showstatus) { switch($showstatus) { case "complete": $wherestatus="AND status='complete' "; break; case "paymentpending": $wherestatus="AND status='paymentpending' "; break; case "completeorpaymentpending": $wherestatus="AND (status='complete' OR status='paymentpending') "; break; case "open": $wherestatus="AND status='open' "; break; case "new": $wherestatus="AND status='new' "; break; default: $wherestatus=""; } } else $wherestatus=""; switch($_GET['sort']) { case 'status': $ORDERBY="registrations.status DESC, projects.title"; break; case 'num': $ORDERBY="registrations.num"; break; case 'projnum': $ORDERBY="projects.projectsort, projects.projectnumber"; 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, registrations.email, projects.title, projects.projectnumber, projects.projectcategories_id, projects.projectdivisions_id, projects.language FROM registrations left outer join projects on projects.registrations_id=registrations.id WHERE 1 AND registrations.conferences_id='$conferences_id' $wherestatus ORDER BY $ORDERBY "); echo mysql_error(); $stats_totalprojects=0; $stats_totalstudents=0; $stats_divisions=array(); $stats_categories=array(); $stats_students_catdiv=array(); $stats_projects_catdiv=array(); $stats_students_schools=array(); $stats_projects_schools=array(); $stats_projects_lang=array(); $schools_names=array(); $languages=array(); while($r=mysql_fetch_object($q)) { $stats_totalprojects++; $stats_divisions[$r->projectdivisions_id]++; $stats_categories[$r->projectcategories_id]++; $stats_projects_catdiv[$r->projectcategories_id][$r->projectdivisions_id]++; $stats_projects_lang[$r->projectcategories_id][$r->projectdivisions_id][$r->language]++; $languages[$r->language]++; 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); $sq=mysql_query("SELECT students.firstname, students.lastname, students.id, schools.school, schools.board, schools.id AS schools_id 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)) { $stats_totalstudents++; $stats_students_catdiv[$r->projectcategories_id][$r->projectdivisions_id]++; $stats_students_schools[$r->projectcategories_id][$studentinfo->schools_id]++; $schools_names[$studentinfo->schools_id]=$studentinfo->school." ($studentinfo->board)"; $lastschoolid=$studentinfo->schools_id; } //this really isnt right, its only taking the school from the last student in the project to count towards the school's project totals //but there's really no other way $stats_projects_schools[$r->projectcategories_id][$lastschoolid]++; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "

{$status_str[$showstatus]} - ".i18n("Students / projects per age category / division")."

"; echo ""; echo ""; foreach($cats AS $c=>$cn) { echo ""; } echo ""; echo ""; echo ""; foreach($divs AS $d=>$dn) { echo ""; $tstud=0; $tproj=0; foreach($cats AS $c=>$cn) { echo ""; $tstud+=$stats_students_catdiv[$c][$d]; $tproj+=$stats_projects_catdiv[$c][$d]; $tstudcat[$c]+=$stats_students_catdiv[$c][$d]; $tprojcat[$c]+=$stats_projects_catdiv[$c][$d]; } echo ""; echo ""; } echo ""; $tstud=0; $tproj=0; foreach($cats AS $c=>$cn) { echo ""; $tstud+=$tstudcat[$c]; $tproj+=$tprojcat[$c]; } echo ""; echo ""; echo ""; echo "
$cn
".i18n("Stud | Proj")."
".i18n("Total")."
".i18n("Stud | Proj")."
$dn"; echo ($stats_students_catdiv[$c][$d]?$stats_students_catdiv[$c][$d]:0); echo "    "; echo ($stats_projects_catdiv[$c][$d]?$stats_projects_catdiv[$c][$d]:0); echo ""; echo ($tstud?$tstud:0); echo "    "; echo ($tproj?$tproj:0); echo "
".i18n("Total").""; echo ($tstudcat[$c]?$tstudcat[$c]:0); echo "    "; echo ($tprojcat[$c]?$tprojcat[$c]:0); echo ""; echo ($tstud); echo "    "; echo ($tproj); echo "
"; echo "

{$status_str[$showstatus]} - ".i18n("Students / projects per age category / school")."

"; echo ""; echo ""; foreach($cats AS $c=>$cn) { echo ""; } echo ""; echo ""; echo ""; asort($schools_names); foreach($schools_names AS $id=>$sn) { echo ""; $tstud=0; $tproj=0; foreach($cats AS $c=>$cn) { echo ""; $tstud+=$stats_students_schools[$c][$id]; $tproj+=$stats_projects_schools[$c][$id]; } echo ""; echo ""; } echo ""; echo "
$cn
".i18n("Stud | Proj")."
".i18n("Total")."
".i18n("Stud | Proj")."
$sn".($stats_students_schools[$c][$id]?$stats_students_schools[$c][$id]:0); echo "    "; echo ($stats_projects_schools[$c][$id]?$stats_projects_schools[$c][$id]:0)."".($tstud?$tstud:0); echo "    "; echo ($tproj?$tproj:0)."
"; echo i18n("%1 schools total",array(count($schools_names))); echo "

{$status_str[$showstatus]} - ".i18n("Projects per age category / division / language")."

"; echo ""; echo ""; foreach($cats AS $c=>$cn) { echo ""; } echo ""; echo ""; ksort($languages); $tprojcat = array(); foreach($cats AS $c=>$cn) { foreach($languages AS $l=>$ln) { echo ""; } } foreach($languages AS $l=>$ln) { echo ""; } echo ""; echo ""; foreach($divs AS $d=>$dn) { echo ""; $tproj=array(); foreach($cats AS $c=>$cn) { foreach($languages AS $l=>$ln) { echo ""; $tproj[$l]+=$stats_projects_lang[$c][$d][$l]; $tprojcat[$c][$l]+=$stats_projects_lang[$c][$d][$l]; } } foreach($tproj AS $l=>$ln) { echo ""; } echo ""; } echo ""; $tproj=array(); foreach($cats AS $c=>$cn) { foreach($languages AS $l=>$ln) { echo ""; $tproj[$l]+=$tprojcat[$c][$l]; } } foreach($tproj AS $l=>$ln) { echo ""; } echo ""; echo ""; echo "
$cn".i18n("Total")."
$l$l
$dn"; echo ($stats_projects_lang[$c][$d][$l]?$stats_projects_lang[$c][$d][$l]:0); echo ""; echo ($ln?$ln:0); echo "
".i18n("Total").""; echo ($tprojcat[$c][$l]?$tprojcat[$c][$l]:0); echo ""; echo ($ln); echo "
"; echo "
"; echo "
"; echo i18n("Note: statistics reflect the numbers of the current 'Status' selected at the top of the page"); echo "
"; echo "
"; send_footer(); ?>