public function actionReply() { try { $model = new ProEnquiryPropertyReply(); if (isset($_POST['ProEnquiryPropertyReply'])) { $model->attributes = $_POST['ProEnquiryPropertyReply']; if ($model->save()) { //set replied status $enquiryProperty = ProEnquiryProperty::getItemById($model->enquiry_property_id); $enquiryProperty->status = ENQUIRY_PROPERTY_REPLIED; $enquiryProperty->scenario = null; $enquiryProperty->update(array('status')); //send email SendEmail::sendEmailReplyEnquiryAgent($model); Yii::app()->user->setFlash('success', 'Your email has been sent.'); $this->redirect(array('index')); } else { Yii::app()->user->setFlash('error', 'Your email could not send. Please try again.'); $this->redirect(array('index')); } } 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(400, $e->getMessage()); } }
/** * 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) { try { $model = ProEnquiryProperty::model()->findByPk($id); if ($model === null) { Yii::log("The requested page does not exist."); throw new CHttpException(404, 'The requested page does not exist.'); } return $model; } catch (Exception $e) { Yii::log("Exception " . print_r($e, true), 'error'); throw new CHttpException("Exception " . print_r($e, true)); } }
EmailHelper::bindEmailContent(EMAIL_CONTACT_US, $param, $email_to); // EmailHelper::bindEmailContent(EMAIL_CONTACT_US_GUESS, $param, $model->email); } //Kvan //Reply Enquiry Email For Agent public static function sendEmailReplyEnquiryAgent($model) { $enquiry = ProEnquiryProperty::getItemById($model->enquiry_property_id); //var_dump($model->email_to); echo $model->message; echo $enquiry->listing->user_id; echo die; $email_to = $model->email_to;
public function actionMyshortlist() { try { $this->pageTitle = 'My Shortlist - ' . Yii::app()->params['title']; $this->layout = 'application.views.layouts.layout_user'; //Kvan $shortList = ProUserShortList::getShortListByUser(Yii::app()->user->id); $arrShortListing = array(); if (!empty($shortList)) { foreach ($shortList as $listing) { $arrShortListing[] = $listing->listing_id; } } $listing = Listing::getListingByArrId($arrShortListing); $this->render('normal_user/myshortlist', array('listing' => $listing)); } catch (Exception $exc) { echo $exc->getMessage(); } } //Kvan public function actionSendEnquiryShortList() { $this->pageTitle = 'Enquiry Multiple Listing - ' . Yii::app()->params['title']; $this->layout = 'application.views.layouts.layout_user'; if (isset($_POST['chkList'])) { $arrEnquiry = $_POST['chkList']; $listing = Listing::getListingByArrId($arrEnquiry); $model = new ProEnquiryProperty(); $model->name = Yii::app()->user->first_name . ' ' . Yii::app()->user->last_name; $model->email = Yii::app()->user->email; $model->phone = Yii::app()->user->phone; $model->country_id = Yii::app()->user->country; if (isset($_POST['ProEnquiryProperty'])) { $model->attributes = $_POST['ProEnquiryProperty']; $model->get_update = 1; if ($model->validate()) { foreach ($arrEnquiry as $enquiry) {
} } else { $this->redirect(Yii::app()->createAbsoluteUrl('/')); } } public function actionAddPropertyItem() { if (isset($_GET['id'])) { $model = new ProEnquiryProperty(); if (isset($_POST['ProEnquiryProperty'])) { $model->attributes = $_POST['ProEnquiryProperty']; if ($model->validate()) { $model->property_id = $_GET['id']; if ($model->save()) { $thankYouEnquiry = Pages::getPageById(PAGE_THANK_ENQUIRY_PROPERTY); Yii::app()->user->setFlash('success', $thankYouEnquiry->content); //insert Subscriber if (!empty($_POST['ProEnquiryProperty']['get_update'])) { Subscriber::saveSubscriberPublic($model->email, 2, $model->name); } /* * ----------------- * dtoan : send mail * ----------------- */ SendEmail::sendEmailEnquiryForAgent($model); SendEmail::sendEmailEnquiryForSender($model); Yii::app()->session['propertyId'] = $model->property_id; $this->redirect(Yii::app()->createAbsoluteUrl('page/index', array('slug' => $thankYouEnquiry->slug))); // $this->redirect(Yii::app()->createAbsoluteUrl('site/thankyou'));
public static function getTotalWithUser($userID) { $arrListing = CHtml::listData(Listing::model()->findAllByAttributes(array('user_id' => $userID)), 'id', 'id'); if (count($arrListing) > 0) { $criteria = new CDbCriteria(); $criteria->compare('property_id', $arrListing); $criteria->compare('status', ENQUIRY_PROPERTY_NEW); $total = ProEnquiryProperty::model()->count($criteria); return $total; } return 0; }
<?php // echo "$ ". ProTransactionsSaveCommission::getCommissionReceivableAgent(Yii::app()->user->id); ?> <a href="<?php echo Yii::app()->createAbsoluteUrl('member/member_profile/commissionLog'); ?> " title="view" class="f-right"><img src="<?php echo Yii::app()->theme->baseUrl; ?> /img/ico-arrow.png" alt="view" /></a> </div> </div> <div class="row clearfix"> <div class="lb-1">New enquiries :</div> <div class="group-1"> <?php echo ProEnquiryProperty::getTotalWithUser(Yii::app()->user->id); ?> <a href="<?php echo Yii::app()->createAbsoluteUrl('member/enquiries'); ?> " title="view" class="f-right"><img src="<?php echo Yii::app()->theme->baseUrl; ?> /img/ico-arrow.png" alt="view" /></a> </div> </div> </div> </div> <!-- box --> <div class="box-1 space-3">