Skip to content

Commit

Permalink
Dev: added Save::getSaveFormDatas()
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Feb 22, 2017
1 parent 00d35ed commit d6b6cbd
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions application/libraries/Save.php
Expand Up @@ -126,6 +126,37 @@ function showsaveform($iSurveyId)
Yii::app()->end();
}


function getSaveFormDatas($iSurveyId)
{
//Show 'SAVE FORM' only when click the 'Save so far' button the first time, or when duplicate is found on SAVE FORM.
//~ global $errormsg, $thissurvey, $surveyid, $clienttoken, $thisstep;
$thisstep = isset($_SESSION['survey_'.$iSurveyId]['step']) ? $_SESSION['survey_'.$iSurveyId]['step'] : 0;
$clienttoken = isset($_SESSION['survey_'.$iSurveyId]['token']) ? $_SESSION['survey_'.$iSurveyId]['token'] : '';

$oSurvey = Survey::model()->findByPk($iSurveyId);
$sTemplate = $oSurvey->template;
$oTemplate = Template::model()->getInstance($sTemplate);


$aSaveForm['aErrors'] =$this->aSaveErrors;

/* Construction of the form */
$aSaveForm['aCaptcha']['show'] = false;
if(function_exists("ImageCreate") && isCaptchaEnabled('saveandloadscreen', Survey::model()->findByPk($iSurveyId)->usecaptcha)){
$aSaveForm['aCaptcha']['show'] = true;
$aSaveForm['aCaptcha']['sImageUrl'] = Yii::app()->getController()->createUrl('/verification/image',array('sid'=>$iSurveyId));
}

$aSaveForm['hiddenField'] = CHtml::hiddenField('savesubmit','save');

if ($clienttoken){
$aSaveForm['hiddenField'] .= CHtml::hiddenField('token',$clienttoken);
}

return $aSaveForm;
}

function savedcontrol()
{
//This data will be saved to the "saved_control" table with one row per response.
Expand Down

0 comments on commit d6b6cbd

Please sign in to comment.