Skip to content

Commit

Permalink
Dev: method saveSubmitIfNeeded
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Nov 18, 2016
1 parent 4d8c3c5 commit b28e50b
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -938,6 +938,30 @@ private function saveAllIfNeeded()
}
}

private function saveSubmitIfNeeded()
{
// retrieve datas from local variable
$thissurvey = $this->thissurvey;

if ($thissurvey['active'] == "Y" && Yii::app()->request->getParam('savesubmit') ){
// The response from the save form
// CREATE SAVED CONTROL RECORD USING SAVE FORM INFORMATION
Yii::import("application.libraries.Save");
$cSave = new Save();

$popup = $this->popup = $cSave->savedcontrol();

if (!empty($cSave->aSaveErrors)){
$cSave->showsaveform($thissurvey['sid']); // reshow the form if there is an error
}

$moveResult = $this->moveResult = LimeExpressionManager::GetLastMoveResult(true);
$LEMskipReprocessing = $this->LEMskipReprocessing = true;

// TODO - does this work automatically for token answer persistence? Used to be savedsilent()
}
}

private function runPage()
{

Expand Down Expand Up @@ -977,30 +1001,14 @@ private function runPage()
$this->checkIfFinished(); // If $moveResult == finished, or not, various things to set
$this->displayFirstPageIfNeeded();
$this->saveAllIfNeeded();
$this->saveSubmitIfNeeded();

$move = $this->move;
$moveResult = $this->moveResult;

$totalquestions = $this->totalquestions = $_SESSION['survey_'.$surveyid]['totalquestions']; // Proabably for redata


if ($thissurvey['active'] == "Y" && Yii::app()->request->getParam('savesubmit') ){
// The response from the save form
// CREATE SAVED CONTROL RECORD USING SAVE FORM INFORMATION
Yii::import("application.libraries.Save");
$cSave = new Save();

$popup = $this->popup = $cSave->savedcontrol();

if (!empty($cSave->aSaveErrors)){
$cSave->showsaveform($thissurvey['sid']); // reshow the form if there is an error
}

$moveResult = $this->moveResult = LimeExpressionManager::GetLastMoveResult(true);
$LEMskipReprocessing = $this->LEMskipReprocessing = true;

// TODO - does this work automatically for token answer persistence? Used to be savedsilent()
}

//Now, we check mandatory questions if necessary
//CHECK IF ALL CONDITIONAL MANDATORY QUESTIONS THAT APPLY HAVE BEEN ANSWERED
Expand Down

0 comments on commit b28e50b

Please sign in to comment.