Skip to content

Commit

Permalink
EM-ize the admin menu bars.
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@12026 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
GautamGupta committed Jan 13, 2012
1 parent b0fa666 commit 1d11a42
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 42 deletions.
27 changes: 12 additions & 15 deletions application/core/Survey_Common_Action.php
Expand Up @@ -59,7 +59,9 @@ public function runWithParams($params)
$params = $this->_addPseudoParams($params);

if (!empty($params['iSurveyId']))
{
LimeExpressionManager::SetSurveyId($params['iSurveyId']); // must be called early - it clears internal cache if a new survey is being used
}

// Check if the method is public and of the action class, not its parents
// ReflectionClass gets us the methods of the class and parent class
Expand Down Expand Up @@ -200,6 +202,10 @@ protected function _renderWrappedTemplate($sAction = '', $aViewUrls = array(), $

if (!empty($aData['surveyid']))
{

LimeExpressionManager::StartProcessingPage(false, Yii::app()->baseUrl); // so can click on syntax highlighting to edit questions
LimeExpressionManager::StartProcessingGroup(!empty($aData['gid']) ? $aData['gid'] : null, false, $aData['surveyid']); // loads list of replacement values available for this group

$this->_surveybar($aData['surveyid'], !empty($aData['gid']) ? $aData['gid'] : null);

if (isset($aData['display']['menu_bars']['surveysummary']))
Expand All @@ -226,6 +232,9 @@ protected function _renderWrappedTemplate($sAction = '', $aViewUrls = array(), $
$this->_questionbar($aData['surveyid'], $aData['gid'], $aData['qid'], !empty($aData['display']['menu_bars']['qid_action']) ? $aData['display']['menu_bars']['qid_action'] : null);
}
}

LimeExpressionManager::FinishProcessingPage();

}
}

Expand Down Expand Up @@ -335,11 +344,7 @@ function _questionbar($iSurveyId, $gid, $qid, $action = null)
$qrrow = array_map('FlattenText', $qrrow);
if (bHasSurveyPermission($iSurveyId, 'surveycontent', 'read'))
{
if (count(Survey::model()->findByPk($iSurveyId)->additionalLanguages) == 0)
{

}
else
if (count(Survey::model()->findByPk($iSurveyId)->additionalLanguages) != 0)
{
Yii::app()->loadHelper('surveytranslator');
$tmp_survlangs = Survey::model()->findByPk($iSurveyId)->additionalLanguages;
Expand Down Expand Up @@ -390,18 +395,9 @@ function _questionbar($iSurveyId, $gid, $qid, $action = null)
$DisplayArray[] = $aAttribute;
}
}
if (is_null($qrrow['relevance']) || trim($qrrow['relevance']) == '')
{
$aData['relevance'] = 1;
}
else
{
LimeExpressionManager::ProcessString("{" . $qrrow['relevance'] . "}", $aData['qid']); // tests Relevance equation so can pretty-print it
$aData['relevance'] = LimeExpressionManager::GetLastPrettyPrintExpression();
}
$aData['advancedsettings'] = $DisplayArray;
$aData['condarray'] = $condarray;
$questionsummary .= $this->getController()->render("/admin/survey/Question/questionbar_view", $aData, true);
$questionsummary .= $this->getController()->render('/admin/survey/Question/questionbar_view', $aData, true);
}
$finaldata['display'] = $questionsummary;

Expand Down Expand Up @@ -864,6 +860,7 @@ function _surveysummary($iSurveyId, $action=null, $gid=null)
$aData['aAdditionalLanguages'] = $aAdditionalLanguages;
$aData['clang'] = $clang;
$aData['surveyinfo'] = $surveyinfo;

$this->getController()->render("/admin/survey/surveySummary_view", $aData);
}

Expand Down
37 changes: 14 additions & 23 deletions application/views/admin/survey/Question/questionbar_view.php
Expand Up @@ -187,15 +187,13 @@
<tr><td><strong>
<?php $clang->eT("Question:"); ?></strong></td><td>
<?php
$junk = array();
templatereplace($qrrow['question']);
echo LimeExpressionManager::GetLastPrettyPrintExpression();
?></td></tr>
<tr><td><strong>
<?php $clang->eT("Help:"); ?></strong></td><td>
<?php
if (trim($qrrow['help'])!=''){
$junk = array();
templatereplace($qrrow['help']);
echo LimeExpressionManager::GetLastPrettyPrintExpression();
} ?>
Expand Down Expand Up @@ -257,36 +255,29 @@
<?php $clang->eT("No"); ?>

<?php } ?>
</td></tr>
</td>
</tr>
<?php } ?>
<?php if (trim($qrrow['relevance']) != '') { ?>
<tr>
<td><?php $clang->eT("Relevance equation:"); ?></td>
<td><?php echo $relevance; ?></td>
<td>
<?php
LimeExpressionManager::ProcessString("{" . $qrrow['relevance'] . "}", $qid); // tests Relevance equation so can pretty-print it
echo LimeExpressionManager::GetLastPrettyPrintExpression();
?>
</td>
</tr>
<?php }
// TMSW Conditions->Relevance: not needed? Or use relevance output or custom EM query to compute this?
if (!is_null($condarray))
{ ?>
<tr>
<td ><strong>
<?php $clang->eT("Other questions having conditions on this question:"); ?>
</strong></td><td>
<?php foreach ($condarray[$qid] as $depqid => $depcid)
{
$listcid=implode("-",$depcid); ?>
<a href='#' onclick="window.open('<?php echo $this->createUrl("admin/conditions/markcid/" . $listcid . "/surveyid/$surveyid/qid/$depqid"); ?>','_top')">[QID: <?php echo $depqid; ?>]</a>
<?php } ?>
</td></tr>
<?php }
<?php } ?>
<?php
$sCurrentCategory='';
foreach ($advancedsettings as $aAdvancedSetting)
{?>
{ ?>
<tr>
<td><?php echo $aAdvancedSetting['caption'];?>:</td>
<td><?php
if ($aAdvancedSetting['i18n']==false) echo $aAdvancedSetting['value']; else echo $aAdvancedSetting[$baselang]['value']?>
</td>
</tr>
<?php
}?>
<?php } ?>
</table>
Expand Up @@ -142,7 +142,8 @@
<td>
<?php echo $grow['group_name']; ?> (<?php echo $grow['gid']; ?>)</td>
</tr>
<tr><td><strong>
<tr>
<td><strong>
<?php $clang->eT("Description:"); ?></strong>
</td>
<td>
Expand All @@ -152,6 +153,19 @@
} ?>
</td>
</tr>
<?php if (trim($grow['grelevance'])!='') { ?>
<tr>
<td><strong>
<?php $clang->eT("Relevance:"); ?></strong>
</td>
<td>
<?php
templatereplace('{' . $grow['grelevance'] . '}');
echo LimeExpressionManager::GetLastPrettyPrintExpression();
?>
</td>
</tr>
<?php } ?>
<?php
if (trim($grow['randomization_group'])!='')
{?>
Expand Down
7 changes: 4 additions & 3 deletions application/views/admin/survey/surveySummary_view.php
Expand Up @@ -27,11 +27,12 @@
</td>
<td>
<?php
if (trim($surveyinfo['surveyls_description'])!='') {
if (trim($surveyinfo['surveyls_description']) != '')
{
templatereplace($surveyinfo['surveyls_description']);
echo LimeExpressionManager::GetLastPrettyPrintExpression();
}
?>
}
?>
</td>
</tr>
<tr>
Expand Down

0 comments on commit 1d11a42

Please sign in to comment.