From b956f4c2d3c18a25b67b0f72c71555f9ab7f7d0c Mon Sep 17 00:00:00 2001 From: james Date: Thu, 8 Dec 2005 18:00:30 +0000 Subject: [PATCH] Add project details report - shows info for one project per page, with project details, mentor information, and project summary Remove some leftover junk from tablelabels report --- admin/reports.php | 3 + admin/reports_projects_details.php | 150 +++++++++++++++++++++++++ admin/reports_projects_tablelabels.php | 7 -- 3 files changed, 153 insertions(+), 7 deletions(-) create mode 100644 admin/reports_projects_details.php diff --git a/admin/reports.php b/admin/reports.php index bc462f08..9036219a 100644 --- a/admin/reports.php +++ b/admin/reports.php @@ -52,6 +52,9 @@ echo ""; echo i18n("Project Table Labels").": "; echo "PDF   "; echo "
"; + echo i18n("Project Summary Details").": "; + echo "PDF   "; + echo "
"; echo i18n("Nametags").": "; echo "Students PDF   "; echo "Judges PDF   "; diff --git a/admin/reports_projects_details.php b/admin/reports_projects_details.php new file mode 100644 index 00000000..a412faf3 --- /dev/null +++ b/admin/reports_projects_details.php @@ -0,0 +1,150 @@ + + 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. +*/ +?> +newPage(); + $rep->setFontSize(11); + } + else if($type=="csv") + { + $rep=new lcsv(i18n("Project Details")); + } + + $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, + projects.summary, + projects.req_electricity, + projects.req_table, + projects.req_special, + projects.language, + 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 projectdivisions.year='".$config['FAIRYEAR']."' + AND projectcategories.year='".$config['FAIRYEAR']."' + AND ( registrations.status='complete' + OR registrations.status='paymentpending' ) + ORDER BY + projects.projectnumber + "); + echo mysql_error(); + + $totalprojects=mysql_num_rows($projq); + $projectcount=0; + + while($proj=mysql_fetch_object($projq)) + { + $projectcount++; + $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->heading(i18n("Project Information")); + $rep->nextline(); + + $table=array(); +// $table['header']=array(i18n("Timeslot"),i18n("Judging Team")); + $table['widths']=array( 1.25, 4.75); + $table['dataalign']=array("left","left"); + $table['data'][]=array(i18n("Project Number"),$proj->projectnumber); + $table['data'][]=array(i18n("Project Title"),$proj->title); + $table['data'][]=array(i18n("Age Category"),$proj->category); + $table['data'][]=array(i18n("Division"),$proj->division); + $table['data'][]=array(i18n("Students"),$students); + $table['data'][]=array(i18n("Table?"),$proj->req_table); + $table['data'][]=array(i18n("Electricity?"),$proj->req_electricity); + $table['data'][]=array(i18n("Special Requests"),$proj->req_special); + $table['data'][]=array(i18n("Language"),$proj->language); + $rep->addTable($table); + unset($table); + + $q=mysql_query("SELECT * FROM mentors WHERE registrations_id='".$proj->reg_id."'"); + $rep->nextline(); + $rep->heading(i18n("Mentor Information")); + $rep->nextline(); + + if(mysql_num_rows($q)) + { + while($r=mysql_fetch_object($q)) + { + $rep->addText(i18n("%1 %2 from %3",array($r->firstname,$r->lastname,$r->organization))); + $rep->addText(i18n("Phone: %1 Email: %2",array($r->phone,$r->email))); + } + } + else + { + $rep->addText(i18n("No mentors")); + } + + $rep->nextline(); + $rep->heading(i18n("Project Summary")); + $rep->nextline(); + $rep->addText($proj->summary); + + if($projectcount!=$totalprojects) + $rep->newPage(); + } + + $rep->output(); +?> diff --git a/admin/reports_projects_tablelabels.php b/admin/reports_projects_tablelabels.php index cbfefc20..385e5b2c 100644 --- a/admin/reports_projects_tablelabels.php +++ b/admin/reports_projects_tablelabels.php @@ -45,13 +45,6 @@ $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,