public function getUserLevels($controller) { $values = UserLevels::model()->getListData('id', 'description', true, '`id`<>:t1', array(':t1' => UserLevels::LEVEL_ENGINEER), 'rank desc'); foreach ($values as $k => $v) { $values[$k]; } return $values; }
/** * Get user levels to display in the dropdown list * @param type $controller * @return type */ public function getUserLevels($controller) { $values = UserLevels::model()->getListData('id', 'description', false, '`id`<>:t1', array(':t1' => UserLevels::LEVEL_MEMBER), 'rank desc'); foreach ($values as $k => $v) { if (!$controller->showLink(self::USER_RESOURCE_PREFIX . $k)) { unset($values[$k]); } } return $values; }
/** * Lists all user levels */ public function actionIndex() { $this->hasPrivilege(Acl::ACTION_VIEW); $this->showPageTitle = TRUE; $this->pageTitle = Lang::t($this->resourceLabel . 's'); $this->render('index', array('model' => UserLevels::model()->searchModel(array(), $this->settings[Constants::KEY_PAGINATION], 'rank'))); }
/** * get the forbidden resources for a given user type * @param type $user_level * @return type * @throws CHttpException */ public static function getForbiddenResources($user_level) { $model = UserLevels::model()->loadModel($user_level); if ($model === NULL) { throw new CHttpException(500, 'wrong user type'); } $bannedResources = explode(',', $model->banned_resources); if (!empty($model->banned_resources_inheritance)) { $bannedResources = array_merge($bannedResources, self::getForbiddenResources($model->banned_resources_inheritance)); } return $bannedResources; }