Skip to content

Commit

Permalink
Fixed issue: Pagination doesn't work properly for the detailed survey…
Browse files Browse the repository at this point in the history
… list.

New feature: Added multi-delete to the detailed survey list.
Update feature: Add hover text to show the whole survey name for the detailed survey list.

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@12016 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Aaron Schmitz committed Jan 12, 2012
1 parent 8e09f2e commit fd43335
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
33 changes: 22 additions & 11 deletions application/controllers/admin/surveyaction.php
Expand Up @@ -499,22 +499,16 @@ public function getSurveys_json()
$clang = $this->getController()->lang;
$dateformatdetails = getDateFormatData(Yii::app()->session['dateformat']);

$page = Yii::app()->request->getPost('page');
$limit = Yii::app()->request->getPost('rows');

$surveys = Survey::model();
//!!! Is this even possible to execute?
if (empty(Yii::app()->session['USER_RIGHT_SUPERADMIN']))
$surveys->permission(Yii::app()->user->getId());
$surveys = $surveys->with('languagesettings', 'owner')->findAll();

$aSurveyEntries->page = $page;
$aSurveyEntries->records = count($surveys);
$aSurveyEntries->total = ceil($aSurveyEntries->records / $limit);
for ($i = 0, $j = ($page - 1) * $limit; $i < $limit && $j < $aSurveyEntries->records; $i++, $j++)
$aSurveyEntries->page = 1;
foreach ($surveys as $rows)
{
$aSurveyEntry = array();
$rows = $surveys[$j];
$rows = array_merge($rows->attributes, $rows->languagesettings->attributes, $rows->owner->attributes);

// Set status
Expand Down Expand Up @@ -557,7 +551,7 @@ public function getSurveys_json()
'<a href="' . $this->getController()->createUrl("/admin/survey/view/surveyid/" . $rows['sid']) . '">' . $rows['sid'] . '</a>';

//Set Title
$aSurveyEntry[] = '<!--' . $rows['surveyls_title'] . '--><a href="' . $this->getController()->createUrl("/admin/survey/view/surveyid/" . $rows['sid']) . '">' . $rows['surveyls_title'] . '</a>';
$aSurveyEntry[] = '<!--' . $rows['surveyls_title'] . '--><a href="' . $this->getController()->createUrl("/admin/survey/view/surveyid/" . $rows['sid']) . '" title="' . $rows['surveyls_title'] . '">' . $rows['surveyls_title'] . '</a>';

//Set Date
Yii::import('application.libraries.Date_Time_Converter', true);
Expand Down Expand Up @@ -618,8 +612,7 @@ public function getSurveys_json()
{
$aSurveyEntry[] = $aSurveyEntry[] = $aSurveyEntry[] = $aSurveyEntry[] = $aSurveyEntry[] = '';
}
$aSurveyEntries->rows[$i]['id'] = $rows['sid'];
$aSurveyEntries->rows[$i]['cell'] = $aSurveyEntry;
$aSurveyEntries->rows[] = array('id' => $rows['sid'], 'cell' => $aSurveyEntry);
}

echo ls_json_encode($aSurveyEntries);
Expand Down Expand Up @@ -659,6 +652,24 @@ public function delete($surveyid, $delete = 'no')
$this->_renderWrappedTemplate($aViewUrls, $aData);
}

/**
* Takes the edit call from the detailed survey view, which either deletes the survey information
*/
function editSurvey_json()
{
$operation = Yii::app()->request->getPost('oper');
$surveyids = Yii::app()->request->getPost('id');
if ($operation == 'del') // If operation is delete , it will delete, otherwise edit it
{
foreach(explode(',',$surveyids) as $surveyid)
{
if (bHasSurveyPermission($surveyid, 'survey', 'delete'))
{
$this->_deleteSurvey($surveyid);
}
}
}
}
/**
* Load editing of local settings of a survey screen.
*
Expand Down
4 changes: 2 additions & 2 deletions application/views/admin/survey/listSurveys_view.php
Expand Up @@ -5,8 +5,8 @@
var delmsg ='<?php $clang->eT("Are you sure you want to delete these surveys?",'js');?>';
var sConfirmationExpireMessage='<?php $clang->eT("Are you sure you want to expire these surveys?",'js');?>';
var sConfirmationArchiveMessage='<?php $clang->eT("This function creates a ZIP archive of several survey archives and can take some time - please be patient! Do you want to continue?",'js');?>';
var jsonUrl = "<?php echo Yii::app()->getController()->createUrl('admin/survey/getSurveys_json'); ?>";
var editUrl = "<?php echo $this->createUrl('admin/survey/surveyactions'); ?>";
var jsonUrl = "<?php echo Yii::app()->getController()->createUrl('/admin/survey/getSurveys_json'); ?>";
var editUrl = "<?php echo $this->createUrl('/admin/survey/editSurvey_json'); ?>";
var colNames = ["<?php $clang->eT("Status") ?>","<?php $clang->eT("SID") ?>","<?php $clang->eT("Survey") ?>","<?php $clang->eT("Date created") ?>","<?php $clang->eT("Owner") ?>","<?php $clang->eT("Access") ?>","<?php $clang->eT("Anonymized responses") ?>","<?php $clang->eT("Full") ?>","<?php $clang->eT("Partial") ?>","<?php $clang->eT("Total") ?>","<?php $clang->eT("Tokens available") ?>","<?php $clang->eT("Response rate") ?>"];
var colModels = [{ "name":"status", "index":"status", "width":15, "align":"center", "sorttype":"string", "sortable": true, "editable":false},
{ "name":"sid", "index":"sid", "sorttype":"int", "sortable": true, "width":25, "align":"center", "editable":false},
Expand Down
2 changes: 1 addition & 1 deletion scripts/admin/listsurvey.js
Expand Up @@ -68,7 +68,7 @@ jQuery("#displaysurveys").jqGrid({
pager: "#pager",
caption: "Surveys",
});
jQuery("#displaysurveys").jqGrid('navGrid','#pager',{ add:false,del:false,edit:false,refresh: false,search: true},{},{},{ msg:delmsg, width : 700 });
jQuery("#displaysurveys").jqGrid('navGrid','#pager',{ add:false,del:true,edit:false,refresh: false,search: true},{},{},{ msg:delmsg, width : 700 });
jQuery("#displaysurveys").jqGrid('filterToolbar', {searchOnEnter : false});
jQuery("#displaysurveys").jqGrid('navButtonAdd','#pager',{
buttonicon:"ui-icon-refresh",
Expand Down

0 comments on commit fd43335

Please sign in to comment.