/** * parameters preparation after a select is executed */ public function afterFind() { switch ($this->options) { case !Yii::app()->user->accessRules === UserGroupsUser::ROOT_ACCESS && !isset(Yii::app()->user->accessRules['userGroups']['admin']['admin']): if ($this->options !== 'CONST' && $this->options !== 'BOOL' && $this->options !== 'GROUP_LIST') { $options = unserialize($this->options); $this->render = $options[$this->value]; } else { $this->render = $this->value; } break; case 'CONST': $this->render = $this->value; break; case 'BOOL': $this->render = CHtml::dropDownList("UserGroupsConfiguration[{$this->id}]", $this->value, array('TRUE' => 'TRUE', 'FALSE' => 'FALSE')); break; case 'GROUP_LIST': $this->render = CHtml::dropDownList("UserGroupsConfiguration[{$this->id}]", $this->value, UserGroupsGroup::groupList()); break; default: $this->render = CHtml::dropDownList("UserGroupsConfiguration[{$this->id}]", $this->value, unserialize($this->options)); break; } if (Yii::app()->controller->module instanceof UserGroupsModule) { $this->description = Yii::t('userGroupsModule.conf_description', '' . $this->description); } parent::afterFind(); }
<?php $this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'ajaxUpdate' => false, 'enableSorting' => false, 'summaryText' => false, 'id' => 'rule-list', 'selectableRows' => 0, 'columns' => array(array('name' => 'Module'), array('name' => 'Controller'), array('name' => 'Read', 'type' => 'raw'), array('name' => 'Write', 'type' => 'raw'), array('name' => 'Admin', 'type' => 'raw')))); if (Yii::app()->user->pbac('userGroups.admin.admin')) { ?> <div class="row"> <?php if ((int) $what === UserGroupsAccess::GROUP) { echo CHtml::label(Yii::t('userGroupsModule.general', 'Group Level'), 'UserGroupsAccess_' . $what . '_level', array('class' => 'inline')) . CHtml::dropDownList('UserGroupsAccess[' . $what . '][level]', $data->level, array_reverse(range(0, Yii::app()->user->level - 1), true)); echo CHtml::label(Yii::t('userGroupsModule.general', 'Home'), 'UserGroupsAccess_' . $what . '_home', array('class' => 'inline')) . CHtml::dropDownList('UserGroupsAccess[' . $what . '][home]', $data->home, UserGroupsAccess::homeList()); echo CHtml::label(Yii::t('userGroupsModule.general', 'Group Name'), 'UserGroupsAccess_' . $what . '_groupname', array('class' => 'inline')); echo CHtml::textField('UserGroupsAccess[' . $what . '][groupname]', $name); } if ((int) $what === UserGroupsAccess::USER) { echo CHtml::label(Yii::t('userGroupsModule.general', 'User Name'), 'UserGroupsAccess_' . $what . '_username', array('class' => 'inline')); echo CHtml::textField('UserGroupsAccess[' . $what . '][username]', $name); echo CHtml::label(Yii::t('userGroupsModule.general', 'Group'), 'UserGroupsAccess_' . $what . '_group_id', array('class' => 'inline')) . CHtml::dropDownList('UserGroupsAccess[' . $what . '][group_id]', $data->group_id, UserGroupsGroup::groupList()); $home_lists = UserGroupsAccess::homeList(); array_unshift($home_lists, Yii::t('userGroupsModule.admin', 'Group Home: {home}', array('{home}' => $data->group_home))); echo CHtml::label(Yii::t('userGroupsModule.general', 'Home'), 'UserGroupsAccess_' . $what . '_home', array('class' => 'inline')) . CHtml::dropDownList('UserGroupsAccess[' . $what . '][home]', $data->home, $home_lists); echo CHtml::label(Yii::t('userGroupsModule.general', 'Email'), 'UserGroupsAccess_' . $what . '_email', array('class' => 'inline')) . CHtml::textField('UserGroupsAccess[' . $what . '][email]', $data->email); } ?> </div> <?php if ($id === 'new' && (int) $what === UserGroupsAccess::USER) { ?> <div class="row"> <?php echo CHtml::label(Yii::t('userGroupsModule.general', 'Password'), 'UserGroupsAccess_' . $what . '_password', array('class' => 'inline')); ?> <?php