function isFloorPlanUser() { if (isset(Yii::app()->user->id) && isset($_GET["mid"])) { $count = MapAccount::model()->countByAttributes(array('map_id' => $_GET["mid"], 'account_id' => Yii::app()->user->id)); if ($count > 0 || Yii::app()->user->type == 1) { return true; } } return false; }
/** * 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 $id the ID of the model to be loaded * @return MapAccount the loaded model * @throws CHttpException */ public function loadModel($id) { $model = MapAccount::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }