forked from science-ation/science-ation
- Clean up the participant tour selection. Don't allow participants to select
tours after the assignemnts are done - Always report the Tour status as complete if tour assignments have been done (rank 0 tours exist) - Inform the participant of their tour assignment if assignments are done
This commit is contained in:
parent
7b7c6c0db2
commit
0d0e6bbb0f
@ -251,8 +251,18 @@ function tourStatus($reg_id="")
|
||||
while($s=mysql_fetch_object($q)) {
|
||||
//grab all of their tour prefs
|
||||
$sid = $s->id;
|
||||
$qq=mysql_query("SELECT * FROM tours_choice WHERE students_id='$sid' and year='{$config['FAIRYEAR']}'");
|
||||
$qq=mysql_query("SELECT * FROM tours_choice WHERE students_id='$sid' and year='{$config['FAIRYEAR']}' ORDER BY rank");
|
||||
|
||||
/* See if there's a rank 0 tour (rank 0 == their tour assignment) */
|
||||
$i = mysql_fetch_object($qq);
|
||||
if($i->rank == 0) {
|
||||
/* Yes, there is, no matter what, this student's tour
|
||||
* selection is complete. */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Else, they haven't been assigned a tour, see if they've made
|
||||
* the appropraite selection(s) */
|
||||
$n_tours = mysql_num_rows($qq);
|
||||
|
||||
if( ($n_tours >= $config['tours_choices_min']) && ($n_tours <= $config['tours_choices_max']) ){
|
||||
|
@ -75,7 +75,7 @@ echo mysql_error();
|
||||
else
|
||||
{
|
||||
//first we will delete all their old answer, its easier to delete and re-insert in this case then it would be to find the corresponding answers and update them
|
||||
mysql_query("DELETE FROM tours_choice WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
|
||||
mysql_query("DELETE FROM tours_choice WHERE registrations_id='{$_SESSION['registration_id']}' AND year='{$config['FAIRYEAR']}' AND rank!='0'");
|
||||
if(is_array($_POST['toursel']))
|
||||
{
|
||||
foreach($_POST['toursel'] AS $students_id=>$ts)
|
||||
@ -135,9 +135,11 @@ else if($newstatus=="complete")
|
||||
}
|
||||
|
||||
|
||||
$assigned_tour = 0;
|
||||
$q=mysql_query("SELECT * FROM tours_choice WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if($r->rank == 0) $assigned_tour = $r->tour_id;
|
||||
$tour_choice[$r->students_id][$r->rank] = $r->tour_id;
|
||||
}
|
||||
|
||||
@ -153,6 +155,7 @@ else if($newstatus=="complete")
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
$tours[$r->id]['name'] = $r->name;
|
||||
$tours[$r->id]['num'] = $r->num;
|
||||
$tours[$r->id]['description'] = $r->description;
|
||||
$tours[$r->id]['capacity'] = $r->capacity;
|
||||
$tours[$r->id]['grade_min'] = $r->grade_min;
|
||||
@ -169,8 +172,10 @@ else if($newstatus=="complete")
|
||||
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
|
||||
$num_found = mysql_num_rows($q);
|
||||
|
||||
$print_submit = false;
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
|
||||
echo i18n("Tour Selection for")." <b>{$r->firstname} {$r->lastname}</b>:<br /><br />";
|
||||
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\">";
|
||||
@ -178,10 +183,18 @@ else if($newstatus=="complete")
|
||||
echo "</a>". i18n(" page now."). "<br /><br />";
|
||||
continue;
|
||||
}
|
||||
|
||||
if($assigned_tour > 0) {
|
||||
echo happy(i18n('You have been assigned to a tour. Tour selection is disabled.'));
|
||||
$t = $tours[$assigned_tour];
|
||||
echo i18n("Your Tour").": <b>#{$t['num']}: ".i18n($t['name'])."</b><br />";
|
||||
echo '<span style="font-size: 0.8em;">'.i18n($t['description'])."</span><br /><br />";
|
||||
continue;
|
||||
}
|
||||
$print_submit = true;
|
||||
|
||||
|
||||
echo "<table>\n";
|
||||
echo "<tr><td colspan=2>";
|
||||
echo i18n("Tour Selection for")." <b>".$r->firstname." ".$r->lastname;
|
||||
echo "</b></td></tr>";
|
||||
for($x=0;$x<$max;$x++) {
|
||||
echo "<tr><td align=right>";
|
||||
|
||||
@ -218,19 +231,22 @@ else if($newstatus=="complete")
|
||||
echo "</tr>";
|
||||
$num++;
|
||||
*/
|
||||
echo "<input type=\"submit\" value=\"".i18n("Save Tour Choices")."\" />\n";
|
||||
echo "</form>";
|
||||
if($print_submit == true) {
|
||||
echo "<input type=\"submit\" value=\"".i18n("Save Tour Choices")."\" />\n";
|
||||
}
|
||||
echo "</form>";
|
||||
|
||||
echo "<br /><br />";
|
||||
echo "<h4>".i18n("Tour Descriptions")."</h4><br />";
|
||||
|
||||
/* Dump the tours */
|
||||
echo "<br /><br />";
|
||||
echo "<h4>".i18n("Tour Descriptions")."</h4><br />";
|
||||
|
||||
/* Dump the tours */
|
||||
foreach($tours as $id=>$t) {
|
||||
echo i18n("Tour Name").": <b>".i18n($t['name'])."</b><br />";
|
||||
echo i18n("Tour")." <b>#{$t['num']}</b>: <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");
|
||||
echo "<br />";
|
||||
echo i18n($t['description'])."<br /><br />";
|
||||
echo '<span style="font-size: 0.8em;">'.i18n($t['description'])."</span><br /><br />";
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user