Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/LimeSurvey/LimeSurvey
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Feb 4, 2016
2 parents 970a3ee + 78d22b4 commit 3a4177e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
4 changes: 2 additions & 2 deletions application/core/Survey_Common_Action.php
Expand Up @@ -962,8 +962,8 @@ private function _listquestions($aData)
Yii::app()->user->setState('pageSize',(int)$_GET['pageSize']);

// We filter the current survey id
$model['sid'] = $iSurveyID;
$model['language'] = $baselang;
$model->sid = $iSurveyID;
$model->language = $baselang;

$aData['model']=$model;

Expand Down
20 changes: 17 additions & 3 deletions application/models/Question.php
Expand Up @@ -871,16 +871,30 @@ public function search()
$criteria = new CDbCriteria;
$criteria->condition="t.sid=:surveyid AND t.language=:language AND parent_qid=0";
$criteria->params=(array(':surveyid'=>$this->sid,':language'=>$this->language));
$criteria->join='LEFT JOIN {{groups}} AS groups ON ( groups.gid = t.gid AND t.language = groups.language )';
$criteria->join='LEFT JOIN {{groups}} AS groups ON ( groups.gid = t.gid AND t.language = groups.language AND groups.sid = t.sid)';

if($this->group_name != '')
{
$criteria->addCondition('groups.group_name = :group_name');
$criteria->params=(array(':surveyid'=>$this->sid,':language'=>$this->language, ':group_name'=>$this->group_name));
$criteria->params=(array(':group_name'=>$this->group_name));
}

$criteria->compare('title', $this->title, true, 'AND');
$criteria->compare('question', $this->title, true, 'OR');

$criteria2 = new CDbCriteria;
$criteria2->condition="t.sid=:surveyid AND t.language=:language AND parent_qid=0";
$criteria2->params=(array(':surveyid'=>$this->sid,':language'=>$this->language));
$criteria2->join='LEFT JOIN {{groups}} AS groups ON ( groups.gid = t.gid AND t.language = groups.language AND groups.sid = t.sid)';

if($this->group_name != '')
{
$criteria2->addCondition('groups.group_name = :group_name');
$criteria2->params=(array(':group_name'=>$this->group_name));
}

$criteria2->compare('question', $this->title, true, 'AND');

$criteria->mergeWith($criteria2, 'OR');

$dataProvider=new CActiveDataProvider('Question', array(
'criteria'=>$criteria,
Expand Down
5 changes: 3 additions & 2 deletions application/views/admin/survey/Question/listquestions.php
Expand Up @@ -2,7 +2,6 @@
/**
* This file render the list of groups
*/

?>
<?php $pageSize=Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']);?>

Expand Down Expand Up @@ -63,6 +62,8 @@
// Number of row per page selection
'id' => 'question-grid',
'type'=>'striped',


'summaryText'=>gT('Displaying {start}-{end} of {count} result(s).') .' '.sprintf(gT('%s rows per page'),
CHtml::dropDownList(
'pageSize',
Expand Down Expand Up @@ -111,7 +112,7 @@
),

),
'ajaxUpdate' => false,
'ajaxUpdate' => true,
));
?>
</div>
Expand Down

0 comments on commit 3a4177e

Please sign in to comment.