forked from science-ation/science-ation
- 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:
parent
daa3f4bb51
commit
526db97052
@ -58,11 +58,21 @@ $table['header'][] = "Name";
|
|||||||
$table['header'][] = "Grade";
|
$table['header'][] = "Grade";
|
||||||
$table['header'][] = "Email";
|
$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
|
FROM
|
||||||
tours_choice
|
tours_choice
|
||||||
WHERE
|
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))
|
while($r=mysql_fetch_object($q))
|
||||||
{
|
{
|
||||||
@ -70,6 +80,22 @@ while($r=mysql_fetch_object($q))
|
|||||||
// print_r($judge_divs);
|
// print_r($judge_divs);
|
||||||
// print_r($judge_subdivs);
|
// 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 ".
|
$qq = mysql_query("SELECT * FROM tours_choice WHERE ".
|
||||||
" year='".$config['FAIRYEAR']."' AND ".
|
" year='".$config['FAIRYEAR']."' AND ".
|
||||||
" students_id='".$r->students_id."' ".
|
" students_id='".$r->students_id."' ".
|
||||||
@ -82,7 +108,7 @@ while($r=mysql_fetch_object($q))
|
|||||||
/* Load up to $max tour choices */
|
/* Load up to $max tour choices */
|
||||||
$x = 0;
|
$x = 0;
|
||||||
while($rr = mysql_fetch_object($qq)) {
|
while($rr = mysql_fetch_object($qq)) {
|
||||||
$c[$x] = $rr->tour_id;
|
$c[$x] = $tour[$rr->tour_id];
|
||||||
$x++;
|
$x++;
|
||||||
if($x == $max) break;
|
if($x == $max) break;
|
||||||
}
|
}
|
||||||
@ -94,7 +120,7 @@ while($r=mysql_fetch_object($q))
|
|||||||
$rr = mysql_fetch_object($qq);
|
$rr = mysql_fetch_object($qq);
|
||||||
$name = $rr->firstname." ".$rr->lastname;
|
$name = $rr->firstname." ".$rr->lastname;
|
||||||
$grade = $rr->grade;
|
$grade = $rr->grade;
|
||||||
$email = $rr->email;
|
$em = $rr->email;
|
||||||
|
|
||||||
$tmp=array(
|
$tmp=array(
|
||||||
$r->students_id,
|
$r->students_id,
|
||||||
@ -102,7 +128,7 @@ while($r=mysql_fetch_object($q))
|
|||||||
$tmp = array_merge($tmp,$c);
|
$tmp = array_merge($tmp,$c);
|
||||||
$tmp[] = $name;
|
$tmp[] = $name;
|
||||||
$tmp[] = $grade;
|
$tmp[] = $grade;
|
||||||
$tmp[] = $email;
|
$tmp[] = $em;
|
||||||
// print_r($tmp);
|
// print_r($tmp);
|
||||||
$table['data'][]=$tmp;
|
$table['data'][]=$tmp;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user