/** * @Author: ANH DUNG Jan 02, 2015 * @Todo: Create Tenancy * @param: $add_property: 1: ADD_EXISTING, 2: ADD_UNLISTED */ public function actionCreateTenancy($add_property) { $this->pageTitle = "Record existing tenancy - " . Yii::app()->params['title']; try { // $mUser = Users::model()->findByPk(Yii::app()->user->id); // $mUser = new Users(); $mTransactions = new ProTransactions(); if (isset($_GET['user_id'])) { // Jan 02, 2014 For backend $type = ProTransactions::FOR_RENT; $listing_id = 0; if (isset($_GET['listing_id'])) { $listing_id = $_GET['listing_id']; } // handle create new if (!isset($_GET['id'])) { $needMore = array('user_id' => $_GET['user_id']); $mTransactions = ProTransactions::CreateNewRecordTransaction($type, $listing_id, $needMore); $this->redirect(array('createTenancy', 'add_property' => $add_property, 'id' => $mTransactions->id, 'type' => $type, 'listing_id' => $listing_id, 'user_id' => $mTransactions->user_id)); } else { $mTransactions = ProTransactions::getByPk($_GET['id']); } // $this->ValidateLinkRecord($add_property, $listing_id); // OPEN IT ProTransactions::GetSomeInfoRecord($mTransactions, $add_property); ProTransactions::HandlePost($mTransactions); } $this->render('record/record_existing_tenancy', array('mTransactions' => $mTransactions, 'actions' => $this->listActionsCanAccess)); } catch (Exception $exc) { // echo $exc->getMessage(); throw new CHttpException(404, 'Invalid Request'); } }
} public function actionDelete_internal($id) { try { if (Yii::app()->request->isPostRequest) { // we only allow deletion via POST request if ($model = $this->loadModelVendorPurchaserDetail($id, 'ProTransactionsInternalCoBroke')) { if ($model->delete()) { Yii::log("Delete record " . print_r($model->attributes, true), 'info'); } } } else { Yii::log("Invalid request. Please do not repeat this request again."); throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } } catch (Exception $e) { Yii::log("Exception " . print_r($e, true), 'error'); throw new CHttpException("Exception " . print_r($e, true)); } } /** * @Author: ANH DUNG Jul 28, 2014 * @Todo: for tenant and landlord submit testimonials */ public function actionSubmitTestimonials() { try { $RoleAllow = array(ROLE_LANDLORD, ROLE_TENANT); if (!in_array(Yii::app()->user->role_id, $RoleAllow)) { $this->redirect(Yii::app()->createAbsoluteUrl('/'));