- Add a tour number to the database, and modify the tour editor to include the

number, and an option to create numbers automatically
- Completely remove all references (hopefully) to the Tour ID
- Add a Tour type report
- Rework the student report query so it actually makes sense.  It really should
  be a whole bunch of left joins based on the students.  Using comma (cross)
  joins creates situations where if the right side of the join doesn't have
  information, it wipes out the left side.  (Happened before with emergency
  contact info).
- Remove the (two) old custom tour reports
- Add 4 new tour reports to the database:
	- ALL tours for the committee, tour list for students, 
	student emergency contact info for tour coordinators, and 
	a list of tour assignments for students
This commit is contained in:
dave 2007-12-20 01:05:04 +00:00
parent aa2f8883e3
commit 998fe35d67
13 changed files with 242 additions and 283 deletions

View File

@ -27,6 +27,7 @@
require_once("reports_committees.inc.php"); /* $report_students_fields */ require_once("reports_committees.inc.php"); /* $report_students_fields */
require_once("reports_volunteers.inc.php"); /* $report_volunteers_fields */ require_once("reports_volunteers.inc.php"); /* $report_volunteers_fields */
require_once("reports_schools.inc.php"); require_once("reports_schools.inc.php");
require_once("reports_tours.inc.php");
require_once('../lpdf.php'); require_once('../lpdf.php');
require_once('../lcsv.php'); require_once('../lcsv.php');
@ -252,16 +253,6 @@ foreach($report_stock as $n=>$v) {
'desc' => 'Award Winners', 'desc' => 'Award Winners',
'custom_url' => 'admin/reports_acpresentation.php?type=csv', 'custom_url' => 'admin/reports_acpresentation.php?type=csv',
'creator' => 'The Grant Brothers'); 'creator' => 'The Grant Brothers');
$x++;
$report_custom[$x] = array('id' => $x, 'name' => 'Custom -- Available Tours (CSV)',
'desc' => 'Available Tours',
'custom_url' => 'admin/reports_tours.php?type=csv',
'creator' => 'The Grant Brothers');
$x++;
$report_custom[$x] = array('id' => $x, 'name' => 'Custom -- Participant Tour Choices (CSV)',
'desc' => 'Participant Tour Choices',
'custom_url' => 'admin/reports_tour_selection.php?type=csv',
'creator' => 'The Grant Brothers');
function report_save_field($report, $type, $loc) function report_save_field($report, $type, $loc)
{ {
@ -269,6 +260,7 @@ foreach($report_stock as $n=>$v) {
global $report_students_fields, $report_judges_fields, $report_awards_fields; global $report_students_fields, $report_judges_fields, $report_awards_fields;
global $report_committees_fields, $report_schools_fields; global $report_committees_fields, $report_schools_fields;
global $report_volunteers_fields; global $report_volunteers_fields;
global $report_tours_fields;
$fieldvar = "report_{$report['type']}s_fields"; $fieldvar = "report_{$report['type']}s_fields";
@ -312,6 +304,7 @@ foreach($report_stock as $n=>$v) {
global $allow_options, $report_students_fields, $report_judges_fields; global $allow_options, $report_students_fields, $report_judges_fields;
global $report_committees_fields, $report_awards_fields; global $report_committees_fields, $report_awards_fields;
global $report_schools_fields, $report_volunteers_fields; global $report_schools_fields, $report_volunteers_fields;
global $report_tours_fields;
$report = array(); $report = array();
@ -474,6 +467,7 @@ foreach($report_stock as $n=>$v) {
{ {
global $config, $report_students_fields, $report_judges_fields, $report_awards_fields, $report_schools_fields; global $config, $report_students_fields, $report_judges_fields, $report_awards_fields, $report_schools_fields;
global $report_stock, $report_committees_fields, $report_volunteers_fields; global $report_stock, $report_committees_fields, $report_volunteers_fields;
global $report_tours_fields;
global $filter_ops; global $filter_ops;
//print_r($report); //print_r($report);
@ -718,7 +712,6 @@ foreach($report_stock as $n=>$v) {
} }
if(count($data)) $table['data'][] = $data; if(count($data)) $table['data'][] = $data;
} }
if(count($table['data'])) { if(count($table['data'])) {
$rep->addTable($table); $rep->addTable($table);
} }

View File

@ -32,6 +32,7 @@
require_once('reports_committees.inc.php'); require_once('reports_committees.inc.php');
require_once('reports_schools.inc.php'); require_once('reports_schools.inc.php');
require_once('reports_volunteers.inc.php'); require_once('reports_volunteers.inc.php');
require_once('reports_tours.inc.php');
require_once('reports.inc.php'); require_once('reports.inc.php');
$fields = array(); $fields = array();
@ -291,14 +292,9 @@ function reportChange()
if($n > $n_columns) $n_columns = $n; if($n > $n_columns) $n_columns = $n;
if($colaction == 'add') $n_columns+=3; if($colaction == 'add') $n_columns+=3;
switch($report['type']) { $fieldvar = "report_{$report['type']}s_fields";
case 'student': $fields = $report_students_fields; break; if(isset($$fieldvar)) $fields = $$fieldvar;
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;
case 'volunteer': $fields = $report_volunteers_fields; break;
}
echo "<br />"; echo "<br />";
@ -337,7 +333,8 @@ function reportChange()
echo "<td>"; echo "<td>";
selector('type', array('student' => 'Student Report', 'judge' => 'Judge Report', 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', 'volunteer' => 'Volunteer Report' ), 'school' => 'School Report', 'volunteer' => 'Volunteer Report',
'tour' => 'Tour Report'),
$report['type']); $report['type']);

View File

@ -25,7 +25,6 @@
require_once("../common.inc.php"); require_once("../common.inc.php");
require_once("../user.inc.php"); require_once("../user.inc.php");
user_auth_required('committee', 'admin'); user_auth_required('committee', 'admin');
require_once('reports.inc.php'); require_once('reports.inc.php');
$id = intval($_GET['id']); $id = intval($_GET['id']);

View File

@ -388,6 +388,20 @@ $report_students_fields = array(
'table' => "tours.name", 'table' => "tours.name",
'components' => array('tours')), 'components' => array('tours')),
'tour_assign_num' => array(
'name' => 'Tours -- Assigned Tour Number',
'header' => 'Tour',
'width' => 0.5,
'table' => "tours.num",
'components' => array('tours')),
'tour_assign_numname' => array(
'name' => 'Tours -- Assigned Tour Number and Name',
'header' => 'Tour',
'width' => 4,
'table' => "CONCAT(tours.num,': ', tours.name)",
'components' => array('tours')),
'fair_year' => array ( 'fair_year' => array (
'name' => 'Fair -- Year', 'name' => 'Fair -- Year',
'header' => 'Year', 'header' => 'Year',
@ -471,24 +485,22 @@ $report_students_fields = array(
students.id=emergencycontact.students_id )"; students.id=emergencycontact.students_id )";
} }
$q = " FROM $q = " FROM students
schools, projects $awards_join, projectdivisions, LEFT JOIN registrations ON registrations.id=students.registrations_id
projectcategories, registrations LEFT JOIN schools ON schools.id=students.schools_id
JOIN students ON students.registrations_id=registrations.id LEFT JOIN projects ON projects.registrations_id=students.registrations_id
$partner_join LEFT JOIN projectdivisions ON projectdivisions.id=projects.projectdivisions_id
$emergencycontact_join LEFT JOIN projectcategories ON projectcategories.id=projects.projectcategories_id
LEFT JOIN emergencycontact ON emergencycontact.students_id=students.id
$tour_join $tour_join
$partner_join
WHERE WHERE
schools.id=students.schools_id students.year='$year'
AND projects.registrations_id=students.registrations_id
AND projectdivisions.id=projects.projectdivisions_id
AND projectcategories.id=projects.projectcategories_id
AND (registrations.status='complete' OR registrations.status='paymentpending')
AND students.year='$year'
AND projects.year='$year' AND projects.year='$year'
AND registrations.year='$year' AND registrations.year='$year'
AND projectcategories.year='$year' AND projectcategories.year='$year'
AND projectdivisions.year='$year' AND projectdivisions.year='$year'
AND (registrations.status='complete' OR registrations.status='paymentpending')
$awards_where $awards_where
$tour_where $tour_where
"; ";

View File

@ -1,140 +0,0 @@
<?
/*
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 <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
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");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
require("../lpdf.php");
require("../lcsv.php");
if(!$_GET['type']) $type="csv";
else $type=$_GET['type'];
if($type=="pdf")
{
$rep=new lpdf( i18n($config['fairname']),
i18n("Participant Tour Selections"),
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
);
$rep->newPage();
$rep->setFontSize(11);
}
else if($type=="csv")
{
$rep=new lcsv(i18n("Participant Tour Selections"));
}
$table=array();
$table['header']=array( i18n("Student ID"));
$choicesh=array();
$max = $config['tours_choices_max'];
for($x=0; $x<$max; $x++) {
$choicesh[] = i18n("Choice ".($x+1).($x==0?"(most preferred)":""));
}
$table['header']=array_merge($table['header'],$choicesh);
$table['header'][] = "Name";
$table['header'][] = "Grade";
$table['header'][] = "Email";
/* Load tours */
$tour = array();
$q = mysql_query("SELECT * FROM tours");
while($r = mysql_fetch_object($q)) {
$tour[$r->id] =$r->name;
}
$q=mysql_query("SELECT students_id
FROM
tours_choice
WHERE
year='{$config['FAIRYEAR']}'
ORDER BY tours_choice.rank,tours_choice.tour_id");
$students_done = array();
while($r=mysql_fetch_object($q))
{
// print_r($judge_divs);
// print_r($judge_subdivs);
if($students_done[$r->students_id] == true) continue;
$students_done[$r->students_id] = true;
/* Make sure the student is complete */
$qq = mysql_query("SELECT registrations.status
FROM
students,registrations
WHERE
students.id='{$r->students_id}'
AND students.registrations_id=registrations.id
AND students.year='{$config['FAIRYEAR']}'
AND registrations.year='{$config['FAIRYEAR']}'
");
$rr = mysql_fetch_object($qq);
if($rr->status != 'complete') continue;
$qq = mysql_query("SELECT * FROM tours_choice WHERE ".
" year='".$config['FAIRYEAR']."' AND ".
" students_id='".$r->students_id."' ".
" ORDER BY rank ");
$c = array();
/* Define an array for tour choices */
for($x=0;$x<$max;$x++) {
$c[$x] = '';
}
/* Load up to $max tour choices */
$x = 0;
while($rr = mysql_fetch_object($qq)) {
$c[$x] = $tour[$rr->tour_id];
$x++;
if($x == $max) break;
}
$qq = mysql_query("SELECT * FROM students WHERE ".
" year='".$config['FAIRYEAR']."' AND ".
" id='".$r->students_id."' "
);
$rr = mysql_fetch_object($qq);
$name = $rr->firstname." ".$rr->lastname;
$grade = $rr->grade;
$em = $rr->email;
$tmp=array(
$r->students_id,
);
$tmp = array_merge($tmp,$c);
$tmp[] = $name;
$tmp[] = $grade;
$tmp[] = $em;
// print_r($tmp);
$table['data'][]=$tmp;
}
$rep->addTable($table);
$rep->output();
?>

View File

@ -0,0 +1,97 @@
<?
/*
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 <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
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_tours_fields = array(
'tour_name' => array(
'name' => 'Tour -- Name',
'header' => 'Tour Name',
'width' => 3,
'table' => 'tours.name' ),
'tour_num' => array(
'name' => 'Tour -- Number',
'header' => 'Num',
'width' => 0.75,
'table' => 'tours.num' ),
'tour_desc' => array(
'name' => 'Tour -- Description',
'header' => 'Tour Description',
'width' => 3.0,
'table' => 'tours.description'),
'tour_capacity' => array(
'name' => 'Tour -- Capacity',
'header' => 'Cap',
'width' => 0.4,
'table' => 'tours.capacity' ),
'tour_mingrade' => array(
'name' => 'Tour -- Minimum Grade',
'header' => 'Min Gr.',
'width' => 0.4,
'table' => 'tours.grade_min' ),
'tour_maxgrade' => array(
'name' => 'Tour -- Maximum Grade',
'header' => 'Max Gr.',
'width' => 0.4,
'table' => 'tours.grade_max' ),
'tour_location' => array(
'name' => 'Tour -- Location',
'header' => 'Tour Location',
'width' => 2.0,
'table' => 'tours.location'),
'tour_contact' => array(
'name' => 'Tour -- Contact',
'header' => 'Contact',
'width' => 1.5,
'table' => 'tours.contact' ),
'tour_id' => array(
'name' => 'Tour -- Database ID',
'header' => '#',
'width' => 0.4,
'table' => 'tours.id' ),
);
function report_tours_fromwhere($report, $components)
{
global $config, $report_tours_fields;
$fields = $report_tours_fields;
$year = $report['year'];
$q = " FROM
tours
WHERE
tours.year='$year'
";
return $q;
}
?>

View File

@ -1,100 +0,0 @@
<?
/*
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 <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
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");
require_once("../user.inc.php");
user_auth_required('committee', 'admin');
require("../lpdf.php");
require("../lcsv.php");
if(!$_GET['type']) $type="csv";
else $type=$_GET['type'];
if($type=="pdf")
{
$rep=new lpdf( i18n($config['fairname']),
i18n("Available Tours"),
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
);
$rep->newPage();
$rep->setFontSize(11);
}
else if($type=="csv")
{
$rep=new lcsv(i18n("Available Tours"));
}
$table=array();
$table['header']=array( i18n("ID"),
i18n("Name"),
i18n("Description"),
i18n("Capacity"),
i18n("Minimum Grade"),
i18n("Maximum Grade"),
i18n("Contact"),
i18n("Location"));
$q=mysql_query("SELECT *
FROM
tours
WHERE
year='".$config['FAIRYEAR']."'
ORDER BY
id");
while($r=mysql_fetch_object($q))
{
// print_r($judge_divs);
// print_r($judge_subdivs);
$n = str_replace("\r","", $r->name);
$n = str_replace("\n"," ", $n);
$d = str_replace("\r","", $r->description);
$d = str_replace("\n"," ", $d);
$c = str_replace("\r","", $r->contact);
$c = str_replace("\n"," ", $c);
$l = str_replace("\r","", $r->location);
$l = str_replace("\n"," ", $l);
$tmp=array(
$r->id,
mysql_escape_string($n),
mysql_escape_string($d),
$r->capacity,
$r->grade_min,
$r->grade_max,
mysql_escape_string($c),
mysql_escape_string($l)
);
// print_r($tmp);
$table['data'][]=$tmp;
}
$rep->addTable($table);
$rep->output();
?>

View File

@ -32,11 +32,9 @@
year='{$config['FAIRYEAR']}'"; year='{$config['FAIRYEAR']}'";
$r = mysql_query($query); $r = mysql_query($query);
$tours = array(); $tours = array();
$x = 1;
while($i = mysql_fetch_object($r)) { while($i = mysql_fetch_object($r)) {
$tours[$i->id]['name'] = $i->name; $tours[$i->id]['name'] = $i->name;
$tours[$i->id]['num'] = $x; $tours[$i->id]['num'] = $i->num;
$x++;
} }
if($_GET['action']=='info') { if($_GET['action']=='info') {
@ -172,7 +170,7 @@ function switchinfo()
else $j=i18n("students"); else $j=i18n("students");
echo happy(i18n("%1 %2 added to tour #%3 (%4)",array( echo happy(i18n("%1 %2 added to tour #%3 (%4)",array(
$added,$j,$tours_id,$tours[$tours_id]['name']))); $added,$j,$tours[$tours_id]['num'],$tours[$tours_id]['name'])));
} }
$tours_id = intval($_GET['tours_id']); $tours_id = intval($_GET['tours_id']);
@ -184,7 +182,7 @@ function switchinfo()
AND year='{$config['FAIRYEAR']}' AND year='{$config['FAIRYEAR']}'
AND rank='0'"); AND rank='0'");
echo happy(i18n("Removed student from tour #%1 (%2)",array($tours_id,$tours[$tours_id]['name']))); echo happy(i18n("Removed student from tour #%1 (%2)",array($tours[$tours_id]['num'],$tours[$tours_id]['name'])));
} }
@ -194,7 +192,7 @@ function switchinfo()
tour_id='$tours_id' tour_id='$tours_id'
AND year='{$config['FAIRYEAR']}' AND year='{$config['FAIRYEAR']}'
AND rank='0'"); AND rank='0'");
echo happy(i18n("Emptied all students from tour #%1 (%2)",array($tours_id,$tours[$tours_id]['name']))); echo happy(i18n("Emptied all students from tour #%1 (%2)",array($tours[$tours_id]['num'],$tours[$tours_id]['name'])));
} }

View File

@ -28,11 +28,26 @@
require("../tours.class.php"); require("../tours.class.php");
require("../tableeditor.class.php"); require("../tableeditor.class.php");
send_header("Tour Management", send_header("Tour Management",
array('Committee Main' => 'committee_main.php', array('Committee Main' => 'committee_main.php',
'Administration' => 'admin/index.php', 'Administration' => 'admin/index.php',
'Tours' => 'admin/tours.php') 'Tours' => 'admin/tours.php')
); );
if($_GET['action'] == 'renumber') {
$q = mysql_query("SELECT id FROM tours WHERE year='{$config['FAIRYEAR']}'");
$x = 1;
while($i = mysql_fetch_object($q)) {
mysql_query("UPDATE tours SET num='$x' WHERE id='{$i->id}'");
$x++;
}
echo happy(i18n('Tours successfully renumbered'));
}
?> ?>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
@ -62,6 +77,20 @@ function opentoursinfo(id)
$editor->execute(); $editor->execute();
if($_GET['TableEditorAction'] == '') {
echo i18n('You can automatically erase all the tour numbers and
re-number them (starting from 1) by clicking on the link below.
This will NOT affect any students who have already specified
their tour preferences. It will not change which tours
students have been assigned to (if that has been completed
too). It MAY cause the tour numbers to change, so if you have
already printed reports with the tour numbers on them, they
will need to be re--printed.');
echo '<br /><br />';
echo "<a onclick=\"return confirmClick('Are you sure you re-number ALL the tours?')\" href=\"tours_manager.php?action=renumber\">Renumber ALL Tours</a>";
}
send_footer(); send_footer();
?> ?>

View File

@ -153,13 +153,15 @@ TRACE("Tours...\n");
$tours = array(); $tours = array();
$q=mysql_query("SELECT * FROM tours WHERE year='{$config['FAIRYEAR']}'"); $q=mysql_query("SELECT * FROM tours WHERE year='{$config['FAIRYEAR']}'");
$x=0; $x=0;
/* Index with $x here, because these need to match up with the bucket ids of
* the annealer */
while($r=mysql_fetch_object($q)) { while($r=mysql_fetch_object($q)) {
$tours[$x]['capacity'] = $r->capacity; $tours[$x]['capacity'] = $r->capacity;
$tours[$x]['grade_min'] = $r->grade_min; $tours[$x]['grade_min'] = $r->grade_min;
$tours[$x]['grade_max'] = $r->grade_max; $tours[$x]['grade_max'] = $r->grade_max;
$tours[$x]['id'] = $r->id; $tours[$x]['id'] = $r->id;
$tours[$x]['name'] = $r->name; $tours[$x]['name'] = $r->name;
TRACE(" $x: #{$r->id} {$r->name} (c:{$r->capacity} g:{$r->grade_min}-{$r->grade_max})\n"); TRACE(" ($x) ${$r->id}: #{$r->num} {$r->name} (c:{$r->capacity} g:{$r->grade_min}-{$r->grade_max})\n");
$x++; $x++;
} }
@ -212,7 +214,7 @@ $a->anneal();
/* Record the assignments */ /* Record the assignments */
foreach($tours as $x=>$t) { foreach($tours as $x=>$t) {
TRACE("#{$t['id']} {$t['name']} (c:{$t['capacity']} g:{$t['grade_min']}-{$t['grade_max']})\n"); TRACE("($x) {$t['id']} #{$t['num']} {$t['name']} (c:{$t['capacity']} g:{$t['grade_min']}-{$t['grade_max']})\n");
$sids = $a->bucket[$x]; $sids = $a->bucket[$x];

View File

@ -1 +1 @@
84 85

70
db/db.update.85.sql Normal file
View File

@ -0,0 +1,70 @@
ALTER TABLE `tours` ADD `num` VARCHAR( 16 ) NOT NULL AFTER `name` ;
INSERT INTO `reports` (`id`, `system_report_id`, `name`, `desc`, `creator`, `type`) VALUES
('', '38', 'Tours -- All Tour Information', 'A listing of just the tours and all related info, no student assignments or anything.', 'The Grant Brothers', 'tour');
INSERT INTO `reports_items` (`id`, `reports_id`, `type`, `ord`, `field`, `value`, `x`, `y`, `w`, `h`, `lines`, `face`, `align`) VALUES
('', LAST_INSERT_ID(), 'option', 0, 'type', 'csv', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 1, 'group_new_page', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 2, 'allow_multiline', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 3, 'label_box', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 4, 'label_fairname', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 5, 'label_logo', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 6, 'stock', 'fullpage', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'col', 0, 'tour_num', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'col', 1, 'tour_name', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'col', 2, 'tour_capacity', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'col', 3, 'tour_mingrade', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'col', 4, 'tour_maxgrade', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'col', 5, 'tour_desc', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'col', 6, 'tour_location', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'col', 7, 'tour_contact', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'sort', 0, 'tour_name', '', 0, 0, 0, 0, 0, '', ' ');
INSERT INTO `reports` (`id`, `system_report_id`, `name`, `desc`, `creator`, `type`) VALUES
('', '39', 'Tours -- Available Tours', 'A list of just the tour names and numbers for fair day', 'The Grant Brothers', 'tour');
INSERT INTO `reports_items` (`id`, `reports_id`, `type`, `ord`, `field`, `value`, `x`, `y`, `w`, `h`, `lines`, `face`, `align`) VALUES
('', LAST_INSERT_ID(), 'option', 0, 'type', 'pdf', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 1, 'group_new_page', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 2, 'allow_multiline', 'yes', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 3, 'label_box', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 4, 'label_fairname', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 5, 'label_logo', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 6, 'stock', 'fullpage', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'col', 0, 'tour_num', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'col', 1, 'tour_name', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'sort', 0, 'tour_id', '', 0, 0, 0, 0, 0, '', ' ');
INSERT INTO `reports` (`id`, `system_report_id`, `name`, `desc`, `creator`, `type`) VALUES
('', '40', 'Tours -- Student Emergency Contact Information', 'Emergency contact information for each tour, each tour starting on a new page.', 'The Grant Brothers', 'student');
INSERT INTO `reports_items` (`id`, `reports_id`, `type`, `ord`, `field`, `value`, `x`, `y`, `w`, `h`, `lines`, `face`, `align`) VALUES
('', LAST_INSERT_ID(), 'option', 0, 'type', 'pdf', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 1, 'group_new_page', 'yes', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 2, 'allow_multiline', 'yes', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 3, 'label_box', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 4, 'label_fairname', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 5, 'label_logo', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 6, 'stock', 'fullpage', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'col', 0, 'pn', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'col', 1, 'namefl', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'col', 2, 'emerg_name', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'col', 3, 'emerg_relation', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'col', 4, 'emerg_phone', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'group', 0, 'tour_assign_numname', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'sort', 0, 'last_name', '', 0, 0, 0, 0, 0, '', ' ');
INSERT INTO `reports` (`id`, `system_report_id`, `name`, `desc`, `creator`, `type`) VALUES
('', '41', 'Tours -- Student Tour Assignments', 'Participant and Tour Assignments, grouped by age category, sorted by project number', 'The Grant Brothers', 'student');
INSERT INTO `reports_items` (`id`, `reports_id`, `type`, `ord`, `field`, `value`, `x`, `y`, `w`, `h`, `lines`, `face`, `align`) VALUES
('', LAST_INSERT_ID(), 'option', 0, 'type', 'pdf', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 1, 'group_new_page', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 2, 'allow_multiline', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 3, 'label_box', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 4, 'label_fairname', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 5, 'label_logo', 'no', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'option', 6, 'stock', 'fullpage', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'col', 0, 'pn', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'col', 1, 'namefl', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'col', 2, 'tour_assign_numname', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'group', 0, 'category', '', 0, 0, 0, 0, 0, '', ' '),
('', LAST_INSERT_ID(), 'sort', 0, 'pn', '', 0, 0, 0, 0, 0, '', ' ');

View File

@ -2,6 +2,7 @@
/* Just the fields in the tours table, we use this twice */ /* Just the fields in the tours table, we use this twice */
$tours_fields = array( 'name' => 'Tour Name', $tours_fields = array( 'name' => 'Tour Name',
'num' => 'Tour Number',
'description' => 'Description', 'description' => 'Description',
'capacity' => 'Capacity', 'capacity' => 'Capacity',
'grade_min' => 'Minimum Grade', 'grade_min' => 'Minimum Grade',
@ -21,7 +22,7 @@ function tableEditorSetup($editor)
/* Setup the table editor with the fields we want to display /* Setup the table editor with the fields we want to display
* when displaying a list of tours, and also the type of each * when displaying a list of tours, and also the type of each
* field where required */ * field where required */
$l = array( 'id' => 'ID', $l = array( 'num' => 'Tour Number',
'name' => 'Tour Name', 'name' => 'Tour Name',
'capacity' => 'Capacity', 'capacity' => 'Capacity',
'grade_min' => 'Minimum Grade', 'grade_min' => 'Minimum Grade',
@ -35,6 +36,7 @@ function tableEditorSetup($editor)
$editor->setTable('tours'); $editor->setTable('tours');
$editor->setRecordType('Tour'); $editor->setRecordType('Tour');
$editor->setListFields($l); $editor->setListFields($l);
$editor->setPrimaryKey('id');
$editor->setEditFields($tours_fields); $editor->setEditFields($tours_fields);
$editor->setFieldOptions('year', array( $editor->setFieldOptions('year', array(