diff --git a/application/extensions/admin/survey/ListSurveysWidget/views/listSurveys.php b/application/extensions/admin/survey/ListSurveysWidget/views/listSurveys.php index 0ac87c592fd..f1973011a91 100644 --- a/application/extensions/admin/survey/ListSurveysWidget/views/listSurveys.php +++ b/application/extensions/admin/survey/ListSurveysWidget/views/listSurveys.php @@ -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', diff --git a/application/models/Survey.php b/application/models/Survey.php index cab179ff162..f25c4dfd512 100644 --- a/application/models/Survey.php +++ b/application/models/Survey.php @@ -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), ); } @@ -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); @@ -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)) {