Navigation Menu

Skip to content

Commit

Permalink
Dev: use saveSurvey()
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Feb 23, 2017
1 parent 3e00a3d commit 0c61761
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -385,7 +385,7 @@ public function run($surveyid,$args)

$redata = compact(array_keys(get_defined_vars()));


$popup = $this->popup;
$aPopup=array(); // We can move this part where we want now
if (isset($backpopup))
{
Expand Down Expand Up @@ -415,11 +415,9 @@ public function run($surveyid,$args)
$thissurvey['errorHtml']['hiddenClass'] = $bShowpopups ? "ls-js-hidden ":"";
$thissurvey['errorHtml']['messages'] = $aErrorHtmlMessage;



$_gseq = -1;
foreach ($_SESSION[$LEMsessid]['grouplist'] as $gl)
{
foreach ($_SESSION[$LEMsessid]['grouplist'] as $gl){

$gid = $gl['gid'];
++$_gseq;
$aGroup = array();
Expand Down Expand Up @@ -1180,14 +1178,17 @@ private function saveSubmitIfNeeded()
Yii::import("application.libraries.Save");
$cSave = new Save();

$aResult = $cSave->savedcontrol();

// Try to save survey
$aResult = $cSave->saveSurvey();
if (!$aResult['success']){
$popup = $this->popup = $aResult['aSaveErrors'];
$aPopup = $this->popup = $aResult['aSaveErrors'];
}else{
$popup = $this->popup = $aResult['message'];
$aPopup = $this->popup = array($aResult['message']);
}

Yii::app()->clientScript->registerScript('startPopup',"LSvar.startPopups=".json_encode($aPopup).";",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScript('showStartPopups',"showStartPopups();",CClientScript::POS_END);

// reshow the form if there is an error
if (!empty($aResult['aSaveErrors'])){
$thissurvey['aSaveForm'] = $cSave->getSaveFormDatas($thissurvey['sid']);
Expand Down

0 comments on commit 0c61761

Please sign in to comment.