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 getListingCount() { $criteria = new CDbCriteria(); $criteria->compare('user_id', $this->id); $criteria->compare('status', STATUS_ACTIVE); $criteria->compare('status_listing', STATUS_LISTING_ACTIVE); return Listing::model()->count($criteria); }
public function run() { $listingInfo = Listing::model()->findByPk($this->listing_id); if ($listingInfo) { $this->listing_title = $listingInfo->property_name_or_address; } $model = $this->searchReleatedListing(); $this->render("listing_releated_page_thank_you/index", array('model' => $model)); }
public function actionSearch($searchtext = '') { if ($searchtext == '') { $this->actionIndex(0); return; } $categories = array(); $listings = Listing::model()->searchFrontendListings($searchtext); ViewsTrack::addCategoryView(0); $this->render('index', array('categories' => $categories, 'listings' => $listings)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate($id) { if (!empty($id) && !Yii::app()->user->isGuest) { $user_email = Yii::app()->user->name; $userModel = User::model()->findByAttributes(array('user_email' => $user_email)); $listingId = $id; $listingModel = Listing::model()->findByPk($listingId); $model = new Booking(); $model->booking_listing_id = $listingModel->listing_id; $model->booking_user_id = $userModel->user_id; $model->booking_amount = $listingModel->listing_price; if ($model->save()) { $this->redirect(array('view', 'id' => $model->booking_id)); } } else { echo "Booking failed"; } }
$model = ListingCompany::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; } public function actionFieldClick($id, $field) { $model = Listing::model()->findByPk($id); if (!$model || !in_array($field, array('owner_contact'))) { throw new CHttpException(403, 'Permission denied.'); } $lc = ListingClick::model()->findByAttributes(array('listing_id' => $id, 'user_id' => Yii::app()->user->id, 'field' => $field)); if (!$lc) { $lc = new ListingClick(); $lc->listing_id = $id; $lc->user_id = Yii::app()->user->id; $lc->field = $field; $lc->save();
public function actionSearch() { $this->checkRequest(); $q = $this->q; $this->checkRequiredParams($q, array('token', 'user_id', 'status', 'type', 'page')); $this->checkToken(); //same as login session $criteria = new CDbCriteria(); $criteria->compare('user_id', $q->user_id); $criteria->compare('status_listing', $q->status); $criteria->compare('listing_type', $q->type); $criteria->limit = 20; $criteria->order = 'property_name_or_address ASC'; $models = Listing::model()->findAll($criteria); $items = array(); foreach ($models as $model) { $items[] = array('property_name_or_address' => $model->property_name_or_address, 'tenure' => Listing::getViewDetailTenure($model)); } $result = ApiModule::$defaultSuccessResponse; $result['list'] = $items; $result['message'] = Yii::t('systemmsg', 'Query success'); //always need ApiModule::sendResponse($result); }
public function actionTake_off($listing) { $model = Listing::model()->findByAttributes(array('id' => $listing, 'user_id' => $this->userID)); if ($model) { $model->take_off = 1; $model->take_off_content = isset($_GET['takeOff']) ? strip_tags($_GET['takeOff']) : NULL; // $model->status_listing = STATUS_LISTING_PAST; $model->status_listing = STATUS_LISTING_PENDING; $model->save(); } }
private function getListingOrRenderError($id) { $id = $this->checkCorrectness($id); if ($id != 0) { $listing = Listing::model()->getFrontendListing($id); } else { $listing = null; } if ($id == 0 || $listing == null) { $this->render('missing_listing'); return null; } return $listing; }
$appeal = ''; if (isset(Yii::app()->session['LOGGED_USER'])) { $userCurent = Yii::app()->session['LOGGED_USER']; if (isset($userCurent->role_id) && $userCurent->role_id <= ROLE_ADMIN) { $role_id = $userCurent->role_id; } } $appeal = new ProListingApeal(); $appeal->listing_id = $model->id; $this->render('listing/appeal', array('model' => $model, 'role_id' => $role_id, 'appeal' => $appeal)); } public function actionDeleteappeal($id) { $appeal = ProListingApeal::model()->findByPk($id); if ($appeal) { if ($appeal->delete()) { @unlink(YII_UPLOAD_DIR . '/listing/' . $appeal->listing_id . '/appeal/' . $appeal->file); } } } public function actionSeachmap() { $this->layout = false; $this->render('listing/map'); } public function actionSeachmap2() { $this->layout = false; $this->render('listing/map2');
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; }
public function OverideModel($model) { if (isset(Yii::app()->user->id)) { $cmsFormater = new CmsFormatter(); $mUser = Users::model()->findByPk(Yii::app()->user->id); $model->fullname = $cmsFormater->formatFullNameRegisteredUsers($mUser); $model->nric = $mUser->nric_passportno_roc; $model->contact_no = $mUser->phone; $model->email = $mUser->email; if (Yii::app()->user->role_id == ROLE_LANDLORD || Yii::app()->user->role_id == ROLE_TENANT) { $model->contact_no = $mUser->contact_no; $model->email = $mUser->email_not_login; } if (Yii::app()->user->role_id == ROLE_AGENT) { $model->email = $mUser->email_not_login; } } $mTrans = ProTransactions::model()->findByPk($model->transaction_id); if (is_null($mTrans)) { return; } $mListing = Listing::model()->findByPk($mTrans->listing_id); if (is_null($mListing)) { return; } $model->property_name_or_address = $mListing->property_name_or_address; $model->unit_from = $mListing->unit_from; $model->unit_to = $mListing->unit_to; $model->postal_code = $mListing->postal_code; $model->location_id = $mListing->location_id; $model->property_type_id = $mListing->property_type_1; $model->tenure = $mListing->tenure; $model->floor_area = $mListing->floor_area; $model->of_bedroom_from = $mListing->of_bedroom; $model->of_bathrooms_from = $mListing->of_bathrooms; }
/** * 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 Listing the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Listing::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * function returns current number of resources (listings, etc.) per given type and advertiser */ public function getCurrentResourceAmount($resourceType, $advertiserId) { $criteria = new CDbCriteria(); if ($resourceType == PlanResourceType::RTYPE_LISTINGS_PER_ADVERTISER) { if ($advertiserId == '') { return 0; } $criteria->compare('t.advertiser_id', $advertiserId); return Listing::model()->count($criteria); } else { if ($resourceType == PlanResourceType::RTYPE_FEATURED_LISTINGS_PER_ADVERTISER) { if ($advertiserId == '') { return 0; } $criteria->compare('t.advertiser_id', $advertiserId); $criteria->compare('t.type', ListingType::TYPE_FEATURED); return Listing::model()->count($criteria); } else { if ($resourceType == PlanResourceType::RTYPE_PREMIUMAD_PER_ADVERTISER) { if ($advertiserId == '') { return 0; } $criteria->compare('t.advertiser_id', $advertiserId); return PremiumAd::model()->count($criteria); } else { if ($resourceType == PlanResourceType::RTYPE_LOCATIONS_PER_ACCOUNT) { $criteria->compare('t.wlabel_id', Yii::app()->user->getWhiteLabelId()); return Location::model()->count($criteria); } } } } return null; }
/** * @Author: ANH DUNG May 06, 2014 * @Todo: get url page view detail listing at FE * @Param: $listing_id * @Return: string url dạng Yii::app()->createAbsoluteUrl('/') * MyFunctionCustom::getUrlListing($listing_id); */ public static function getUrlListing($listing_id) { $model = Listing::model()->findByPk($listing_id); if ($model) { return Yii::app()->createAbsoluteUrl('site/listingdetail', array('slug' => $model->slug)); } return ""; }
$mTransactions->mBillTo->attributes = $_POST['ProTransactionsBillTo']; $mTransactions->mPropertyDocument = new ProTransactionsPropertyDocument(); $mTransactions->mPropertyDocument->attributes = $_POST['ProTransactionsPropertyDocument']; $mTransactions->mTenatDefault->attributes = isset($_POST['ProTransactionsVendorPurchaserDetail']) ? $_POST['ProTransactionsVendorPurchaserDetail'] : array(); $mTransactions->mTenatDefault->scanned_employment_pass = CUploadedFile::getInstance($mTransactions->mTenatDefault, 'scanned_employment_pass'); $mTransactions->mTenatDefault->scanned_passport = CUploadedFile::getInstance($mTransactions->mTenatDefault, 'scanned_passport'); if ($mTransactions->type == ProTransactions::FOR_SALE && $mTransactions->with_tenancy) { $mTransactions->scenario = 'WithTenancyYes'; } if ($mTransactions->mBillTo->bill_to_id == ProTransactions::BILL_TO_SOLICITOR) { $mTransactions->mBillTo->scenario = 'CreateVendorPurchaserSolicitorSelected'; } elseif ($mTransactions->mBillTo->bill_to_id == ProTransactions::BILL_TO_EXTERNAL_CO_BROKE) { $mTransactions->mBillTo->scenario = 'ExternalCoBrokeSelected'; ProTransactionsBillTo::ResetVal($mTransactions->mBillTo); } $mTransactions->validate(); $mTransactions->mPropertyDetail->validate(); $mTransactions->mBillTo->validate(); if ($mTransactions->type == ProTransactions::FOR_RENT) { if (!empty($mTransactions->mTenatDefault->user_id)) { $mTransactions->mTenatDefault->scenario = 'AgentAddTenantExitUid'; } $mTransactions->mTenatDefault->validate(); Users::validateDefaultTenant($mTransactions->mTenatDefault); } else { $mTransactions->mTenatDefault->scenario = null; }
</li> <li role="presentation"><a href="#bank-tab" aria-controls="profile" role="tab" data-toggle="tab">Bank Valuation Request</a> </li> </ul> <!-- Tab panes --> <div class="tab-content"> <div role="tabpanel" class="tab-pane active" id="engage-tab"> <?php $this->widget('GlobalEnquiryHomeWidget'); ?> </div> <div role="tabpanel" class="tab-pane" id="bank-tab"> <?php $this->widget('BlankValuationRequestHomeWidget'); ?> </div> </div> </div> <?php $this->endWidget(); ?> <div class="green-tab property-tab"> <!-- Nav tabs --> <ul class="nav nav-tabs" role="tablist"> <li role="presentation"><a href="#sale-tab" aria-controls="home" role="tab" data-toggle="tab">For Sale</a> </li> <li role="presentation" class="active"><a href="#rent-tab" aria-controls="profile" role="tab" data-toggle="tab">For Rent</a> </li> </ul> <!-- Tab panes -->
/** * 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 = Listing::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)); } }
public static function getListingWithIdReturnAttributes($id, $key) { $model = Listing::model()->findByPk($id); if ($model) { return $model->{$key}; } }
?> <?php echo $form->dropDownList($model, 'p_locations', Location::model()->getLocations(false), array('multiple' => 'multiple', 'size' => 4)); ?> <?php echo $form->error($model, 'p_locations'); ?> </div> <div class="clearfix"></div> <div class="row"> <?php echo $form->labelEx($model, 'p_listings'); ?> <?php echo $form->dropDownList($model, 'p_listings', CHtml::listData(Listing::model()->getListings(), 'listing_id', 'name'), array('multiple' => 'multiple', 'size' => 4)); ?> <?php echo $form->error($model, 'p_listings'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'show_on_static'); ?> <?php echo $form->checkBox($model, 'show_on_static'); ?> <?php echo $form->error($model, 'show_on_static');
/** * returns categories records for a given location */ public function getFrontendCategories($parentCategoryId) { // get all categories $criteria = new CDbCriteria(); $criteria->compare('t.wlabel_id', Yii::app()->user->getWhiteLabelId()); // $criteria->compare('t.parent_category_id', $parentCategoryId); $criteria->order = 't.sort_order'; $results = $this->findAll($criteria); $categories = array(); $categoriesArray = array(); foreach ($results as $record) { $categories[$record->category_id] = $record; } // get # of listings for the categories $listingCounts = Listing::model()->getListingCountForCategoriesAndLocation($categories); foreach ($listingCounts as $categoryId => $count) { $categories[$categoryId]->listingsCount = $count; } // now go through the categories and choose only these thathave the correct parent $resultCategories = array(); foreach ($results as $record) { if ($record->parent_category_id == $parentCategoryId) { $resultCategories[] = $record; } // update the listing count of parent category if ($record->parent_category_id != '') { $categories[$record->parent_category_id]->listingsCount += $record->listingsCount; } } return $resultCategories; }
/** * @Author: ANH DUNG Jan 13, 2015 */ protected function beforeSave() { $this->tenancy_amount = (double) str_replace(",", "", $this->tenancy_amount); $this->deposit_payable = (double) str_replace(",", "", $this->deposit_payable); $this->transacted_price = (double) str_replace(",", "", $this->transacted_price); $this->valuation_price = (double) str_replace(",", "", $this->valuation_price); $this->created_by = Yii::app()->user->id; // Jan 22, 2015 fix track id admin tao company listing lai $mListing = Listing::model()->findByPk($this->listing_id); if ($mListing) { $this->company_listing_user_created = $mListing->company_listing_user_created; } // Jan 22, 2015 fix track id admin tao company listing lai return parent::beforeSave(); }
/** * 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) { $model = Listing::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } // load categories $criteria = new CDbCriteria(); $criteria->condition = 'listing_id=:listing_id'; $criteria->select = 'category_id'; $criteria->params = array(':listing_id' => $id); $listingCategories = ListingCategory::model()->findAll($criteria); $categories = array(); foreach ($listingCategories as $category) { $categories[] = $category->category_id; } $model->p_categories = $categories; // load locations $criteria = new CDbCriteria(); $criteria->condition = 'listing_id=:listing_id'; $criteria->select = 'location_id'; $criteria->params = array(':listing_id' => $id); $listingLocations = ListingLocation::model()->findAll($criteria); $locations = array(); foreach ($listingLocations as $location) { $locations[] = $location->location_id; } $model->p_locations = $locations; return $model; }
public static function model($className = __CLASS__) { return parent::model($className); }
$aSubject = array('{EMAIL}' => $model->email, '{MESSAGE}' => nl2br(strip_tags($model->description)), '{PROPERTY_NAME}' => $Listing->property_name_or_address, '{NAME}' => $model->name, '{PHONE}' => $model->phone, '{COUNTRY}' => ActiveRecord::getInfoRecord('AreaCode', $model->country_id, 'area_name')); CmsEmail::sendmail(EMAIL_ENQUIRY_FOR_AGENT, $aSubject, $aBody, $Listing->user->email_not_login, $email_to); } //add 14-08-2015 //By HTram public static function sendEmailEnquiryForSender($model) { $Listing = Listing::model()->findByPk($model->property_id);
* vì ở trên host bị limit timeout cho 1 connection, ở local thì chạy trên browser được * ở local sau khi chạy thì ra con số này: done in: 5333 Second <=> 88.883 Minutes * ******** STEP TO UPDATE THIS 6-Digit Postal Code *********/ /** http://www.streetdirectory.com/sg/1-suites/1-lorong-20-geylang-398721/100869_51869.html * @Author: ANH DUNG Mar 04, 2015 * @Todo: 6-Digit Postal Code Subscription * The latest update of the database is attached please. The data have been updated as at 10 Feb 2015. * @Link: verzview.com/verzpropertyinfo/demo2/site/importApi * @cron: s:39:" done in: 285 Second <=> 4.75 Minutes"; * s:39:" done in: 273 Second <=> 4.55 Minutes"; * s:48:" done in: 235 Second <=> 3.91666666667 Minutes"; */ public function actionImportApi() { // Yii::app()->setting->setDbItem('rss', 0); // for run cron NewsletterCommand // echo Yii::app()->setting->getItem('rss');die; // phpinfo(); echo "need close this line to run. Please read careful step above"; die; $from = time(); set_time_limit(72000); // $sql = "insert into {{_api_postcode}} ( postal_code ) values ( '019191K31 MAR0043MAR036999999' ),( '019191K31 MAR0043MAR036' ) "; // Yii::app()->db->createCommand($sql)->execute();die; $root = ROOT . '/api'; // ApiAddress, ApiBuilding, ApiPostcode, ApiStreets, ApiWalkup
public function actionAjaxdelete_doc($listing, $doc) { if (Listing::model()->findByAttributes(array('id' => $listing))) { $model = ProListingUploadCea::model()->findByPk($doc); if ($model->delete()) { ProListingUploadCea::removefileDoc($model); } } }