Skip to content

Commit

Permalink
Dev: added setGroup method
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Mar 30, 2017
1 parent 5e74a1f commit 83566ea
Showing 1 changed file with 29 additions and 20 deletions.
49 changes: 29 additions & 20 deletions application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -116,38 +116,23 @@ public function run($surveyid,$args)
// TODO: move somewhere else
$this->setNotAnsweredAndNotValidated();

$this->setGroup();

}else{
$this->setPreview();
}

$this->moveSubmitIfNeeded();

$aPrivateVariables = $this->getArgs();
extract($aPrivateVariables);

// IF GOT THIS FAR, THEN DISPLAY THE ACTIVE GROUP OF QUESTIONSs
if ( !$previewgrp && !$previewquestion)
{
if (($show_empty_group) || !isset($_SESSION[$LEMsessid]['grouplist'])){
$gid = -1; // Make sure the gid is unused. This will assure that the foreach (fieldarray as ia) has no effect.
$groupname = gT("Submit your answers");
$groupdescription = gT("There are no more questions. Please press the <Submit> button to finish this survey.");
}
else if ($surveyMode != 'survey')
{
$stepInfo = $this->stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']);
$gid = $stepInfo['gid'];
$groupname = $stepInfo['gname'];
$groupdescription = $stepInfo['gtext'];
}
}


$aPrivateVariables = $this->getArgs();
extract($aPrivateVariables);




// NOTE: must stay after GET GROUP DETAIL because of ()$surveyMode == 'group' && $previewgrp) condition touching step
// NOTE: must stay after setPreview because of ()$surveyMode == 'group' && $previewgrp) condition touching step
if ($_SESSION[$LEMsessid]['step'] > $_SESSION[$LEMsessid]['maxstep'])
{
$_SESSION[$LEMsessid]['maxstep'] = $_SESSION[$LEMsessid]['step'];
Expand Down Expand Up @@ -1914,4 +1899,28 @@ private function setPreview()
}
}


private function setGroup()
{
$aPrivateVariables = $this->getArgs();
extract($aPrivateVariables);

if ( !$previewgrp && !$previewquestion)
{
if (($show_empty_group) || !isset($_SESSION[$LEMsessid]['grouplist'])){
$this->gid = -1; // Make sure the gid is unused. This will assure that the foreach (fieldarray as ia) has no effect.
$this->groupname = gT("Submit your answers");
$this->groupdescription = gT("There are no more questions. Please press the <Submit> button to finish this survey.");
}
else if ($surveyMode != 'survey')
{
$stepInfo = $this->stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']);
$this->gid = $stepInfo['gid'];
$this->groupname = $stepInfo['gname'];
$this->groupdescription = $stepInfo['gtext'];
}
}

}

}

0 comments on commit 83566ea

Please sign in to comment.