Skip to content

Commit

Permalink
Dev: Save bar for Organize question groups/questions
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Sep 30, 2015
1 parent 2dfffa6 commit a1fa638
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
17 changes: 13 additions & 4 deletions application/controllers/admin/surveyadmin.php
Expand Up @@ -379,17 +379,16 @@ public function view($iSurveyID, $gid = null, $qid = null)

$iSurveyID = sanitize_int($iSurveyID);

$survey = Survey::model()->findByPk($iSurveyID);
$baselang = $survey->language;
$aData['aAdditionalLanguages'] = $survey->additionalLanguages;

// Reinit LEMlang and LEMsid: ensure LEMlang are set to default lang, surveyid are set to this survey id
// Ensure Last GetLastPrettyPrintExpression get info from this sid and default lang
LimeExpressionManager::SetEMLanguage($baselang);
LimeExpressionManager::SetSurveyId($iSurveyID);
LimeExpressionManager::StartProcessingPage(false,true);

$survey = Survey::model()->findByPk($iSurveyID);
$baselang = $survey->language;
$aData['aAdditionalLanguages'] = $survey->additionalLanguages;

$surveyinfo = $survey->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyID.")";
$aData["surveyinfo"] = $surveyinfo;
Expand Down Expand Up @@ -1273,6 +1272,13 @@ public function changeFormat($iSurveyID)
}
}

/**
* Show the form for Organize question groups/questions
*
* @todo Change function name to _showOrganizeGroupsAndQuestions?
* @param int $iSurveyID
* @return void
*/
private function _showReorderForm($iSurveyID)
{
$surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
Expand All @@ -1286,6 +1292,9 @@ private function _showReorderForm($iSurveyID)
$aGrouplist = QuestionGroup::model()->getGroups($iSurveyID);
$initializedReplacementFields = false;

$aData['organizebar']['returnbutton']['url'] = $this->getController()->createUrl("admin/survey/sa/view/", array('surveyid' => $iSurveyID));
$aData['organizebar']['returnbutton']['text'] = gT('return to survey summary');

foreach ($aGrouplist as $iGID => $aGroup)
{
LimeExpressionManager::StartProcessingGroup($aGroup['gid'], false, $iSurveyID);
Expand Down
5 changes: 3 additions & 2 deletions application/core/Survey_Common_Action.php
Expand Up @@ -540,13 +540,14 @@ function _tokenbar($aData)
* @author Olle Haerstedt <olle.haerstedt@limesurvey.org>
*/
function _organizequestionbar($aData) {
if (isset($aData['aGroupsAndQuestions'])) {
if (isset($aData['organizebar'])) {
$this->getController()->renderPartial("/admin/survey/Question/organizequestionbar_view", $aData);
}
}

/**
* Shows admin menu for question
*
* @param int Survey id
* @param int Group id
* @param int Question id
Expand All @@ -556,7 +557,7 @@ function _questionbar($aData)
{
if(isset($aData['questionbar']))
{
if (!is_object($aData['$oSurvey']))
if (!is_object($aData['oSurvey']))
{

$iSurveyID = $aData['surveyid'];
Expand Down
Expand Up @@ -14,7 +14,7 @@
<?php
foreach ($aGroupsAndQuestions as $aGroupAndQuestions)
{?>
<li id='list_g<?php echo $aGroupAndQuestions['gid'];?>' class='group-item' data-level='group'><h4> <?php echo flattenText($aGroupAndQuestions['group_name'],true);?></h4>
<li id='list_g<?php echo $aGroupAndQuestions['gid'];?>' class='group-item' data-level='group'><div class="h4"> <?php echo flattenText($aGroupAndQuestions['group_name'],true);?></div>
<?php if (isset ($aGroupAndQuestions['questions']))
{?>
<ol class='question-list' data-level='question'>
Expand Down

0 comments on commit a1fa638

Please sign in to comment.