示例#1
0
 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'];
 }
示例#2
0
 /**
  * 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));
 }