diff --git a/admin/reports.inc.php b/admin/reports.inc.php index acbe6c5..6e38fdd 100644 --- a/admin/reports.inc.php +++ b/admin/reports.inc.php @@ -25,6 +25,8 @@ require_once("reports_judges.inc.php"); /* $report_students_fields */ require_once("reports_awards.inc.php"); /* $report_students_fields */ require_once("reports_committees.inc.php"); /* $report_students_fields */ + require_once("reports_schools.inc.php"); + require_once('../lpdf.php'); require_once('../lcsv.php'); @@ -172,7 +174,7 @@ foreach($stock as $n=>$v) { { global $allow_options; global $report_students_fields, $report_judges_fields, $report_awards_fields; - global $report_committees_fields; + global $report_committees_fields, $report_schools_fields; switch($report['type']) { @@ -180,6 +182,7 @@ foreach($stock as $n=>$v) { case 'judge': $allow_fields = array_keys($report_judges_fields); break; case 'award': $allow_fields = array_keys($report_awards_fields); break; case 'committee':$allow_fields = array_keys($report_committees_fields); break; + case 'school': $allow_fields = array_keys($report_schools_fields); break; } /* First delete all existing fields */ @@ -218,6 +221,7 @@ foreach($stock as $n=>$v) { { global $allow_options, $report_students_fields, $report_judges_fields; global $report_committees_fields, $report_awards_fields; + global $report_schools_fields; $report = array(); @@ -243,6 +247,7 @@ foreach($stock as $n=>$v) { case 'judge': $allow_fields = array_keys($report_judges_fields); break; case 'award': $allow_fields = array_keys($report_awards_fields); break; case 'committee':$allow_fields = array_keys($report_committees_fields); break; + case 'school': $allow_fields = array_keys($report_schools_fields); break; } $q = mysql_query("SELECT * FROM reports_items @@ -359,7 +364,7 @@ foreach($stock as $n=>$v) { function report_gen($report) { - global $config, $report_students_fields, $report_judges_fields, $report_awards_fields; + global $config, $report_students_fields, $report_judges_fields, $report_awards_fields, $report_schools_fields; global $stock, $report_committees_fields; global $filter_ops; @@ -369,6 +374,7 @@ foreach($stock as $n=>$v) { case 'judge': $fields = $report_judges_fields; break; case 'award': $fields = $report_awards_fields; break; case 'committee': $fields = $report_committees_fields; break; + case 'school': $fields = $report_schools_fields; break; } $gen_mode = ''; @@ -506,6 +512,7 @@ foreach($stock as $n=>$v) { case 'judge': $q = report_judges_fromwhere($report, $components); break; case 'award': $q = report_awards_fromwhere($report, $components); break; case 'committee': $q = report_committees_fromwhere($report, $components); break; + case 'school': $q = report_schools_fromwhere($report, $components); break; } $q = "SELECT $sel $q $filter_query $group_query ORDER BY $order"; diff --git a/admin/reports_editor.php b/admin/reports_editor.php index a49a269..d44e12e 100644 --- a/admin/reports_editor.php +++ b/admin/reports_editor.php @@ -29,6 +29,7 @@ require_once('reports_judges.inc.php'); require_once('reports_awards.inc.php'); require_once('reports_committees.inc.php'); + require_once('reports_schools.inc.php'); require_once('reports.inc.php'); $fields = array(); @@ -242,6 +243,7 @@ function reportChange() case 'judge': $fields = $report_judges_fields; break; case 'award': $fields = $report_awards_fields; break; case 'committee': $fields = $report_committees_fields; break; + case 'school': $fields = $report_schools_fields; break; } echo "<< ".i18n("Back to Reports")."
"; @@ -281,7 +283,9 @@ function reportChange() echo "Type: "; echo ""; selector('type', array('student' => 'Student Report', 'judge' => 'Judge Report', - 'award' => 'Award Report', 'committee' => 'Committee Member Report'), + 'award' => 'Award Report', 'committee' => 'Committee Member Report', + 'school' => 'School Report' ), + $report['type']); echo ""; diff --git a/admin/reports_schools.inc.php b/admin/reports_schools.inc.php new file mode 100644 index 0000000..2f8662a --- /dev/null +++ b/admin/reports_schools.inc.php @@ -0,0 +1,104 @@ + + 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. +*/ + +$report_schools_fields = array( + 'school' => array( + 'name' => 'School -- Name', + 'header' => 'School Name', + 'width' => 2.25, + 'table' => 'schools.school' ), + + 'schooladdr' => array( + 'name' => 'School -- Full Address', + 'header' => 'School Address', + 'width' => 3.0, + 'table' => "CONCAT(schools.address, ', ', schools.city, ', ', schools.province_code, ', ', schools.postalcode)" ), + + 'school_phone' => array( + 'name' => 'School -- Phone', + 'header' => 'School Phone', + 'width' => 1, + 'table' => 'schools.phone' ), + + 'school_fax' => array( + 'name' => 'School -- Fax', + 'header' => 'School Fax', + 'width' => 1, + 'table' => 'schools.fax' ), + + + 'school_address' => array( + 'name' => 'School Address -- Street Address', + 'header' => 'Address', + 'width' => 2.0, + 'table' => 'schools.address'), + + 'school_city' => array( + 'name' => 'School Address -- City', + 'header' => 'City', + 'width' => 1.5, + 'table' => 'schools.city' ), + + 'school_province' => array( + 'name' => 'School Address -- Province', + 'header' => 'Province', + 'width' => 0.75, + 'table' => 'schools.province_code' ), + + 'school_city_prov' => array( + 'name' => 'School Address -- City, Province (for mailing)', + 'header' => 'City', + 'width' => 1.5, + 'table' => "CONCAT(schools.city, ', ', schools.province_code)" ), + + 'school_postal' => array( + 'name' => 'School Address -- Postal Code', + 'header' => 'Postal', + 'width' => 0.75, + 'table' => 'schools.postalcode' ), + + 'school_board' => array( + 'name' => 'School -- Board ID', + 'header' => 'Board', + 'width' => 0.75, + 'table' => 'schools.board' ), + +); + + function report_schools_fromwhere($report, $components) + { + global $config, $report_schools_fields; + + $fields = $report_schools_fields; + $year = $report['year']; + + $q = " FROM + schools + WHERE + schools.year='$year' + "; + + return $q; +} + +?>