Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue #12357: Survey List page Variable token replacement
- Loading branch information
LouisGac
committed
May 30, 2018
1 parent
750f0f0
commit 4d83aee
Showing
2 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,6 +228,38 @@ function getLanguageChangerDatasPublicList($sSelectedLanguage) | |
} | ||
} | ||
|
||
/** | ||
* Construct flash message container | ||
* Used in templatereplace to replace {FLASHMESSAGE} in startpage.tstpl | ||
* | ||
* @return string | ||
*/ | ||
function makeFlashMessage() { | ||
global $surveyid; | ||
$html = ""; | ||
|
||
$language = Yii::app()->getLanguage(); | ||
$originalPrefix = Yii::app()->user->getStateKeyPrefix(); | ||
// Bug in Yii? Getting the state-key prefix changes the locale, so set the language manually after. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
LouisGac
Contributor
|
||
Yii::app()->setLanguage($language); | ||
Yii::app()->user->setStateKeyPrefix('frontend'); | ||
|
||
$mapYiiToBootstrapClass = array( | ||
'error' => 'danger', | ||
'success' => 'success', | ||
'notice' => 'info' | ||
// no warning in Yii? | ||
); | ||
|
||
foreach (Yii::app()->user->getFlashes() as $key => $message) { | ||
$html .= "<div class='alert alert-" . $mapYiiToBootstrapClass[$key] . " alert-dismissible flash-" . $key . "'>" . $message . "</div>\n"; | ||
} | ||
|
||
Yii::app()->user->setStateKeyPrefix($originalPrefix); | ||
|
||
return $html; | ||
} | ||
|
||
/** | ||
* checkUploadedFileValidity used in SurveyRuntimeHelper | ||
*/ | ||
|
@@ -1263,8 +1295,8 @@ function renderRenderWayForm($renderWay, array $scenarios, $sTemplateViewPath, $ | |
$thissurvey["aForm"] = $aForm; | ||
$thissurvey['surveyUrl'] = App()->createUrl("/survey/index", array("sid"=>$surveyid)); | ||
$thissurvey['include_content'] = 'userforms'; | ||
|
||
|
||
Yii::app()->twigRenderer->renderTemplateFromFile("layout_user_forms.twig", array('aSurveyInfo'=>$thissurvey), false); | ||
break; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bug in LS : here : https://github.com/LimeSurvey/LimeSurvey/blob/master/application/core/LSYii_Application.php#L111
This set user language always. Strange i think we fix it in 2.7X ?