本文整理汇总了PHP中Listing::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Listing::model方法的具体用法?PHP Listing::model怎么用?PHP Listing::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Listing
的用法示例。
在下文中一共展示了Listing::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
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'));
}
}
示例2: getListingCount
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);
}
示例3: run
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));
}
示例4: actionSearch
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));
}
示例5: actionCreate
/**
* 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";
}
}
示例6: CHttpException
$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();
示例7: actionSearch
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);
}
示例8: actionTake_off
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();
}
}
示例9: getListingOrRenderError
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;
}
示例10: actionDeleteappeal
$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');
示例11: getTotalWithUser
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;
}
示例12: OverideModel
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;
}
示例13: loadModel
/**
* 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;
}
示例14: getCurrentResourceAmount
/**
* 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;
}
示例15: getUrlListing
/**
* @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 "";
}