Skip to content

Commit

Permalink
Dev: added renderNoMatchingSurvey()
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Nov 22, 2016
1 parent aa5a2bd commit cfa8e90
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -111,24 +111,19 @@ public function run($surveyid,$args)
// For redata
$aPrivateVariables = $this->getArgs();
extract($aPrivateVariables);

}

// We really need to replace redata get_defined_vars by something else.
$redata = compact(array_keys(get_defined_vars()));

// IF GOT THIS FAR, THEN DISPLAY THE ACTIVE GROUP OF QUESTIONSs
//SEE IF $surveyid EXISTS ####################################################################

//SEE IF $surveyid EXISTS
if ($surveyExists < 1){
//SURVEY DOES NOT EXIST. POLITELY EXIT.
echo templatereplace(file_get_contents($sTemplateViewPath."startpage.pstpl"), array(), $redata);
echo "\t<center><br />\n";
echo "\t" . gT("Sorry. There is no matching survey.") . "<br /></center>&nbsp;\n";
echo templatereplace(file_get_contents($sTemplateViewPath."endpage.pstpl"), array(), $redata);
doFooter();
exit;
$this->renderNoMatchingSurvey($sTemplateViewPath, $redata);
}


createFieldMap($surveyid,'full',false,false,$_SESSION[$LEMsessid]['s_lang']);

//GET GROUP DETAILS
Expand Down Expand Up @@ -669,6 +664,24 @@ private function getArgs()
return $aPrivateVariables;
}



/**
* Show a message "Sorry. There is no matching survey." and exit
* @param string $sTemplateViewPath path of the views to render
* @param array $redata hell
*/
private function renderNoMatchingSurvey($sTemplateViewPath, $redata)
{
//SURVEY DOES NOT EXIST. POLITELY EXIT.
echo templatereplace(file_get_contents($sTemplateViewPath."startpage.pstpl"), array(), $redata);
echo "\t<center><br />\n";
echo "\t" . gT("Sorry. There is no matching survey.") . "<br /></center>&nbsp;\n";
echo templatereplace(file_get_contents($sTemplateViewPath."endpage.pstpl"), array(), $redata);
doFooter();
exit;

}
/**
* Retreive the survey format (mode?)
* TODO: move to survey model
Expand Down

0 comments on commit cfa8e90

Please sign in to comment.