Skip to content

Commit

Permalink
Dev: added group to survey list
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jul 24, 2017
1 parent d7b92af commit 60537a1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Expand Up @@ -61,11 +61,18 @@
'name' => 'title',
'type' => 'raw',
'value'=>'CHtml::link(flattenText($data->defaultlanguage->surveyls_title), Yii::app()->createUrl("admin/survey/sa/view/",array("surveyid"=>$data->sid)))',
'htmlOptions' => array('class' => 'col-md-4 has-link'),
'htmlOptions' => array('class' => 'col-md-2 has-link'),
'header' => gT('Title'),
'headerHtmlOptions'=>array('class' => 'col-md-4'),
),

array(
'header' => gT('Group'),
'name' => 'group',
'value'=>'$data->surveygroup->title',
'htmlOptions' => array('class' => 'col-md-2 has-link'),
),

array(
'header' => gT('Created'),
'name' => 'creation_date',
Expand Down
10 changes: 8 additions & 2 deletions application/models/Survey.php
Expand Up @@ -249,6 +249,7 @@ public function relations()
'groups' => array(self::HAS_MANY, 'QuestionGroup', 'sid', 'together' => true),
'quotas' => array(self::HAS_MANY, 'Quota', 'sid','order'=>'name ASC'),
'surveymenus' => array(self::HAS_MANY, 'Surveymenu', array('survey_id' => 'sid')),
'surveygroup' => array(self::BELONGS_TO, 'SurveysGroups', array('gsid' => 'gsid'), 'together' => true),
);
}

Expand Down Expand Up @@ -1370,6 +1371,11 @@ public function search()
'desc'=>'t.active desc, t.expires desc',
),

'group'=>array(
'asc' => 'surveygroup.title asc',
'desc' => 'surveygroup.title desc',
),

);
$sort->defaultOrder = array('creation_date' => CSort::SORT_DESC);

Expand All @@ -1379,12 +1385,12 @@ public function search()
// Search filter
$sid_reference = (Yii::app()->db->getDriverName() == 'pgsql' ?' t.sid::varchar' : 't.sid');
$aWithRelations[] = 'owner';
$aWithRelations[] = 'surveygroup';
$criteria->compare($sid_reference, $this->searched_value, true);
$criteria->compare('t.admin', $this->searched_value, true, 'OR');
$criteria->compare('owner.users_name', $this->searched_value, true, 'OR');
$criteria->compare('correct_relation_defaultlanguage.surveyls_title', $this->searched_value, true, 'OR');


$criteria->compare('surveygroup.title', $this->searched_value, true, 'OR');

// Active filter
if(isset($this->active)) {
Expand Down

0 comments on commit 60537a1

Please sign in to comment.