private function loadComboUserGroup() { $this->loadClass("UserGroupService", "service"); $UserGroupService = new UserGroupService(); $UserGroupList = $UserGroupService->getList(); $arr_combo = array(); if (!is_null($UserGroupList) && count($UserGroupList) > 0) { foreach ($UserGroupList as $item) { $arr_combo[$item->getId()] = $item->getName(); } } $this->data['UserGroupList'] = $arr_combo; }
?> <?php if (CommonService::$TrueFalseStatus['FALSE'] == Yii::app()->user->getState('system_admin')) { echo $form->textField($model, 'product_manager', array('style' => 'width:550px;', 'readonly' => 'readonly', 'class' => 'readonly_field', 'title' => $model->product_manager)); } else { $this->widget('application.extensions.autocomplete.AutoCompleteWidget', array('model' => $model, 'multiline' => true, 'attribute' => 'product_manager', 'htmlOptions' => array('style' => 'width:550px;', 'rows' => 4), 'urlOrData' => TestUser::getSearchUserUrl(), 'config' => '{multiple:true}')); } ?> </div> <div class="row"> <?php echo $form->label($model, 'group_name'); ?> <?php $this->widget('application.extensions.multiSelect.MultiSelectWidget', array('model' => $model, 'attribute' => 'group_name', 'selectOptionData' => UserGroupService::getAllActiveGroup(), 'htmlOptions' => array('style' => 'width:530px;'))); ?> </div> <div class="row"> <?php echo $form->label($model, 'bug_severity'); ?> <?php if (CommonService::$TrueFalseStatus['FALSE'] == Yii::app()->user->getState('system_admin')) { echo $form->textField($model, 'bug_severity', array('style' => 'width:550px;', 'readonly' => 'readonly', 'class' => 'readonly_field', 'title' => $model->bug_severity)) . Yii::t('Product', 'Please contact with system admin to modify'); } else { echo $form->textField($model, 'bug_severity', array('style' => 'width:550px;', 'class' => 'required', 'title' => $model->bug_severity)) . Yii::t('Product', 'Seperate with comma, save value is 1,2,3,4...'); } ?> </div>
public static function isManager($userId) { $managedProductIdArr = self::getManagedProduct($userId); if (!empty($managedProductIdArr)) { return CommonService::$TrueFalseStatus['TRUE']; } $managedGroupIdArr = UserGroupService::getManagedGroup($userId); if (!empty($managedGroupIdArr)) { return CommonService::$TrueFalseStatus['TRUE']; } return CommonService::$TrueFalseStatus['FALSE']; }
/** * Lists all models. */ public function actionIndex() { $pageSize = CommonService::getPageSize(); $criteria = new CDbCriteria(); if (CommonService::$TrueFalseStatus['FALSE'] == Yii::app()->user->getState('system_admin')) { $managedgroups = UserGroupService::getManagedGroup(Yii::app()->user->id); $criteria->addInCondition('id', $managedgroups); } $name = ''; if (isset($_GET['name'])) { $name = $_GET['name']; $criteria->addSearchCondition('name', $name); } $dataProvider = new CActiveDataProvider('UserGroup', array('criteria' => $criteria, 'sort' => array('defaultOrder' => array('id' => true)), 'pagination' => array('pageSize' => $pageSize))); $this->render('index', array('dataProvider' => $dataProvider, 'name' => $name)); }