Skip to content

Commit

Permalink
Fixed issue #7659: OptOut/OptIn page does not load the related template
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Mar 13, 2013
1 parent 9a4282c commit da57636
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
9 changes: 6 additions & 3 deletions application/controllers/OptinController.php
Expand Up @@ -99,17 +99,20 @@ function actiontokens($surveyid, $token, $langcode = '')
{
$thistpl=getTemplatePath($thissurvey['templatedir']);
}
$this->_renderHtml($html,$thistpl,$clang);
$this->_renderHtml($html,$thistpl,$clang,$thissurvey);
}

private function _renderHtml($html,$thistpl,$clang)
private function _renderHtml($html,$thistpl, $oLanguage, $aSurveyInfo)
{
sendCacheHeaders();
doHeader();
$aSupportData=array('thissurvey'=>$aSurveyInfo, 'clang'=>$oLanguage);
echo templatereplace(file_get_contents($thistpl.DIRECTORY_SEPARATOR.'startpage.pstpl'),array(), $aSupportData);
$data['html'] = $html;
$data['thistpl'] = $thistpl;
$data['clang'] = $clang;
$this->render('/opt_view',$data);
echo templatereplace(file_get_contents($thistpl.DIRECTORY_SEPARATOR.'endpage.pstpl'),array(), $aSupportData);
doFooter();
}

}
9 changes: 6 additions & 3 deletions application/controllers/OptoutController.php
Expand Up @@ -103,7 +103,7 @@ function actiontokens()
$thistpl=getTemplatePath($thissurvey['templatedir']);
}

$this->_renderHtml($html,$thistpl);
$this->_renderHtml($html,$thistpl,$thissurvey);
}

/* This function is run when opting out of the participants system. The other function /optout/token
Expand Down Expand Up @@ -203,16 +203,19 @@ function actionparticipants()
$thistpl=getTemplatePath($thissurvey['templatedir']);
}

$this->_renderHtml($html,$thistpl);
$this->_renderHtml($html,$thistpl, $thissurvey);
}

private function _renderHtml($html,$thistpl)
private function _renderHtml($html, $thistpl, $aSurveyInfo)
{
sendCacheHeaders();
doHeader();
$aSupportData=array('thissurvey'=>$aSurveyInfo);
echo templatereplace(file_get_contents($thistpl.DIRECTORY_SEPARATOR.'startpage.pstpl'),array(), $aSupportData);
$data['html'] = $html;
$data['thistpl'] = $thistpl;
$this->render('/opt_view',$data);
echo templatereplace(file_get_contents($thistpl.DIRECTORY_SEPARATOR.'endpage.pstpl'),array(), $aSupportData);
doFooter();
}

Expand Down
7 changes: 0 additions & 7 deletions application/views/opt_view.php
@@ -1,12 +1,5 @@
<?php
echo templatereplace(file_get_contents("$thistpl/startpage.pstpl"));
echo templatereplace(file_get_contents("$thistpl/survey.pstpl"));
?>
<div id="wrapper"><p id="optoutmessage">
<?php
echo $html;
?>
</p></div>
<?php
echo templatereplace(file_get_contents("$thistpl/endpage.pstpl"));
?>

0 comments on commit da57636

Please sign in to comment.