- Posts: 3
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
No, never,Marco55 wrote: The ideal behavior would be that the data of every group is updated no matter the position of the user, has someone achieved this?
private function getIndexItemsGroups($type) { if (!$type) { return array(); } $sessionLem = Yii::app()->session["survey_{$this->iSurveyId}"]; if (empty($sessionLem['grouplist'])) { return array(); } //jumps to all unvisited groups $maxreached = $sessionLem['maxstep']; for ($x = 1; $x <= $sessionLem['totalquestions']; $x++) { LimeExpressionManager::JumpTo($x, false, false, false, false); } //returns to current group LimeExpressionManager::JumpTo($sessionLem['step'], false, false, false, false); /* get the step info from LEM : for already seen group : give if error/show and answered ...*/ //$stepInfos = LimeExpressionManager::GetStepIndexInfo(); $stepIndex = array(); foreach ($sessionLem['grouplist'] as $step=>$groupInfo) { /* EM step start at 1, we start at 0*/ $groupInfo['step'] = $step + 1; //$stepInfo = isset($stepInfos[$step]) ? $stepInfos[$step] : array('show'=>true, 'anyUnanswered'=>true, 'anyErrors'=>true); //gets each group individually $stepInfo = LimeExpressionManager::GetStepIndexInfo($groupInfo['gid']); if (($type > 1 || $groupInfo['step'] <= $sessionLem['maxstep'] || true) // && LimeExpressionManager::GroupIsRelevant($groupInfo['gid']) // $stepInfo['show'] is incomplete (for irrelevant group after the 'not submitted due to error group') GroupIsRelevant control it really ) { /* string to EM : leave fix (remove script , flatten other ...) to view */ if (LimeExpressionManager::GroupIsRelevant($groupInfo['gid'])){ $stepIndex[$step] = array( 'gid'=>$groupInfo['gid'], 'text'=>LimeExpressionManager::ProcessString($groupInfo['group_name']), 'description'=>LimeExpressionManager::ProcessString($groupInfo['description']), 'step'=>$groupInfo['step'], 'url'=>Yii::app()->getController()->createUrl("survey/index", array('sid'=>$this->iSurveyId, 'move'=>$groupInfo['step'])), 'submit'=>ls_json_encode(array('move'=>$groupInfo['step'])), 'stepStatus'=>array( 'index-item-before' => ($groupInfo['step'] < $sessionLem['step']), /* did we need a before ? seen seems better */ 'index-item-seen' => ($groupInfo['step'] <= $sessionLem['maxstep']), 'index-item-unanswered' => $stepInfo[$step]['anyUnanswered'], 'index-item-error' => $stepInfo[$step]['anyErrors'], 'index-item-current' => ($groupInfo['step'] == $sessionLem['step']), ), /* order have importance for css : last on is apply */ ); } else { $stepIndex[$step] = array( 'gid'=>$groupInfo['gid'], 'text'=>LimeExpressionManager::ProcessString($groupInfo['group_name']), 'description'=>LimeExpressionManager::ProcessString($groupInfo['description']), 'step'=>$groupInfo['step'], 'url'=>Yii::app()->getController()->createUrl("survey/index", array('sid'=>$this->iSurveyId, 'move'=>$groupInfo['step'])), 'submit'=>ls_json_encode(array('move'=>$groupInfo['step'])), 'stepStatus'=>array( 'index-item-before' => ($groupInfo['step'] < $sessionLem['step']), 'index-item-seen' => ($groupInfo['step'] <= $sessionLem['maxstep']), 'index-item-unanswered' => $stepInfo[$step]['anyUnanswered'], 'index-item-deshabilitado' => true, 'index-item-error' => $stepInfo[$step]['anyErrors'], 'index-item-current' => ($groupInfo['step'] == $sessionLem['step']), ), ); } $stepIndex[$step]['stepStatus']['index-item-error'] = $stepInfo[$step]['anyErrors']; $stepIndex[$step]['stepStatus']['index-item-unanswered'] = $stepInfo[$step]['anyUnanswered']; $aClass = array_filter($stepIndex[$step]['stepStatus']); $stepIndex[$step]['coreClass'] = implode(" ", array_merge(array('index-item'), array_keys($aClass))); } } return $stepIndex; }