/** * get actions system admin or another type user * @param int $group_id * @param type $className * @return type */ public static function getActions($group_id, $className) { $count = GroupAuth::model()->countByAttributes(array('className' => $className, 'group_id' => $group_id)); if ($count <= 0) { return array(''); } else { $model = GroupAuth::model()->findByAttributes(array('className' => $className, 'group_id' => $group_id))->action; $model = trim($model); $arrayModels = explode(',', $model); $data = array(); for ($i = 0; $i < sizeof($arrayModels); $i++) { $data[$i] = $arrayModels[$i]; } return $data; } }
/** * get actions system admin or another type user * @param int $group_id * @param type $className * @return type */ public static function getActions($group_id, $className) { $group_id = 2; //2 is admin users if ($group_id == 2) { $model = GroupAuth::model()->find("className = '{$className}' AND group_id = {$group_id} OR group_id = 1")->action; } elseif ($group_id == 1) { $model = GroupAuth::model()->find("className = '{$className}' AND group_id = {$group_id}")->action; } $model = trim($model); $arrayModels = explode(',', $model); $data = array(); for ($i = 0; $i < sizeof($arrayModels); $i++) { $data[$i] = $arrayModels[$i]; } return $data; }
public function getDeveloperActions($className = 'default') { $group_id = 1; //1 is developer users $model = GroupAuth::model()->findByAttributes(array('className' => $className, 'group_id' => $group_id))->action; $model = trim($model); $arrayModels = explode(',', $model); $data = array(); for ($i = 0; $i < sizeof($arrayModels); $i++) { $data[$i] = $arrayModels[$i]; } return $data; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = GroupAuth::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }