protected function preFilter($filterChain) { $model = new AdminUserModel(); if ($model->test() == false) { $filterChain->controller->redirect(array('login/in')); return false; } return true; // 如果动作不应被执行,此处返回 false }
public function Index() { //check admin login $checkLogin = new UserLoginModel(); if (!$checkLogin->checkUserIsLogined()) { $this->load->helper('url'); redirect(site_url(array('AdminLogin'))); } //end check $temp['title'] = "Danh sách người dùng"; $temp['content_view'] = 'Admin/AdminUser/Index'; $data = new AdminMasterModel(); $content = new AdminUserModel(); $content->Init(); $data->Init($content, adminParentMenuEnum::User, adminChildMenuEnum::ListManagement); $temp['data'] = $data; $this->load->view("Admin/Shared/_Layout", $temp); }
/** * Reverse the migrations. * * @return void */ public function down() { // Schema::dropIfExists(RoleModel::getTableName()); Schema::dropIfExists(AdminUserModel::getTableName()); }
public function relations() { return CMap::mergeArray(parent::relations(), array('cp' => array(self::BELONGS_TO, 'AdminCpModel', 'cp_id', 'select' => 'id, name'))); }
/** * 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 = AdminUserModel::model()->findByPk(new MongoId($id)); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }