Skip to content

Commit

Permalink
Dev: update survey's group
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jul 24, 2017
1 parent 7c681c5 commit 91c7822
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
2 changes: 2 additions & 0 deletions application/controllers/admin/database.php
Expand Up @@ -75,6 +75,7 @@ class database extends Survey_Common_Action
'tokenlength' => ['type'=> '', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'adminemail' => ['type'=> '', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'bounce_email' => ['type'=> '', 'default' => false, 'dbname'=>false, 'active'=>true, 'required'=>[]],
'gsid' => ['type'=> '', 'default' => 1, 'dbname'=>false, 'active'=>true, 'required'=>[]],
];
private $updatedFields = [];

Expand Down Expand Up @@ -1028,6 +1029,7 @@ private function actionUpdateSurveyLocaleSettings($iSurveyID)
$oSurvey->expires = $expires;
$oSurvey->startdate = $startdate;
$oSurvey->faxto = $this->_filterEmptyFields($oSurvey,'faxto');
$oSurvey->gsid = $this->_filterEmptyFields($oSurvey,'gsid');
$oSurvey->format = $this->_filterEmptyFields($oSurvey,'format');
$oSurvey->template = $this->_filterEmptyFields($oSurvey,'template');
$oSurvey->assessments = $this->_filterEmptyFields($oSurvey,'assessments');
Expand Down
1 change: 1 addition & 0 deletions application/controllers/admin/surveyadmin.php
Expand Up @@ -1602,6 +1602,7 @@ private function _getGeneralTemplateData($iSurveyID){
}
// Sort users by name
asort($aData['users']);
$aData['aSurveyGroupList'] = SurveysGroups::getSurveyGroupsList();
return $aData;
}

Expand Down
12 changes: 12 additions & 0 deletions application/models/SurveysGroups.php
Expand Up @@ -141,6 +141,18 @@ public function getButtons()
return $button;
}

public static function getSurveyGroupsList()
{
$aSurveyList = [];
$oSurveyGroups = self::model()->findAll();

foreach( $oSurveyGroups as $oSurveyGroup){
$aSurveyList[$oSurveyGroup->gsid] = $oSurveyGroup->title;
}

return $aSurveyList;
}

/**
* Returns the static model of the specified AR class.
* Please note that you should have this exact method in all your CActiveRecord descendants!
Expand Down
Expand Up @@ -229,6 +229,23 @@ function checkSelect2Languages(mylangs)
<?php endif;?>
</div>
<div class="col-md-6 col-sm-12">

<!-- Survey Group -->
<div class="form-group">
<label class="col-sm-3 control-label" for='format'><?php eT("Group:"); ?></label>
<div class="col-sm-9">
<?php $this->widget('yiiwheels.widgets.select2.WhSelect2', array(
'asDropDownList' => true,
'htmlOptions'=>array('style'=>"width: 80%"),
'data' => isset($aSurveyGroupList) ? $aSurveyGroupList : [],
'value' => $oSurvey->gsid,
'name' => 'gsid',
'pluginOptions' => array()
));?>
</div>
</div>


<!-- Format -->
<div class="form-group">
<label class="col-sm-3 control-label" for='format'><?php eT("Format:"); ?></label>
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/surveysgroups/update.php
Expand Up @@ -14,7 +14,7 @@
)
)); ?>

<h3><?php eT('Update SurveysGroups:').$model->title; ?></h3>
<h3><?php eT('Update survey group: '); echo '<strong><em>'.$model->title.'</strong></em>'; ?></h3>

<?php $this->renderPartial('./surveysgroups/_form', array('model'=>$model)); ?>

Expand Down

0 comments on commit 91c7822

Please sign in to comment.