Skip to content

Commit

Permalink
Dev: Refactor the 'question' admin controller in the LimeSurvey Yii p…
Browse files Browse the repository at this point in the history
…ort (GCI2011 By Shitiz Garg)

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11706 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Pieter Jan Speelmans committed Dec 20, 2011
1 parent c4bd252 commit 899c262
Show file tree
Hide file tree
Showing 15 changed files with 1,800 additions and 1,530 deletions.
1,508 changes: 749 additions & 759 deletions application/controllers/admin/question.php

Large diffs are not rendered by default.

26 changes: 14 additions & 12 deletions application/controllers/admin/surveyaction.php
Expand Up @@ -89,7 +89,7 @@ public function run($sa = '', $surveyid = 0)
$iSurveyId = 0;
$message = $clang->gT('You did not choose any surveys.');
if (Survey::model()->findByPk($iSurveyID) === null)
continue;
return;
switch ($sa){
case 'expire':
if ($this->_expireSurvey($iSurveyID)) $actioncount++;;
Expand Down Expand Up @@ -157,7 +157,7 @@ function editsurveysettings($surveyid)
}

$dbprefix = Yii::app()->db->tablePrefix;

$this->controller->_js_admin_includes(Yii::app()->getConfig('generalscripts').'admin/surveysettings.js');
$this->controller->_js_admin_includes(Yii::app()->getConfig('generalscripts').'jquery/jqGrid/js/i18n/grid.locale-en.js');
$this->controller->_js_admin_includes(Yii::app()->getConfig('generalscripts').'jquery/jqGrid/js/jquery.jqGrid.min.js');
Expand All @@ -177,7 +177,7 @@ function editsurveysettings($surveyid)
$esrow = self::_fetchSurveyInfo('editsurvey',$surveyid);
//$esrow = $esrow[0]->tableSchema->columns;
$data['esrow']=$esrow;

$data = array_merge($data,$this->_generalTabEditSurvey($surveyid,$esrow));
$data = array_merge($data,$this->_tabPresentationNavigation($esrow));
$data = array_merge($data,$this->_tabPublicationAccess($esrow));
Expand Down Expand Up @@ -268,7 +268,7 @@ function importsurveyresources()
if ($z->extract($extractdir,$zipfile) != 'OK')
{
$importsurveyresourcesoutput .= "<div class=\"warningheader\">".$clang->gT("Error")."</div><br />\n";
$importsurveyresourcesoutput .= $clang->gT("This file is not a valid ZIP file $CI. Import failed.")."<br /><br />\n";
$importsurveyresourcesoutput .= $clang->gT("This file is not a valid ZIP file $zipfile. Import failed.")."<br /><br />\n";
$importsurveyresourcesoutput .= "<input type='submit' value='".$clang->gT("Back")."' onclick=\"window.open('".$this->getController()->createUrl('admin/survey/editsurveysettings/'.$surveyid)."', '_top')\" />\n";
$importsurveyresourcesoutput .= "</div>\n";
echo($importsurveyresourcesoutput);
Expand Down Expand Up @@ -338,8 +338,8 @@ function importsurveyresources()
elseif (is_null($aErrorFilesInfo) && is_null($aImportedFilesInfo))
{
$importsurveyresourcesoutput .= "<div class=\"warningheader\">".$clang->gT("Error")."</div><br />\n";
$importsurveyresourcesoutput .= $clang->gT("This ZIP $CI contains no valid Resources files. Import failed.")."<br /><br />\n";
$importsurveyresourcesoutput .= $clang->gT("Remember that we do not support subdirectories in ZIP $CIs.")."<br /><br />\n";
$importsurveyresourcesoutput .= $clang->gT("This ZIP $zipfile contains no valid Resources files. Import failed.")."<br /><br />\n";
$importsurveyresourcesoutput .= $clang->gT("Remember that we do not support subdirectories in ZIP $zipfile's.")."<br /><br />\n";
$importsurveyresourcesoutput .= "<input type='submit' value='".$clang->gT("Back")."' onclick=\"window.open('".$this->getController()->createUrl('admin/survey/editsurveysettings/'.$surveyid)."', '_top')\" />\n";
$importsurveyresourcesoutput .= "</div>\n";
echo($importsurveyresourcesoutput);
Expand Down Expand Up @@ -399,7 +399,7 @@ function importsurveyresources()
$importsurveyresourcesoutput .= "<input type='submit' value='".$clang->gT("Back")."' onclick=\"window.open('".$this->getController()->createUrl('admin/survey/sa/editsurveysettings/surveyid/'.$surveyid)."', '_top')\" />\n";
$importsurveyresourcesoutput .= "</div>\n";

$data['display'] = $importlabeloutput;
$data['display'] = $importsurveyresourcesoutput;
$this->getController()->render('/survey_view',$data);
}

Expand Down Expand Up @@ -1076,7 +1076,7 @@ function editlocalsettings($surveyid)
$this->controller->_getAdminHeader();
$this->controller->_showadminmenu($surveyid);;
self::_surveybar($surveyid);

if(bHasSurveyPermission($surveyid,'surveylocale','read'))
{
$editsurvey = '';
Expand Down Expand Up @@ -1129,7 +1129,7 @@ function editlocalsettings($surveyid)
$editsurvey .= "<div id='edittxtele$i'>$eachcontent</div>";
}
$editsurvey .= "</div>";

if(bHasSurveyPermission($surveyid,'surveylocale','update'))
{
$editsurvey .= "<p><input type='submit' class='standardbtn' value='".$clang->gT("Save")."' />\n"
Expand Down Expand Up @@ -1525,7 +1525,7 @@ function _tabPublicationAccess($esrow)
$expires='';
if ($esrow['expires']) {
$items = array($esrow['expires'] ,"Y-m-d H:i:s");

$this->yii->loadLibrary('Date_Time_Converter');
$datetimeobj = new date_time_converter($items) ; //new Date_Time_Converter($esrow['expires'] , "Y-m-d H:i:s");
$expires=$datetimeobj->convert("d.m.Y H:i");
Expand Down Expand Up @@ -1666,18 +1666,19 @@ function _expireSurvey($iSurveyID)
function getUrlParamsJSON($iSurveyID)
{
$iSurveyID = (int)$iSurveyID;
$data = new Object();
$this->yii->loadHelper('database');
$oResult = db_execute_assoc("select '' as act, up.*,q.title, sq.title as sqtitle, q.question, sq.question as sqquestion from {$this->yii->db->tablePrefix}survey_url_parameters up
left join {$this->yii->db->tablePrefix}questions q on q.qid=up.targetqid
left join {$this->yii->db->tablePrefix}questions sq on q.qid=up.targetqid
where up.sid={$iSurveyID}");
$i=0;

foreach ($oResult->readAll() as $oRow)
{
$data->rows[$i]['id']=$oRow['id'];
$oRow['title']= $oRow['title'].': '.ellipsize(FlattenText($oRow['question'],false,true),43,.70);

if ($oRow['sqquestion']!='')
{
echo (' - '.ellipsize(FlattenText($oRow['sqquestion'],false,true),30,.75));
Expand Down Expand Up @@ -1718,6 +1719,7 @@ function insert($iSurveyID=null)
{
if (Yii::app()->session['USER_RIGHT_CREATE_SURVEY'])
{
$clang = $this->getController()->lang;
// Check if survey title was set
if (!$_POST['surveyls_title'])
{
Expand Down

0 comments on commit 899c262

Please sign in to comment.