science-ation/admin/reports_tour_selection.php
dave 900dab702d Add Tour selection.
- Admin can use the tour manager to add tours
- Admin can use the config variables to enable tours, and select the min/max number of tour choices.
- Students will see a "Tour Selection" section of registration, which is incomplete until the student has selected at least a minimum number of tours.... actually, this may be broken.. Need to look at it further..
2007-01-09 19:05:23 +00:00

114 lines
2.8 KiB
PHP

<?
/*
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");
auth_required('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";
$q=mysql_query("SELECT DISTINCT students_id
FROM
tours_choice
WHERE
year='".$config['FAIRYEAR']."'");
while($r=mysql_fetch_object($q))
{
// print_r($judge_divs);
// print_r($judge_subdivs);
$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] = $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;
$email = $rr->email;
$tmp=array(
$r->students_id,
);
$tmp = array_merge($tmp,$c);
$tmp[] = $name;
$tmp[] = $grade;
$tmp[] = $email;
// print_r($tmp);
$table['data'][]=$tmp;
}
$rep->addTable($table);
$rep->output();
?>