- Update the custom tour selection report to:

- Only report complete students
	- Use tour names instead of numbers
	- Not use $email as a temp varaible because that actually overwrites the
	  $_SESSION['email'], and logs us out, wtf?
	- Sort by first tour selection
This commit is contained in:
dave 2007-04-03 18:49:29 +00:00
parent daa3f4bb51
commit 526db97052

View File

@ -58,18 +58,44 @@ $table['header'][] = "Name";
$table['header'][] = "Grade";
$table['header'][] = "Email";
$q=mysql_query("SELECT DISTINCT students_id
/* 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']."'");
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."' ".
@ -82,7 +108,7 @@ while($r=mysql_fetch_object($q))
/* Load up to $max tour choices */
$x = 0;
while($rr = mysql_fetch_object($qq)) {
$c[$x] = $rr->tour_id;
$c[$x] = $tour[$rr->tour_id];
$x++;
if($x == $max) break;
}
@ -94,7 +120,7 @@ while($r=mysql_fetch_object($q))
$rr = mysql_fetch_object($qq);
$name = $rr->firstname." ".$rr->lastname;
$grade = $rr->grade;
$email = $rr->email;
$em = $rr->email;
$tmp=array(
$r->students_id,
@ -102,7 +128,7 @@ while($r=mysql_fetch_object($q))
$tmp = array_merge($tmp,$c);
$tmp[] = $name;
$tmp[] = $grade;
$tmp[] = $email;
$tmp[] = $em;
// print_r($tmp);
$table['data'][]=$tmp;
}