From 683a7e9180f6461aaa77f75674df8711b86f5b39 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 30 Nov 2011 23:26:30 +0000 Subject: [PATCH] Dev EM-based validation and navigation sub-system: Dev Question by Question mode now completely working, including index, and honoring mix of relevance, hidden, and validation (so skips irrelevant questions) git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev_tms@11546 b72ed6b6-b9f8-46b5-92b4-906544132732 --- classes/eval/LimeExpressionManager.php | 153 +++++++++++++++++++++---- group1.php | 60 +++++----- index.php | 2 +- 3 files changed, 163 insertions(+), 52 deletions(-) diff --git a/classes/eval/LimeExpressionManager.php b/classes/eval/LimeExpressionManager.php index 5e5c8284b61..aa197d30bd1 100644 --- a/classes/eval/LimeExpressionManager.php +++ b/classes/eval/LimeExpressionManager.php @@ -39,6 +39,7 @@ class LimeExpressionManager { private $questionSeq2relevance; // keeps relevance in proper sequence so can minimize relevance processing to see what should be see on page and in indexes private $currentGroupSeq; // current Group sequence (0-based index) private $currentQuestionSeq; // for Question-by-Question mode, the 0-based index + private $currentQID; // used in Question-by-Question modecu private $currentQset=NULL; // set of the current set of questions to be displayed - at least one must be relevant private $indexQseq; // array of information needed to generate navigation index in question-by-question mode private $indexGseq; // array of information needed to generate navigation index in group-by-group mode @@ -315,7 +316,7 @@ public static function UnitTestConvertConditionsToRelevance($surveyId=NULL, $qid public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL) { // $now = microtime(true); - + $this->subQrelInfo=array(); // reset it each time this is called $subQrels = array(); // array of sub-question-level relevance equations $validationEqn = array(); @@ -1867,7 +1868,6 @@ static function StartProcessingPage($navigationIndex=false,$allOnOnePage=false,$ $LEM->surveyLogicFile=''; $LEM->navigationIndex=$navigationIndex; $LEM->slang = (isset($_SESSION['s_lang']) ? $_SESSION['s_lang'] : 'en'); - $LEM->subQrelInfo=array(); $LEM->processedRelevance=false; // $LEM->runtimeTimings[] = array(__METHOD__,(microtime(true) - $now)); @@ -2008,6 +2008,7 @@ static function NavigateBackwards($debug=false) 'finished'=>false, 'message'=>$message, 'gseq'=>$LEM->currentGroupSeq, + 'seq'=>$LEM->currentGroupSeq, 'mandViolation'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['mandViolation'] : false), 'valid'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['valid'] : false), 'unansweredSQs'=>$result['unansweredSQs'], @@ -2018,30 +2019,27 @@ static function NavigateBackwards($debug=false) break; case 'question': $LEM->StartProcessingPage(); - if (!$force) - { - $result = $LEM->_ValidateQuestion($LEM->currentQuestionSeq,$debug); - if ($result['mandViolation'] || !$result['valid']) - { - // redisplay the current question - } - } + $LEM->ProcessCurrentResponses(); $message = ''; while (true) { $LEM->currentQset = array(); // reset active list of questions - if (++$LEM->currentQuestionSeq >= $LEM->numQuestions) + if (--$LEM->currentQuestionSeq < 0) { $LEM->runtimeTimings[] = array(__METHOD__,(microtime(true) - $now)); return array( - 'finished'=>true, + 'at_start'=>true, + 'finished'=>false, 'message'=>$message, + 'unansweredSQs'=>(isset($result['unansweredSQs']) ? $result['unansweredSQs'] : ''), + 'invalidSQs'=>(isset($result['invalidSQs']) ? $result['invalidSQs'] : ''), ); } // Set certain variables normally set by StartProcessingGroup() $LEM->groupRelevanceInfo=array(); // TODO only important thing from StartProcessingGroup? $qInfo = $LEM->questionSeq2relevance[$LEM->currentQuestionSeq]; + $LEM->currentQID=$qInfo['qid']; $LEM->currentGroupSeq=$qInfo['groupSeq']; $LEM->groupNum=$qInfo['gid']; if ($LEM->currentGroupSeq > $LEM->maxGroupSeq) { @@ -2063,8 +2061,16 @@ static function NavigateBackwards($debug=false) // display new question $LEM->runtimeTimings[] = array(__METHOD__,(microtime(true) - $now)); return array( + 'at_start'=>false, 'finished'=>false, 'message'=>$message, + 'gseq'=>$LEM->currentGroupSeq, + 'seq'=>$LEM->currentQuestionSeq, + 'qseq'=>$LEM->currentQuestionSeq, + 'mandViolation'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['mandViolation'] : false), + 'valid'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['valid'] : false), + 'unansweredSQs'=>$result['unansweredSQs'], + 'invalidSQs'=>$result['invalidSQs'], ); } } @@ -2139,6 +2145,7 @@ static function NavigateForwards($force=false,$debug=false) { 'finished'=>false, 'message'=>$result['message'], 'gseq'=>$LEM->currentGroupSeq, + 'seq'=>$LEM->currentGroupSeq, 'mandViolation'=>$result['mandViolation'], 'valid'=>$result['valid'], 'unansweredSQs'=>$result['unansweredSQs'], @@ -2157,6 +2164,7 @@ static function NavigateForwards($force=false,$debug=false) { 'finished'=>true, 'message'=>$message, 'gseq'=>$LEM->currentGroupSeq, + 'seq'=>$LEM->currentGroupSeq, 'mandViolation'=>(isset($result['mandViolation']) ? $result['mandViolation'] : false), 'valid'=>(isset($result['valid']) ? $result['valid'] : false), 'unansweredSQs'=>(isset($result['unansweredSQs']) ? $result['unansweredSQs'] : ''), @@ -2179,6 +2187,7 @@ static function NavigateForwards($force=false,$debug=false) { 'finished'=>false, 'message'=>$message, 'gseq'=>$LEM->currentGroupSeq, + 'seq'=>$LEM->currentGroupSeq, 'mandViolation'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['mandViolation'] : false), 'valid'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['valid'] : false), 'unansweredSQs'=>$result['unansweredSQs'], @@ -2189,12 +2198,25 @@ static function NavigateForwards($force=false,$debug=false) { break; case 'question': $LEM->StartProcessingPage(); + $LEM->ProcessCurrentResponses(); if (!$force && $LEM->currentQuestionSeq != -1) { $result = $LEM->_ValidateQuestion($LEM->currentQuestionSeq,$debug); - if ($result['mandViolation'] || !$result['valid']) + if (!is_null($result) && ($result['mandViolation'] || !$result['valid'])) { // redisplay the current question + $LEM->runtimeTimings[] = array(__METHOD__,(microtime(true) - $now)); + return array( + 'finished'=>false, + 'message'=>$result['message'], + 'qseq'=>$LEM->currentQuestionSeq, + 'gseq'=>$LEM->currentGroupSeq, + 'seq'=>$LEM->currentQuestionSeq, + 'mandViolation'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['mandViolation'] : false), + 'valid'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['valid'] : false), + 'unansweredSQs'=>$result['unansweredSQs'], + 'invalidSQs'=>$result['invalidSQs'], + ); } } $message = ''; @@ -2207,12 +2229,20 @@ static function NavigateForwards($force=false,$debug=false) { return array( 'finished'=>true, 'message'=>$message, + 'qseq'=>$LEM->currentQuestionSeq, + 'gseq'=>$LEM->currentGroupSeq, + 'seq'=>$LEM->currentQuestionSeq, + 'mandViolation'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['mandViolation'] : false), + 'valid'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['valid'] : false), + 'unansweredSQs'=>$result['unansweredSQs'], + 'invalidSQs'=>$result['invalidSQs'], ); } // Set certain variables normally set by StartProcessingGroup() $LEM->groupRelevanceInfo=array(); // TODO only important thing from StartProcessingGroup? $qInfo = $LEM->questionSeq2relevance[$LEM->currentQuestionSeq]; + $LEM->currentQID=$qInfo['qid']; $LEM->currentGroupSeq=$qInfo['groupSeq']; $LEM->groupNum=$qInfo['gid']; if ($LEM->currentGroupSeq > $LEM->maxGroupSeq) { @@ -2236,6 +2266,13 @@ static function NavigateForwards($force=false,$debug=false) { return array( 'finished'=>false, 'message'=>$message, + 'qseq'=>$LEM->currentQuestionSeq, + 'gseq'=>$LEM->currentGroupSeq, + 'seq'=>$LEM->currentQuestionSeq, + 'mandViolation'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['mandViolation'] : false), + 'valid'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['valid'] : false), + 'unansweredSQs'=>$result['unansweredSQs'], + 'invalidSQs'=>$result['invalidSQs'], ); } } @@ -2278,6 +2315,7 @@ static function JumpTo($seq,$force=false,$debug=false,$preview=false) { 'finished'=>false, 'message'=>$result['message'], 'gseq'=>$LEM->currentGroupSeq, + 'seq'=>$LEM->currentGroupSeq, 'mandViolation'=>$result['mandViolation'], 'valid'=>$result['valid'], 'unansweredSQs'=>$result['unansweredSQs'], @@ -2297,6 +2335,7 @@ static function JumpTo($seq,$force=false,$debug=false,$preview=false) { 'finished'=>true, 'message'=>$message, 'gseq'=>$LEM->currentGroupSeq, + 'seq'=>$LEM->currentGroupSeq, 'mandViolation'=>(isset($result['mandViolation']) ? $result['mandViolation'] : false), 'valid'=>(isset($result['valid']) ? $result['valid'] : false), 'unansweredSQs'=>(isset($result['unansweredSQs']) ? $result['unansweredSQs'] : ''), @@ -2319,6 +2358,7 @@ static function JumpTo($seq,$force=false,$debug=false,$preview=false) { 'finished'=>false, 'message'=>$message, 'gseq'=>$LEM->currentGroupSeq, + 'seq'=>$LEM->currentGroupSeq, 'mandViolation'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['mandViolation'] : false), 'valid'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['valid'] : false), 'unansweredSQs'=>$result['unansweredSQs'], @@ -2329,12 +2369,25 @@ static function JumpTo($seq,$force=false,$debug=false,$preview=false) { break; case 'question': $LEM->StartProcessingPage(); + $LEM->ProcessCurrentResponses(); if (!$force && $LEM->currentQuestionSeq != -1 && $seq > $LEM->currentQuestionSeq) { $result = $LEM->_ValidateQuestion($LEM->currentQuestionSeq,$debug); if ($result['mandViolation'] || !$result['valid']) { // redisplay the current question + $LEM->runtimeTimings[] = array(__METHOD__,(microtime(true) - $now)); + return array( + 'finished'=>false, + 'message'=>$result['message'], + 'qseq'=>$LEM->currentQuestionSeq, + 'gseq'=>$LEM->currentGroupSeq, + 'seq'=>$LEM->currentQuestionSeq, + 'mandViolation'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['mandViolation'] : false), + 'valid'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['valid'] : false), + 'unansweredSQs'=>$result['unansweredSQs'], + 'invalidSQs'=>$result['invalidSQs'], + ); } } $message = ''; @@ -2348,12 +2401,20 @@ static function JumpTo($seq,$force=false,$debug=false,$preview=false) { return array( 'finished'=>true, 'message'=>$message, + 'qseq'=>$LEM->currentQuestionSeq, + 'gseq'=>$LEM->currentGroupSeq, + 'seq'=>$LEM->currentQuestionSeq, + 'mandViolation'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['mandViolation'] : false), + 'valid'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['valid'] : false), + 'unansweredSQs'=>$result['unansweredSQs'], + 'invalidSQs'=>$result['invalidSQs'], ); } // Set certain variables normally set by StartProcessingGroup() $LEM->groupRelevanceInfo=array(); // TODO only important thing from StartProcessingGroup? $qInfo = $LEM->questionSeq2relevance[$LEM->currentQuestionSeq]; + $LEM->currentQID=$qInfo['qid']; $LEM->currentGroupSeq=$qInfo['groupSeq']; $LEM->groupNum=$qInfo['gid']; if ($LEM->currentGroupSeq > $LEM->maxGroupSeq) { @@ -2365,7 +2426,7 @@ static function JumpTo($seq,$force=false,$debug=false,$preview=false) { $result = $LEM->_ValidateQuestion($LEM->currentQuestionSeq, $debug); $message .= $result['message']; - if (!$result['relevant'] || $result['hidden']) + if (!$preview && (!$result['relevant'] || $result['hidden'])) { // then skip this question - assume already saved? continue; @@ -2377,6 +2438,13 @@ static function JumpTo($seq,$force=false,$debug=false,$preview=false) { return array( 'finished'=>false, 'message'=>$message, + 'qseq'=>$LEM->currentQuestionSeq, + 'gseq'=>$LEM->currentGroupSeq, + 'seq'=>$LEM->currentQuestionSeq, + 'mandViolation'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['mandViolation'] : false), + 'valid'=> (($LEM->maxGroupSeq > $LEM->currentGroupSeq) ? $result['valid'] : false), + 'unansweredSQs'=>$result['unansweredSQs'], + 'invalidSQs'=>$result['invalidSQs'], ); } } @@ -3183,13 +3251,21 @@ function _ValidateQuestion($questionSeq, $debug=false) $LEM->currentQset[$qid] = $qStatus; + $groupSeq = $qInfo['groupSeq']; $LEM->indexQseq[$questionSeq] = array( + 'qid' => $qInfo['qid'], 'qtext' => $qInfo['qtext'], 'qcode' => $qInfo['code'], 'qhelp' => $qInfo['help'], 'anyUnanswered' => ((count($unansweredSQs) > 0) ? true : false), 'anyErrors' => (($qmandViolation || !$qvalid) ? true : false), 'show' => (($qrel && !$qInfo['hidden']) ? true : false), + 'gseq' => $groupSeq, + 'gtext' => $LEM->gseq2info[$groupSeq]['description'], + 'gname' => $LEM->gseq2info[$groupSeq]['group_name'], + 'gid' => $LEM->gseq2info[$groupSeq]['gid'], + 'mandViolation' => $qmandViolation, + 'valid' => $qvalid, ); $_SESSION['relevanceStatus'][$qid] = $qrel; @@ -3243,6 +3319,32 @@ static function GetQuestionIndexInfo() return $LEM->indexQseq; } + /** + * Return entries needed to build the navigation index + * @param $step - if specified, return a single value, otherwise return entire array + * @return - will be either question or group-level, depending upon $surveyMode + */ + static function GetStepIndexInfo($step=NULL) + { + $LEM =& LimeExpressionManager::singleton(); + switch ($LEM->surveyMode) + { + default: + case 'group': + if (is_null($step)) { + return $LEM->indexGseq; + } + return $LEM->indexGseq[$step]; + break; + case 'question': + if (is_null($step)) { + return $LEM->indexQseq; + } + return $LEM->indexQseq[$step]; + break; + } + } + /** * This should be called each time a new group is started, whether on same or different pages. Sets/Clears needed internal parameters. * @param $groupNum - the group number @@ -3685,18 +3787,21 @@ static function GetRelevanceAndTailoringJavaScript() { if ($jsVar == $knownVar['jsName']) { - if ($knownVar['gid']!=$LEM->groupNum) - { - $undeclaredJsVars[] = $jsVar; - $code = $knownVar['sgqa']; - $codeValue = (isset($_SESSION[$code])) ? $_SESSION[$code] : ''; - $undeclaredVal[$jsVar] = $codeValue; + if ($LEM->surveyMode=='group' && $knownVar['gid'] == $LEM->groupNum) { + continue; + } + if ($LEM->surveyMode=='question' && $knownVar['qid'] == $LEM->currentQID) { + continue; + } + $undeclaredJsVars[] = $jsVar; + $code = $knownVar['sgqa']; + $codeValue = (isset($_SESSION[$code])) ? $_SESSION[$code] : ''; + $undeclaredVal[$jsVar] = $codeValue; - if (isset($LEM->jsVar2qid[$jsVar])) { - $qidList[$LEM->jsVar2qid[$jsVar]] = $LEM->jsVar2qid[$jsVar]; - } - break; + if (isset($LEM->jsVar2qid[$jsVar])) { + $qidList[$LEM->jsVar2qid[$jsVar]] = $LEM->jsVar2qid[$jsVar]; } +// break; // why was this here? } } } diff --git a/group1.php b/group1.php index 70ddcd5321d..470c9694446 100644 --- a/group1.php +++ b/group1.php @@ -18,10 +18,11 @@ // 1=timings only // 2=timings + pretty-printed results of validating questions and groups $LEMdebugLevel=0; +$surveyMode = (($thissurvey['format'] == 'G') ? 'group' : 'question'); //Security Checked: POST, GET, SESSION, REQUEST, returnglobal, DB $previewgrp = false; -if (isset($_REQUEST['action']) && ($_REQUEST['action']=='previewgroup')){ +if (isset($_REQUEST['action']) && ($_REQUEST['action']=='previewgroup') && $thissurvey['format'] == 'G'){ $previewgrp = true; } if (isset($_REQUEST['newtest'])) @@ -41,7 +42,7 @@ if (!isset($_SESSION['step'])) // || !$_SESSION['step']) - don't do this for step0, else rebuild the session { $totalquestions = buildsurveysession(); - LimeExpressionManager::StartSurvey($thissurvey['sid'], 'group', ($thissurvey['anonymized']!="N"), true); + LimeExpressionManager::StartSurvey($thissurvey['sid'], $surveyMode, ($thissurvey['anonymized']!="N"), true); $_SESSION['step'] = 0; if(isset($thissurvey['showwelcome']) && $thissurvey['showwelcome'] == 'N') { //If explicitply set, hide the welcome screen @@ -51,7 +52,6 @@ if (!isset($_SESSION['totalsteps'])) {$_SESSION['totalsteps']=0;} if (!isset($_SESSION['maxstep'])) {$_SESSION['maxstep']=0;} - if (!isset($gl)) {$gl=array('null');} $_SESSION['prevstep']=$_SESSION['step']; //Move current step ########################################################################### @@ -79,11 +79,11 @@ if ($moveResult['finished']==true) { $move = 'movesubmit'; } - $_SESSION['step']= $moveResult['gseq']+1; // step is index base 1? + $_SESSION['step']= $moveResult['seq']+1; // step is index base 1 if ($LEMdebugLevel>=2) { $LEMmsg = $moveResult['message']; } - $ginfo = LimeExpressionManager::GetGroupIndexInfo($moveResult['gseq']); + $stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']); } // We do not keep the participant session anymore when the same browser is used to answer a second time a survey (let's think of a library PC for instance). @@ -344,16 +344,16 @@ } $moveResult = LimeExpressionManager::JumpTo($gseq+1,false,($LEMdebugLevel>=2),true); if (isset($moveResult)) { - $_SESSION['step']= $moveResult['gseq']+1; // step is index base 1? + $_SESSION['step']= $moveResult['seq']+1; // step is index base 1? if ($LEMdebugLevel>=2) { $LEMmsg = $moveResult['message']; } } - $ginfo = LimeExpressionManager::GetGroupIndexInfo($moveResult['gseq']); - $gid = $ginfo['gid']; - $groupname = $ginfo['gname']; - $groupdescription = $ginfo['gtext']; + $stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']); + $gid = $stepInfo['gid']; + $groupname = $stepInfo['gname']; + $groupdescription = $stepInfo['gtext']; } else { @@ -365,10 +365,10 @@ } else { - $ginfo = LimeExpressionManager::GetGroupIndexInfo($moveResult['gseq']); - $gid = $ginfo['gid']; - $groupname = $ginfo['gname']; - $groupdescription = $ginfo['gtext']; + $stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']); + $gid = $stepInfo['gid']; + $groupname = $stepInfo['gname']; + $groupdescription = $stepInfo['gtext']; } } @@ -398,10 +398,9 @@ if ((isset($ia[10]) && $ia[10] == $gid) || (!isset($ia[10]) && $ia[5] == $gid)) { - if(IsSet($hideQuestion[$ia[0]]) && $hideQuestion[$ia[0]]==true){ - continue; + if ($surveyMode == 'question' && $ia[0] != $stepInfo['qid']) { + continue; } - $qidattributes=getQuestionAttributes($ia[0],$ia[4]); if ($ia[4] != '*' && ($qidattributes===false || $qidattributes['hidden']==1)) { continue; @@ -424,13 +423,13 @@ //Display the "mandatory" popup if necessary // TMSW - get question-level error messages - don't call **_popup() directly - if ($ginfo['mandViolation'] && $_SESSION['prevstep'] == $_SESSION['step']) + if ($stepInfo['mandViolation'] && $_SESSION['prevstep'] == $_SESSION['step']) { list($mandatorypopup, $popup)=mandatory_popup($ia, $notanswered); } //Display the "validation" popup if necessary - if (!$ginfo['valid'] && $_SESSION['prevstep'] == $_SESSION['step']) + if (!$stepInfo['valid'] && $_SESSION['prevstep'] == $_SESSION['step']) { list($validationpopup, $vpopup)=validation_popup($ia, $notvalidated); } @@ -550,19 +549,19 @@ function checkconditions(value, name, type) echo "\n"; //Display the "mandatory" message on page if necessary -if (isset($showpopups) && $showpopups == 1 && $ginfo['mandViolation'] && $_SESSION['prevstep'] == $_SESSION['step']) +if (isset($showpopups) && $showpopups == 0 && $stepInfo['mandViolation'] && $_SESSION['prevstep'] == $_SESSION['step']) { echo "

" . $clang->gT("One or more mandatory questions have not been answered. You cannot proceed until these have been completed.") . "

"; } //Display the "validation" message on page if necessary -if (isset($showpopups) && $showpopups == 1 && !$ginfo['valid'] && $_SESSION['prevstep'] == $_SESSION['step']) +if (isset($showpopups) && $showpopups == 0 && !$stepInfo['valid'] && $_SESSION['prevstep'] == $_SESSION['step']) { echo "

" . $clang->gT("One or more questions have not been answered in a valid manner. You cannot proceed until these answers are valid.") . "

"; } //Display the "file validation" message on page if necessary -if (isset($showpopups) && $showpopups == 1 && isset($filenotvalidated) && $filenotvalidated == true && $_SESSION['prevstep'] == $_SESSION['step']) +if (isset($showpopups) && $showpopups == 0 && isset($filenotvalidated) && $filenotvalidated == true && $_SESSION['prevstep'] == $_SESSION['step']) { echo "

" . $clang->gT("One or more uploaded files are not in proper format/size. You cannot proceed until these files are valid.") . "

"; } @@ -663,16 +662,23 @@ function checkconditions(value, name, type) echo '

' . $clang->gT("Question index") . '

'; - $groupInfo = LimeExpressionManager::GetGroupIndexInfo(); + $stepIndex = LimeExpressionManager::GetStepIndexInfo(); + $lastGseq=-1; for($v = 0, $n = 0; $n != $_SESSION['maxstep']; ++$n) { - $gInfo = $groupInfo[$n]; + $stepInfo = $stepIndex[$n]; - if (!$gInfo['show']) + if (!$stepInfo['show']) continue; - $sText = FlattenText($gInfo['gname']); - $bGAnsw = !$gInfo['anyUnanswered']; + if ($surveyMode == 'question' && $lastGseq != $stepInfo['gseq']) { + // show the group label + echo '

' . FlattenText($stepInfo['gname']) . "

"; + $lastGseq = $stepInfo['gseq']; + } + + $sText = (($surveyMode == 'group') ? FlattenText($stepInfo['gname']) : FlattenText($stepInfo['qtext'])); + $bGAnsw = !$stepInfo['anyUnanswered']; ++$v; diff --git a/index.php b/index.php index 3a42a488651..d420d76d44b 100644 --- a/index.php +++ b/index.php @@ -898,7 +898,7 @@ require_once("survey.php"); break; case "S": //One at a time - require_once("question.php"); + require_once("group1.php"); // question.php"); break; case "G": //Group at a time require_once("group1.php");