forked from science-ation/science-ation
- 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:
parent
aa2f8883e3
commit
998fe35d67
@ -27,6 +27,7 @@
|
||||
require_once("reports_committees.inc.php"); /* $report_students_fields */
|
||||
require_once("reports_volunteers.inc.php"); /* $report_volunteers_fields */
|
||||
require_once("reports_schools.inc.php");
|
||||
require_once("reports_tours.inc.php");
|
||||
|
||||
require_once('../lpdf.php');
|
||||
require_once('../lcsv.php');
|
||||
@ -252,16 +253,6 @@ foreach($report_stock as $n=>$v) {
|
||||
'desc' => 'Award Winners',
|
||||
'custom_url' => 'admin/reports_acpresentation.php?type=csv',
|
||||
'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)
|
||||
{
|
||||
@ -269,6 +260,7 @@ foreach($report_stock as $n=>$v) {
|
||||
global $report_students_fields, $report_judges_fields, $report_awards_fields;
|
||||
global $report_committees_fields, $report_schools_fields;
|
||||
global $report_volunteers_fields;
|
||||
global $report_tours_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 $report_committees_fields, $report_awards_fields;
|
||||
global $report_schools_fields, $report_volunteers_fields;
|
||||
global $report_tours_fields;
|
||||
|
||||
$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 $report_stock, $report_committees_fields, $report_volunteers_fields;
|
||||
global $report_tours_fields;
|
||||
global $filter_ops;
|
||||
|
||||
//print_r($report);
|
||||
@ -718,7 +712,6 @@ foreach($report_stock as $n=>$v) {
|
||||
}
|
||||
if(count($data)) $table['data'][] = $data;
|
||||
}
|
||||
|
||||
if(count($table['data'])) {
|
||||
$rep->addTable($table);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
require_once('reports_committees.inc.php');
|
||||
require_once('reports_schools.inc.php');
|
||||
require_once('reports_volunteers.inc.php');
|
||||
require_once('reports_tours.inc.php');
|
||||
require_once('reports.inc.php');
|
||||
|
||||
$fields = array();
|
||||
@ -291,14 +292,9 @@ function reportChange()
|
||||
if($n > $n_columns) $n_columns = $n;
|
||||
if($colaction == 'add') $n_columns+=3;
|
||||
|
||||
switch($report['type']) {
|
||||
case 'student': $fields = $report_students_fields; break;
|
||||
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;
|
||||
}
|
||||
$fieldvar = "report_{$report['type']}s_fields";
|
||||
if(isset($$fieldvar)) $fields = $$fieldvar;
|
||||
|
||||
|
||||
echo "<br />";
|
||||
|
||||
@ -337,7 +333,8 @@ function reportChange()
|
||||
echo "<td>";
|
||||
selector('type', array('student' => 'Student Report', 'judge' => 'Judge 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']);
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
require_once("../common.inc.php");
|
||||
require_once("../user.inc.php");
|
||||
user_auth_required('committee', 'admin');
|
||||
|
||||
require_once('reports.inc.php');
|
||||
|
||||
$id = intval($_GET['id']);
|
||||
|
@ -387,6 +387,20 @@ $report_students_fields = array(
|
||||
'width' => 4,
|
||||
'table' => "tours.name",
|
||||
'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 (
|
||||
'name' => 'Fair -- Year',
|
||||
@ -471,24 +485,22 @@ $report_students_fields = array(
|
||||
students.id=emergencycontact.students_id )";
|
||||
}
|
||||
|
||||
$q = " FROM
|
||||
schools, projects $awards_join, projectdivisions,
|
||||
projectcategories, registrations
|
||||
JOIN students ON students.registrations_id=registrations.id
|
||||
$partner_join
|
||||
$emergencycontact_join
|
||||
$q = " FROM students
|
||||
LEFT JOIN registrations ON registrations.id=students.registrations_id
|
||||
LEFT JOIN schools ON schools.id=students.schools_id
|
||||
LEFT JOIN projects ON projects.registrations_id=students.registrations_id
|
||||
LEFT JOIN projectdivisions ON projectdivisions.id=projects.projectdivisions_id
|
||||
LEFT JOIN projectcategories ON projectcategories.id=projects.projectcategories_id
|
||||
LEFT JOIN emergencycontact ON emergencycontact.students_id=students.id
|
||||
$tour_join
|
||||
$partner_join
|
||||
WHERE
|
||||
schools.id=students.schools_id
|
||||
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'
|
||||
students.year='$year'
|
||||
AND projects.year='$year'
|
||||
AND registrations.year='$year'
|
||||
AND projectcategories.year='$year'
|
||||
AND projectdivisions.year='$year'
|
||||
AND (registrations.status='complete' OR registrations.status='paymentpending')
|
||||
$awards_where
|
||||
$tour_where
|
||||
";
|
||||
|
@ -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();
|
||||
|
||||
?>
|
97
admin/reports_tours.inc.php
Normal file
97
admin/reports_tours.inc.php
Normal 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;
|
||||
}
|
||||
|
||||
?>
|
@ -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();
|
||||
|
||||
?>
|
@ -32,11 +32,9 @@
|
||||
year='{$config['FAIRYEAR']}'";
|
||||
$r = mysql_query($query);
|
||||
$tours = array();
|
||||
$x = 1;
|
||||
while($i = mysql_fetch_object($r)) {
|
||||
$tours[$i->id]['name'] = $i->name;
|
||||
$tours[$i->id]['num'] = $x;
|
||||
$x++;
|
||||
$tours[$i->id]['num'] = $i->num;
|
||||
}
|
||||
|
||||
if($_GET['action']=='info') {
|
||||
@ -172,7 +170,7 @@ function switchinfo()
|
||||
else $j=i18n("students");
|
||||
|
||||
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']);
|
||||
@ -184,7 +182,7 @@ function switchinfo()
|
||||
AND year='{$config['FAIRYEAR']}'
|
||||
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'
|
||||
AND year='{$config['FAIRYEAR']}'
|
||||
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'])));
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,11 +28,26 @@
|
||||
require("../tours.class.php");
|
||||
require("../tableeditor.class.php");
|
||||
|
||||
|
||||
|
||||
send_header("Tour Management",
|
||||
array('Committee Main' => 'committee_main.php',
|
||||
'Administration' => 'admin/index.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">
|
||||
|
||||
@ -62,6 +77,20 @@ function opentoursinfo(id)
|
||||
|
||||
$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();
|
||||
?>
|
||||
|
@ -153,13 +153,15 @@ TRACE("Tours...\n");
|
||||
$tours = array();
|
||||
$q=mysql_query("SELECT * FROM tours WHERE year='{$config['FAIRYEAR']}'");
|
||||
$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)) {
|
||||
$tours[$x]['capacity'] = $r->capacity;
|
||||
$tours[$x]['grade_min'] = $r->grade_min;
|
||||
$tours[$x]['grade_max'] = $r->grade_max;
|
||||
$tours[$x]['id'] = $r->id;
|
||||
$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++;
|
||||
}
|
||||
|
||||
@ -212,7 +214,7 @@ $a->anneal();
|
||||
|
||||
/* Record the assignments */
|
||||
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];
|
||||
|
||||
|
@ -1 +1 @@
|
||||
84
|
||||
85
|
||||
|
70
db/db.update.85.sql
Normal file
70
db/db.update.85.sql
Normal 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, '', ' ');
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
/* Just the fields in the tours table, we use this twice */
|
||||
$tours_fields = array( 'name' => 'Tour Name',
|
||||
'num' => 'Tour Number',
|
||||
'description' => 'Description',
|
||||
'capacity' => 'Capacity',
|
||||
'grade_min' => 'Minimum Grade',
|
||||
@ -21,7 +22,7 @@ function tableEditorSetup($editor)
|
||||
/* Setup the table editor with the fields we want to display
|
||||
* when displaying a list of tours, and also the type of each
|
||||
* field where required */
|
||||
$l = array( 'id' => 'ID',
|
||||
$l = array( 'num' => 'Tour Number',
|
||||
'name' => 'Tour Name',
|
||||
'capacity' => 'Capacity',
|
||||
'grade_min' => 'Minimum Grade',
|
||||
@ -35,6 +36,7 @@ function tableEditorSetup($editor)
|
||||
$editor->setTable('tours');
|
||||
$editor->setRecordType('Tour');
|
||||
$editor->setListFields($l);
|
||||
$editor->setPrimaryKey('id');
|
||||
$editor->setEditFields($tours_fields);
|
||||
|
||||
$editor->setFieldOptions('year', array(
|
||||
|
Loading…
Reference in New Issue
Block a user