public function run() { $model = new ProGlobalEnquiry('create'); $model->country_id = ActiveRecord::getDefaultAreaCode(); if (isset(Yii::app()->user->id)) { $model->name = Yii::app()->user->title . ' ' . Yii::app()->user->first_name . ' ' . Yii::app()->user->last_name; $model->email = Yii::app()->user->email; if (Yii::app()->user->role_id != ROLE_REGISTER_MEMBER) { $model->email = Yii::app()->user->email_not_login; } $model->phone = Yii::app()->user->phone; $model->country_id = Yii::app()->user->country; } if (isset(Yii::app()->user->id)) { $cmsFormater = new CmsFormatter(); $mUser = Users::model()->findByPk(Yii::app()->user->id); $model->name = $cmsFormater->formatFullNameRegisteredUsers($mUser); $model->email = $mUser->email; $model->nric = $mUser->nric_passportno_roc; $model->phone = $mUser->phone; if (Yii::app()->user->role_id == ROLE_LANDLORD || Yii::app()->user->role_id == ROLE_TENANT) { $model->phone = $mUser->contact_no; $model->email = $mUser->email_not_login; } if (Yii::app()->user->role_id == ROLE_AGENT) { $model->email = $mUser->email_not_login; } } // $model->type_selling= 'Tenancy'; $box = Pages::getPageById(PAGE_ENGAGE_US_BOX); $this->render("global_enquiry", array('model' => $model, 'box' => $box)); }
public function addPage($parentPageId, $address, $status = 'active') { //читаем инфу по родительской стр из бд $pageModel = new Pages($this->dbObject); $parPage = $pageModel->getPageById($parentPageId); if ($parPage['status'] == 'active') { //есть ли у этой родительской стр дочерние с таким же именем $children = $pageModel->getChildren($parentPageId); foreach ($children as $child) { if ($child['address'] == $address) { //такая страница уже существует } else { $level = $parPage['level'] + 1; //создать стр, внести запись в таблицу бд $newId = $pageModel->setNewPage($address, $parentPageId, $level, $status); //прочитать все группы пользователей в массив $usersModel = new Users($this->dbObject); $groups = $usersModel->getAllUserGroups(); //перебрать массив, созлать записи в router_contents foreach ($groups as $group) { $content = ''; //&&&&&&&&&&&&&%%%%%%%%%%%%%%%%%############### $pageModel->setContent($newId, $group['gid'], $content); } } } } }
public function run() { $box = Pages::getPageById(PAGE_PROPERTY_BOX); $model = new ProEnquiryProperty(); $mListing = Listing::model()->findByPk($this->property_id); // echo $mListing->property_name_or_address;die; Listing::ReplaceContentCmsPage($box, $mListing); $model->country_id = ActiveRecord::getDefaultAreaCode(); if (isset(Yii::app()->user->id)) { $model->name = Yii::app()->user->title . ' ' . Yii::app()->user->first_name . ' ' . Yii::app()->user->last_name; $model->email = Yii::app()->user->email; if (Yii::app()->user->role_id != ROLE_REGISTER_MEMBER) { $model->email = Yii::app()->user->email_not_login; } $model->phone = Yii::app()->user->phone; $model->country_id = Yii::app()->user->country; } $this->dir = Yii::getPathOfAlias('application.components.views') . '/_agent_detail.php'; $model->description = trim(strip_tags($box->content)); if ($this->position == "bottom") { $this->render("enquiry_bottom", array('model' => $model, 'box' => $box, 'property_id' => $this->property_id, 'agent_id' => $this->agent_id, 'dir' => $this->dir, 'position' => 'bottom')); } else { $this->render("enquiry_right", array('model' => $model, 'box' => $box, 'property_id' => $this->property_id, 'agent_id' => $this->agent_id, 'dir' => $this->dir, 'position' => 'right')); } }
public function run() { $model = new ProGlobalEnquiry(); $box = Pages::getPageById(PAGE_ENGAGE_US_BOX); if (isset($_POST['ProGlobalEnquiry'])) { echo "aaaaaaaaa"; $model->attributes = $_POST['ProGlobalEnquiry']; } $this->render('index', array('model' => $model, 'box' => $box)); }
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'));