Index: group.php =================================================================== --- group.php (revision 7789) +++ group.php (working copy) @@ -59,6 +59,9 @@ } //SEE IF THIS GROUP SHOULD DISPLAY +global $show_empty_group_if_the_last_group_is_hidden; +my $show_empty_group = false; + if (isset($move) && $_SESSION['step'] != 0 && $move != "movesubmit") { while(checkgroupfordisplay($_SESSION['grouplist'][$_SESSION['step']-1][0]) === false) @@ -73,9 +76,19 @@ } if ($_SESSION['step']>$_SESSION['totalsteps']) { - $move = "movesubmit"; - submitanswer(); // complete this answer (submitdate) - break; + // We are skipping groups, but we moved 'off' the last group. + // Now choose to implement an implicit submit (old behaviour), + // or create an empty page giving the user the explicit option to submit. + if (isset($show_empty_group_if_the_last_group_is_hidden) && $show_empty_group_if_the_last_group_is_hidden == true) + { + $show_empty_group = true; + break; + } else + { + $move = "movesubmit"; + submitanswer(); // complete this answer (submitdate) + break; + } } } } @@ -297,10 +310,17 @@ //****************************************************************************************************** //GET GROUP DETAILS -$grouparrayno=$_SESSION['step']-1; -$gid=$_SESSION['grouplist'][$grouparrayno][0]; -$groupname=$_SESSION['grouplist'][$grouparrayno][1]; -$groupdescription=$_SESSION['grouplist'][$grouparrayno][2]; +if ($show_empty_group) { + $gid=-1; // Make sure the gid is unused. This will assure that the foreach (fieldarray as ia) has no effect. + $groupname=$clang->gT("Finalising your survey"); + $groupdescription=$clang->gT("There are no more questions. If you are satisfied, press the button"); +} else +{ + $grouparrayno=$_SESSION['step']-1; + $gid=$_SESSION['grouplist'][$grouparrayno][0]; + $groupname=$_SESSION['grouplist'][$grouparrayno][1]; + $groupdescription=$_SESSION['grouplist'][$grouparrayno][2]; +} require_once("qanda.php"); //This should be qanda.php when finished @@ -376,7 +396,12 @@ } //end iteration -$percentcomplete = makegraph($_SESSION['step'], $_SESSION['totalsteps']); +if ($show_empty_group) { + $percentcomplete = makegraph($_SESSION['totalsteps'], $_SESSION['totalsteps']); +} else +{ + $percentcomplete = makegraph($_SESSION['step'], $_SESSION['totalsteps']); +} $languagechanger = makelanguagechanger(); //READ TEMPLATES, INSERT DATA AND PRESENT PAGE @@ -409,7 +434,12 @@