forked from science-ation/science-ation
- Don't show the tour capacity to the students
- Filter the tour list by grades - Warn the students that they can't select tours until they select their grade
This commit is contained in:
parent
caeb7cbe78
commit
7a1bc1144f
@ -80,9 +80,19 @@ echo mysql_error();
|
||||
{
|
||||
foreach($_POST['toursel'] AS $students_id=>$ts)
|
||||
{
|
||||
$selarray = array();
|
||||
|
||||
foreach($ts AS $rank=>$tid) {
|
||||
if($tid == -1) continue;
|
||||
|
||||
$x = intval($tid);
|
||||
|
||||
/* If this choice has already been selected, don't record it */
|
||||
if(in_array($x, $selarray)) continue;
|
||||
|
||||
/* Remember this choice in a format that is easily searchable */
|
||||
$selarray[] = $x;
|
||||
|
||||
mysql_query("INSERT INTO tours_choice (registrations_id,students_id,tour_id,year,rank) VALUES (".
|
||||
"'".$_SESSION['registration_id']."', ".
|
||||
"'".intval($students_id)."', ".
|
||||
@ -151,27 +161,22 @@ else if($newstatus=="complete")
|
||||
$min = $config['tours_choices_min'];
|
||||
$max = $config['tours_choices_max'];
|
||||
|
||||
/*
|
||||
if($min == $max) {
|
||||
$t = i18n("Please select %1 tour(s)", array($min));
|
||||
} else if($min == 1) {
|
||||
$t = i18n("Please select up to %1 tours", array($max));
|
||||
} else {
|
||||
$t = i18n("Please select between %1 and %2 tours", array($min, $max));
|
||||
}
|
||||
echo $t." ";
|
||||
echo i18n("by placing a number from 1 (highest preference) to %1 (lowest preference) beside the tours you select", array($config['tours_choices_max']) );
|
||||
*/
|
||||
|
||||
echo "<form method=\"post\" action=\"register_participants_tours.php\">\n";
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
||||
echo "<table>\n";
|
||||
|
||||
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
|
||||
$num_found = mysql_num_rows($q);
|
||||
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
|
||||
if($r->grade <= 0) {
|
||||
echo error(i18n("You must select your grade on the Student Information page before selecting tours"));
|
||||
echo i18n("Go to the"). " <a href=\"register_participants_students.php\">";
|
||||
echo i18n("Student Information");
|
||||
echo "</a>". i18n(" page now."). "<br /><br />";
|
||||
continue;
|
||||
}
|
||||
echo "<table>\n";
|
||||
echo "<tr><td colspan=2>";
|
||||
echo i18n("Tour Selection for")." <b>".$r->firstname." ".$r->lastname;
|
||||
echo "</b></td></tr>";
|
||||
@ -186,6 +191,10 @@ else if($newstatus=="complete")
|
||||
echo "<option $sel value=\"-1\">".i18n("Choose")."</option>";
|
||||
foreach($tours as $id=>$t) {
|
||||
$sel = "";
|
||||
|
||||
/* Don't show this tour as an option if the student is outside the grade range */
|
||||
if($r->grade < $t['grade_min'] || $r->grade > $t['grade_max']) continue;
|
||||
|
||||
if($tour_choice[$r->id][$rank] == $id)
|
||||
$sel = "selected=selected";
|
||||
echo "<option $sel value=\"$id\">{$t['name']}</option>";
|
||||
@ -195,8 +204,8 @@ else if($newstatus=="complete")
|
||||
echo "</td></tr>";
|
||||
}
|
||||
echo "<tr><td> </td><td></td></tr>";
|
||||
echo ("</table>");
|
||||
}
|
||||
echo ("</table>");
|
||||
|
||||
/*
|
||||
$rank = $tour_choice[$r->id];
|
||||
@ -216,8 +225,9 @@ else if($newstatus=="complete")
|
||||
/* Dump the tours */
|
||||
foreach($tours as $id=>$t) {
|
||||
echo i18n("Tour Name").": <b>".i18n($t['name'])."</b><br />";
|
||||
echo i18n("Grade").": <b>".$t['grade_min']." - ".$t['grade_max']."</b>, ";
|
||||
echo i18n("Capacity").": <b>".$t['capacity']."</b> ".i18n("students")."<br />";
|
||||
echo i18n("Grade").": <b>".$t['grade_min']." - ".$t['grade_max']."</b>";
|
||||
// echo i18n(", Capacity").": <b>".$t['capacity']."</b> ".i18n("students");
|
||||
echo "<br />";
|
||||
echo i18n($t['description'])."<br /><br />";
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user