*/ protected function beforeAction($action) { $this->CheckLogin(); return parent::beforeAction($action); } /** * <Jason> * <To added a document into gridview in tenancy details page> */ public function actionUploadDocument() { try { $model = new ProTransactionsPropertyDocument('upload'); if (isset($_POST['ProTransactionsPropertyDocument'])) { $model->attributes = $_POST['ProTransactionsPropertyDocument']; $model->transactions_id = $_GET['transaction_id']; $model->user_id = Yii::app()->user->id; $model->file_name = CUploadedFile::getInstance($model, 'file_name'); if ($model->validate()) { if (!$model->getErrors()) { if ($model->save()) { if (!is_null($model->file_name)) { $model->file_name = ProTransactionsPropertyDocument::saveFile($model, 'file_name', ProTransactionsPropertyDocument::$folderUpload, $model->order_no); $model->update(array('file_name')); } Yii::app()->user->setFlash('success', "Your report defect has been insert successfully!"); $model->title = ''; die('<script type="text/javascript">parent.$.fancybox.close(); parent.fnUpdateGridView("#document-grid"); </script>');
/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionView($id) { try { $mTransactions = $this->loadModel($id); $mTransactions->mBillTo = $mTransactions->rBillTo ? $mTransactions->rBillTo : new ProTransactionsBillTo(); $mTransactions->mPropertyDetail = $mTransactions->rPropertyDetail ? $mTransactions->rPropertyDetail : new ProTransactionsPropertyDetail(); $mTransactions->aModelPropertyDocument = count($mTransactions->rPropertyDocument) ? $mTransactions->rPropertyDocument : ProTransactionsPropertyDocument::getDefaultArrayForCreate($mTransactions->type); $this->render('view', array('mTransactions' => $mTransactions, 'actions' => $this->listActionsCanAccess)); } catch (Exception $e) { Yii::log("Exception " . print_r($e, true), 'error'); throw new CHttpException("Exception " . print_r($e, true)); } }
} ?> <tr> <td class="first"><?php echo $key + 1; ?> </td> <td class="td_title"> <span class="text_title"><?php echo $item->title; ?> </span> </td> <td class="td_file last"> <a href="<?php echo ProTransactionsPropertyDocument::getLinkDownDocument($item); ?> " target="_blank"> <?php echo $item->file_name; ?> </a> </td> </tr> <?php } ?> </tbody> </table> </div><!-- end form-type content --> </div><!-- end box-1 space-3-->
$model_PropertyDocument = ProTransactionsPropertyDocument::getDefaultArrayForCreate($type); } foreach ($model_PropertyDocument as $key => $item) { ?> <?php $display_none = 'display_none'; $display_none_title = ''; $delete_class = 'delete_item_file'; if ($key > 2) { $display_none = ''; $display_none_title = 'display_none'; $delete_class = 'delete_item_upload'; } if (isset($_GET['id'])) { $id_trans = $_GET['id']; $file_name = ProTransactionsPropertyDocument::getDocumentOfTransactionAndTitle($id_trans, $item->title); if ($file_name) { $display_none = 'display_none'; $display_none_title = ''; $delete_class = 'delete_item_upload_record'; } } ?> <tr> <td class="first"><?php echo $key + 1; ?> </td> <td class="td_title"> <span class="text_title <?php echo $display_none_title;
public static function SaveFileDocument($mFile, $title, $key, $id_transaction) { $mFile->transactions_id = $id_transaction; $mFile->title = InputHelper::removeScriptTag($title); $mFile->order_no = $key; $mFile->file_name = CUploadedFile::getInstance($mFile, 'file_name[' . $key . ']'); if (!is_null($mFile->file_name)) { $mFile->file_name = ProTransactionsPropertyDocument::saveFile($mFile, 'file_name', ProTransactionsPropertyDocument::$folderUpload, $key); } if (!empty($mFile->title)) { $mFile->save(); $response['code'] = true; $response['message'] = 'successfully'; } }
public static function GetSomeInfoRecordWithNoOverideModel($mTransactions, $add_property) { $mTransactions->add_property = $add_property; $mTransactions->type = isset($_GET['type']) ? $_GET['type'] : ProTransactions::FOR_RENT; $mTransactions->listing_autocompelte = ''; if (isset($_GET['listing_id']) && $_GET['listing_id']) { $mTransactions->listing_id = $_GET['listing_id']; $mTransactions->listing_autocompelte = $mTransactions->listing ? $mTransactions->listing->property_name_or_address : ''; } $mTransactions->mPropertyDetail = $mTransactions->rPropertyDetail ? $mTransactions->rPropertyDetail : new ProTransactionsPropertyDetail(); $mTransactions->aModelPropertyDocument = count($mTransactions->rPropertyDocument) ? $mTransactions->rPropertyDocument : ProTransactionsPropertyDocument::getDefaultArrayForCreate($mTransactions->type); $mTransactions->mTenatDefault = $mTransactions->rTenantDefault ? $mTransactions->rTenantDefault : new ProTransactionsVendorPurchaserDetail(); $mTransactions->mLandlord = new ProTransactionsVendorPurchaserDetail(); $mTransactions->mTenant = new ProTransactionsVendorPurchaserDetail(); $mTransactions->mVendor = new ProTransactionsVendorPurchaserDetail(); $mTransactions->mPurchaser = new ProTransactionsVendorPurchaserDetail(); $mTransactions->mBillTo = new ProTransactionsBillTo(); $mTransactions->mPropertyDetail->scenario = 'CreateTransactionTenancyOnly'; $mTransactions->mTenatDefault->scenario = 'AgentAddTenantFromTenancy'; $mTransactions->scenario = 'CreateTransactionForRentRecordTenancy_new'; // for rent //CreateTransactionForRentRecordTenancy ProTransactions::copyFromListingToTransaction($mTransactions); ProTransactions::convertToUserDate($mTransactions); // Feb 02, 2015 , fix for update transaction $cAction = Yii::app()->controller->action->id; if ($cAction == 'update' && ProTransactions::IsTenancyTransaction($mTransactions)) { $mTransactions->mBillTo = $mTransactions->rBillTo ? $mTransactions->rBillTo : new ProTransactionsBillTo(); $mTransactions->mBillTo->scenario = 'CreateVendorPurchaser'; } // Feb 02, 2015 , fix for update transaction }
$mTransactions->mTenatDefault->transactions_id = $mTransactions->id; ProTransactionsVendorPurchaserDetail::saveOneTenant($mTransactions->mTenatDefault, 1, array('scenario_null' => 1)); // update new expiration date for tenant to check login ProTransactionsVendorPurchaserDetail::updateExpirationTenant($mTransactions); } // end save tenant //save ProTransactionsPropertyDocument /*Closed by HTram, because it were uploaded by ajax at the form ProTransactionsPropertyDocument::saveRecord($mTransactions); * */ } /** * @Author: HTram August 25, 2015 * @Todo: save file upload ajax
public function actionDelete() { try { if (isset($_GET['report_id'])) { $report = ProReportDefect::model()->findByPk($_GET['report_id']); if ($report && $report->user_id == Yii::app()->user->id) { $report->delete(); } } elseif (isset($_GET['document_id'])) { $document = ProTransactionsPropertyDocument::model()->findByPk($_GET['document_id']); if ($document) { $document->delete(); } } } catch (Exception $exc) { throw new CHttpException('404', $exc->getMessage()); } }
/** * @Author: ANH DUNG Jan 23, 2015 * @Todo: View tenancy * @Param: $tenancy: id transaction - transaction_id */ public function actionView($tenancy) { MyFormat::validateUserAccess(ROLE_AGENT); $this->pageTitle = "View Tenancy - " . Yii::app()->params['title']; try { $mTransactions = $this->validateLinkView($tenancy); if ($mTransactions->status == STATUS_TENANCY_DRAFT) { $this->redirect(Yii::app()->createAbsoluteUrl('member/agent/tenancy')); } $type = $mTransactions->type; $mTransactions->mBillTo = $mTransactions->rBillTo ? $mTransactions->rBillTo : new ProTransactionsBillTo(); // $mTransactions->mInternalCoBroke = $mTransactions->rInternalCoBroke?$mTransactions->rInternalCoBroke:( array() ); $mTransactions->mPropertyDetail = $mTransactions->rPropertyDetail ? $mTransactions->rPropertyDetail : new ProTransactionsPropertyDetail(); $mTransactions->aModelPropertyDocument = count($mTransactions->rPropertyDocument) ? $mTransactions->rPropertyDocument : ProTransactionsPropertyDocument::getDefaultArrayForCreate($type); // $mTransactions->mVendorPurchaserDetail = $mTransactions->rVendorPurchaserDetail?$mTransactions->rVendorPurchaserDetail:( array() ); // $mTransactions->mPropertyDetail->scenario = 'CreateTransaction'; // $mTransactions->mBillTo->scenario = 'CreateVendorPurchaser'; // $mTransactions->scenario = 'CreateTransaction'; // default for sale // ProTransactions::convertToUserDate($mTransactions); $this->render('ViewTransaction/ViewTransaction', array('mTransactions' => $mTransactions)); } catch (Exception $exc) { throw new CHttpException(404, 'The requested page does not exist.'); } }
<?php $cmsFormater = new CmsFormatter(); $data = array("name" => $model->listing ? $model->listing->property_name_or_address : "", "transaction_id" => $model->id); $name_property = $cmsFormater->formatpropertyname($data); if (!isset($_GET['next'])) { $this->breadcrumbs = array('Tenancies Approved' => array('index'), $name_property); $menus = array(array('label' => 'Tenancies Approved', 'url' => array('index'))); } else { $this->breadcrumbs = array('Tenancies New' => array('tenancies_new'), $name_property); $menus = array(array('label' => 'Tenancies New', 'url' => array('tenancies_new'))); } $this->menu = ControllerActionsName::createMenusRoles($menus, $actions); $mTransactions = $model; $mTransactions->mBillTo = $mTransactions->rBillTo ? $mTransactions->rBillTo : new ProTransactionsBillTo(); $mTransactions->mPropertyDetail = $mTransactions->rPropertyDetail ? $mTransactions->rPropertyDetail : new ProTransactionsPropertyDetail(); $mTransactions->aModelPropertyDocument = count($mTransactions->rPropertyDocument) ? $mTransactions->rPropertyDocument : ProTransactionsPropertyDocument::getDefaultArrayForCreate($mTransactions->type); ?> <?php include 'ViewTransaction/ViewTransaction.php';