当前位置: 首页>>代码示例>>PHP>>正文


PHP Apartment类代码示例

本文整理汇总了PHP中Apartment的典型用法代码示例。如果您正苦于以下问题:PHP Apartment类的具体用法?PHP Apartment怎么用?PHP Apartment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Apartment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionAddPaid

 public function actionAddPaid($id = 0, $withDate = 0)
 {
     $model = new AddToAdForm();
     $paidServices = PaidServices::model()->findAll('id != ' . PaidServices::ID_ADD_FUNDS);
     $paidServicesArray = CHtml::listData($paidServices, 'id', 'name');
     $request = Yii::app()->request;
     $data = $request->getPost('AddToAdForm');
     if ($data) {
         $apartmentId = $request->getPost('ad_id');
         $withDate = $request->getPost('withDate');
         $model->attributes = $data;
         if ($model->validate()) {
             $apartment = Apartment::model()->findByPk($apartmentId);
             $paidService = PaidServices::model()->findByPk($model->paid_id);
             if (!$paidService || !$apartment) {
                 throw new CException('Not valid data');
             }
             if (PaidServices::applyToApartment($apartmentId, $paidService->id, $model->date_end)) {
                 echo CJSON::encode(array('status' => 'ok', 'apartmentId' => $apartmentId, 'html' => $apartment->getPaidHtml($withDate, true)));
                 Yii::app()->end();
             }
         } else {
             echo CJSON::encode(array('status' => 'err', 'html' => $this->renderPartial('_add_to_form', array('id' => $apartmentId, 'model' => $model, 'withDate' => $withDate, 'paidServicesArray' => $paidServicesArray), true)));
             Yii::app()->end();
         }
     }
     $renderData = array('id' => $id, 'model' => $model, 'withDate' => $withDate, 'paidServicesArray' => $paidServicesArray);
     if (Yii::app()->request->isAjaxRequest) {
         $this->renderPartial('_add_to_ad', $renderData);
     } else {
         $this->render('_add_to_ad', $renderData);
     }
 }
开发者ID:barricade86,项目名称:raui,代码行数:33,代码来源:MainController.php

示例2: checkStatusAd

 public static function checkStatusAd()
 {
     $activePaids = ApartmentPaid::model()->findAll('date_end <= NOW() AND status=' . ApartmentPaid::STATUS_ACTIVE);
     foreach ($activePaids as $paid) {
         $paid->status = ApartmentPaid::STATUS_NO_ACTIVE;
         if ($paid->paid_id == PaidServices::ID_SPECIAL_OFFER || $paid->paid_id == PaidServices::ID_UP_IN_SEARCH) {
             $apartment = Apartment::model()->findByPk($paid->apartment_id);
             if ($apartment) {
                 $apartment->scenario = 'update_status';
                 if ($paid->paid_id == PaidServices::ID_SPECIAL_OFFER) {
                     $apartment->is_special_offer = 0;
                     $apartment->update(array('is_special_offer'));
                 }
                 if ($paid->paid_id == PaidServices::ID_UP_IN_SEARCH) {
                     $apartment->date_up_search = new CDbExpression('NULL');
                     $apartment->update(array('date_up_search'));
                 }
             }
         }
         if (!$paid->update(array('status'))) {
             //deb($paid->getErrors());
         }
     }
     $adEndActivity = Apartment::model()->with('user')->findAll('t.date_end_activity <= NOW() AND t.activity_always != 1 AND (t.active=:status OR t.owner_active=:status)', array(':status' => Apartment::STATUS_ACTIVE));
     foreach ($adEndActivity as $ad) {
         $ad->scenario = 'update_status';
         if (isset($ad->user) && $ad->user->isAdmin == 1) {
             $ad->active = Apartment::STATUS_INACTIVE;
         } else {
             $ad->active = Apartment::STATUS_INACTIVE;
             $ad->owner_active = Apartment::STATUS_INACTIVE;
         }
         $ad->save(false);
     }
 }
开发者ID:alexjkitty,项目名称:estate,代码行数:35,代码来源:BeginRequest.php

示例3: apTypes

 public static function apTypes()
 {
     $result = Apartment::getApTypes();
     if (Yii::app()->theme->name == 'atlas') {
         $types = array(0 => Yii::t('common', 'Type of listing'));
     } else {
         $types = array(0 => Yii::t('common', 'Please select'));
     }
     if (param('useTypeSale', 1)) {
         if (in_array(Apartment::PRICE_SALE, $result)) {
             $types[Apartment::PRICE_SALE] = utf8_ucfirst(tt('Sale', 'apartments'));
         }
     }
     if (param('useTypeBuy', 1)) {
         if (in_array(Apartment::PRICE_BUY, $result)) {
             $types[Apartment::PRICE_BUY] = utf8_ucfirst(tt('Buy a', 'apartments'));
         }
     }
     if (param('useTypeRenting', 1)) {
         if (in_array(Apartment::PRICE_RENTING, $result)) {
             $types[Apartment::PRICE_RENTING] = utf8_ucfirst(tt('Rent a', 'apartments'));
         }
     }
     if (param('useTypeChange', 1)) {
         if (in_array(Apartment::PRICE_CHANGE, $result)) {
             $types[Apartment::PRICE_CHANGE] = utf8_ucfirst(tt('Exchange', 'apartments'));
         }
     }
     if (param('useTypeRentDay', 1)) {
         if (in_array(Apartment::PRICE_PER_DAY, $result)) {
             $types[Apartment::PRICE_PER_DAY] = utf8_ucfirst(tc('rent by the day'));
         }
     }
     if (param('useTypeRentHour', 1)) {
         if (in_array(Apartment::PRICE_PER_HOUR, $result)) {
             $types[Apartment::PRICE_PER_HOUR] = utf8_ucfirst(tc('rent by the hour'));
         }
     }
     if (param('useTypeRentMonth', 1)) {
         if (in_array(Apartment::PRICE_PER_MONTH, $result)) {
             $types[Apartment::PRICE_PER_MONTH] = utf8_ucfirst(tc('rent by the month'));
         }
     }
     if (param('useTypeRentWeek', 1)) {
         if (in_array(Apartment::PRICE_PER_WEEK, $result)) {
             $types[Apartment::PRICE_PER_WEEK] = utf8_ucfirst(tc('rent by the week'));
         }
     }
     $return['propertyType'] = $types;
     if (issetModule('selecttoslider') && param('usePriceSlider') == 1) {
         $return['currencyTitle'] = array(Yii::t('common', 'Price range') . ':', Yii::t('common', 'Price range') . ':', Yii::t('common', 'Price range') . ':', Yii::t('common', 'Price range') . ':', Yii::t('common', 'Price range') . ':', Yii::t('common', 'Price range') . ':');
     } else {
         $return['currencyTitle'] = array(Yii::t('common', 'Payment to'), Yii::t('common', 'Payment to'), Yii::t('common', 'Fee up to'), Yii::t('common', 'Fee up to'), Yii::t('common', 'Fee up to'), Yii::t('common', 'Fee up to'));
     }
     return $return;
 }
开发者ID:barricade86,项目名称:raui,代码行数:56,代码来源:SearchForm.php

示例4: apTypes

 public static function apTypes()
 {
     $result = Apartment::getApTypes();
     $types = array(0 => Yii::t('common', 'Please select'));
     if (param('useTypeSale', 1)) {
         if (in_array(Apartment::PRICE_SALE, $result)) {
             $types[Apartment::PRICE_SALE] = tt('Sale', 'apartments');
         }
     }
     if (param('useTypeBuy', 1)) {
         if (in_array(Apartment::PRICE_BUY, $result)) {
             $types[Apartment::PRICE_BUY] = tt('Buy a', 'apartments');
         }
     }
     if (param('useTypeRenting', 1)) {
         if (in_array(Apartment::PRICE_RENTING, $result)) {
             $types[Apartment::PRICE_RENTING] = tt('Rent a', 'apartments');
         }
     }
     if (param('useTypeChange', 1)) {
         if (in_array(Apartment::PRICE_CHANGE, $result)) {
             $types[Apartment::PRICE_CHANGE] = tt('Exchange', 'apartments');
         }
     }
     if (param('useTypeMortgage', 1)) {
         if (in_array(Apartment::PRICE_MORTGAGE, $result)) {
             $types[Apartment::PRICE_MORTGAGE] = tt('Mortgage', 'apartments');
         }
     }
     if (param('useTypePrivatisation', 1)) {
         if (in_array(Apartment::PRICE_PRIVATISATION, $result)) {
             $types[Apartment::PRICE_PRIVATISATION] = tt('Privatisation', 'apartments');
         }
     }
     if (param('useTypeRent', 1)) {
         if (in_array(Apartment::PRICE_PER_DAY, $result)) {
             $types[Apartment::PRICE_PER_DAY] = tc('rent by the day');
         }
         if (in_array(Apartment::PRICE_PER_HOUR, $result)) {
             $types[Apartment::PRICE_PER_HOUR] = tc('rent by the hour');
         }
         if (in_array(Apartment::PRICE_PER_MONTH, $result)) {
             $types[Apartment::PRICE_PER_MONTH] = tc('rent by the month');
         }
         if (in_array(Apartment::PRICE_PER_WEEK, $result)) {
             $types[Apartment::PRICE_PER_WEEK] = tc('rent by the week');
         }
     }
     $return['propertyType'] = $types;
     if (issetModule('selecttoslider') && param('usePriceSlider') == 1) {
         $return['currencyTitle'] = array(Yii::t('common', 'Price range') . ':', Yii::t('common', 'Price range') . ':', Yii::t('common', 'Price range') . ':', Yii::t('common', 'Price range') . ':', Yii::t('common', 'Price range') . ':', Yii::t('common', 'Price range') . ':');
     } else {
         $return['currencyTitle'] = array(Yii::t('common', 'Payment to'), Yii::t('common', 'Payment to'), Yii::t('common', 'Fee up to'), Yii::t('common', 'Fee up to'), Yii::t('common', 'Fee up to'), Yii::t('common', 'Fee up to'));
     }
     return $return;
 }
开发者ID:alexjkitty,项目名称:estate,代码行数:56,代码来源:SearchForm.php

示例5: isUserAd

 public static function isUserAd($apartmentId = null, $ownerId = null)
 {
     if ($apartmentId && $ownerId) {
         if (Apartment::model()->findByAttributes(array('id' => $apartmentId, 'owner_id' => $ownerId))) {
             return true;
         }
         return false;
     }
     return false;
 }
开发者ID:barricade86,项目名称:raui,代码行数:10,代码来源:Bookingcalendar.php

示例6: actionActivate

 public function actionActivate()
 {
     $id = intval(Yii::app()->request->getQuery('id', 0));
     if ($id) {
         $action = Yii::app()->request->getQuery('action');
         $model = $this->loadModel($id);
         if ($model) {
             if ($model->name == 'useTypeRentHour' || $model->name == 'useTypeRentDay' || $model->name == 'useTypeRentWeek' || $model->name == 'useTypeRentMonth' || $model->name == 'useTypeSale' || $model->name == 'useTypeRenting' || $model->name == 'useTypeBuy' || $model->name == 'useTypeChange') {
                 if (count(Apartment::availableApTypesIds()) == 1 && $action == 'deactivate') {
                     if (!Yii::app()->request->isAjaxRequest) {
                         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
                     }
                     Yii::app()->end;
                 }
             }
             // delete assets js cache
             ConfigurationModel::clearGenerateJSAssets();
             $model->value = $action == 'activate' ? 1 : 0;
             $model->update(array('value'));
             if ($model->name == 'useGoogleMap' && $model->value == 1) {
                 $modelToggle = ConfigurationModel::model()->findAllByAttributes(array('name' => array('useYandexMap', 'useOSMMap')));
                 if ($modelToggle) {
                     foreach ($modelToggle as $mToggle) {
                         $mToggle->value = 0;
                         $mToggle->update(array('value'));
                     }
                 }
             }
             if ($model->name == 'useYandexMap' && $model->value == 1) {
                 $modelToggle = ConfigurationModel::model()->findAllByAttributes(array('name' => array('useGoogleMap', 'useOSMMap')));
                 if ($modelToggle) {
                     foreach ($modelToggle as $mToggle) {
                         $mToggle->value = 0;
                         $mToggle->update(array('value'));
                     }
                 }
             }
             if ($model->name == 'useOSMMap' && $model->value == 1) {
                 $modelToggle = ConfigurationModel::model()->findAllByAttributes(array('name' => array('useYandexMap', 'useGoogleMap')));
                 if ($modelToggle) {
                     foreach ($modelToggle as $mToggle) {
                         $mToggle->value = 0;
                         $mToggle->update(array('value'));
                     }
                 }
             }
             if ($model->name == 'useLocation') {
                 echo 'reload';
             }
         }
     }
     if (!Yii::app()->request->isAjaxRequest) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
     }
 }
开发者ID:barricade86,项目名称:raui,代码行数:55,代码来源:MainController.php

示例7: FetchResults

 protected function FetchResults(sfWebRequest $request, $by_period = false)
 {
     $this->city = Doctrine_Core::getTable('City')->FindByNameLike($request->getParameter('city'));
     $this->features = Doctrine_Core::getTable('Feature')->GetByIds($request->getParameter('features'));
     if ($by_period) {
         $apps = Doctrine_Core::getTable('Apartment')->getApartmentsByFeatures($request->getParameter('features'), $this->city->getId());
         $this->apps = Apartment::AvalibilityInPeriod($apps, $request->getParameter('date_from'), $request->getParameter('date_to'));
     } else {
         $this->apps = Doctrine_Core::getTable('Apartment')->getApartmentsByFeatures($request->getParameter('features'), $this->city->getId());
     }
 }
开发者ID:alifst11,项目名称:symfonybooking,代码行数:11,代码来源:actions.class.php

示例8: CheckBookingPossibility

 public function CheckBookingPossibility(Apartment $app, $pax)
 {
     /* Avalibility check. Expecting TRUE or FALSE  */
     $avalibility = $app->CheckBookingsInPeriod($this->date_from, $this->date_to);
     /* Are dates valid for individual apartment ? */
     $dates = true;
     /* Minimum or maximum pax for individual apartment or ... ? */
     $pax_valid = false;
     if ($pax >= 1 && $pax <= $app->getMaxPax()) {
         $pax_valid = true;
     }
     /* Are there periods for dates... Can we get real price ? */
     $price = false;
     if (Booking::CalculatePrice($app, $this->date_from, $this->date_to) > 0) {
         $price = true;
     }
     if ($dates === true && $avalibility === false && $pax_valid === true && $price === true) {
         return $this;
     } else {
         return false;
     }
 }
开发者ID:alifst11,项目名称:symfonybooking,代码行数:22,代码来源:Booking.class.php

示例9: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id, $request)
 {
     $apartment = Apartment::find($id);
     $profile = Auth::user()->profile;
     $block_no = $request->input('blockno');
     // get block_no from profileform
     $floor_no = $request->input('floorno');
     // get floor_no from profileform
     //        $profile->apartments()->updateExistingPivot($profile->defaultApartment , ['approved' => '1', 'block_no' => $block_no, 'floor_no' => $floor_no]);
     $profile->apartments()->detach($apartment);
     $profile->apartments()->attach($apartment, ['approved' => '1', 'block_no' => $block_no, 'floor_no' => $floor_no]);
     return redirect()->back()->withMessage('Block / Flat Number Updated')->withStatus('success');
 }
开发者ID:suchayj,项目名称:easymanage,代码行数:19,代码来源:VisitorController.php

示例10: getCategoriesForUpdate

 /** Сохраняем данные выбранных справочников
  * @return array
  */
 public static function getCategoriesForUpdate(Apartment $ad)
 {
     if (isset($_POST['category']) && is_array($_POST['category'])) {
         $ad->references = Apartment::getCategories(null, $ad->type);
         foreach ($_POST['category'] as $cat => $categoryArray) {
             foreach ($categoryArray as $key => $value) {
                 $ad->references[$cat]['values'][$key]['selected'] = true;
             }
         }
     } else {
         $ad->references = Apartment::getCategories($ad->id, $ad->type);
     }
     return $ad->references;
 }
开发者ID:barricade86,项目名称:raui,代码行数:17,代码来源:HApartment.php

示例11: actionSetCount

 public function actionSetCount()
 {
     $sql = "SELECT COUNT(id) AS count_img, id_object FROM {{images}} GROUP BY id_object";
     $res = Yii::app()->db->createCommand($sql)->queryAll();
     foreach ($res as $item) {
         $model = Apartment::model()->findByPk($item['id_object']);
         if ($model) {
             $model->count_img = $item['count_img'];
             $model->update(array('count_img'));
         } else {
             echo 'not found model with id = ' . $item['id_object'] . '<br>';
         }
     }
     deb($res);
 }
开发者ID:barricade86,项目名称:raui,代码行数:15,代码来源:MainController.php

示例12: prepareItems

 private function prepareItems($xmlWriter = null)
 {
     $this->criteria->limit = param('module_rss_itemsPerFeed', 20);
     $items = Apartment::model()->findAll($this->criteria);
     if ($items) {
         foreach ($items as $item) {
             $xmlWriter->startElement("item");
             $xmlWriter->writeElement('title', CHtml::encode($item->getStrByLang('title')));
             $xmlWriter->writeElement('link', $item->getUrl());
             $xmlWriter->writeElement('description', $this->getDescription($item));
             $xmlWriter->writeElement('pubDate', $this->getDateFormat(strtotime($item->date_updated)));
             $xmlWriter->endElement();
             // end item
         }
     }
 }
开发者ID:barricade86,项目名称:raui,代码行数:16,代码来源:RssWidget.php

示例13: update

 /**
  * Update the specified resource in storage.
  * Store Block / Flat and Floor Number.
  *
  * @param Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $apartment = Apartment::find($id);
     $profile = Auth::user()->profile;
     $block_no = $request->input('blockno');
     // get block_no from profileform
     $floor_no = $request->input('floorno');
     // get floor_no from profileform
     $isOwner = $request->input('isOwner');
     // get Owner from profileform
     $lock = $request->input('lock');
     // get lock status from profileform
     $profile->apartments()->detach($apartment);
     $profile->apartments()->attach($apartment, ['approved' => '1', 'block_no' => $block_no, 'floor_no' => $floor_no, 'isOwner' => $isOwner, 'lock' => $lock]);
     return redirect()->back()->withMessage('Block / Flat Number Updated')->withStatus('success');
 }
开发者ID:suchayj,项目名称:easymanage,代码行数:24,代码来源:AdminController.php

示例14: actionIndex

 public function actionIndex()
 {
     Yii::import('application.modules.apartments.helpers.apartmentsHelper');
     Yii::app()->getModule('referencecategories');
     $criteria = new CDbCriteria();
     $criteria->addInCondition('t.id', Yii::app()->controller->apInComparison);
     $result = apartmentsHelper::getApartments(param('countListingsInComparisonList', 5), 0, 0, $criteria);
     $apartments = null;
     if (array_key_exists('criteria', $result)) {
         $apartments = Apartment::findAllWithCache($result['criteria']);
     }
     if (!$apartments) {
         $this->redirect(Yii::app()->controller->createAbsoluteUrl('/'));
     }
     $this->render('index', array('apartments' => $apartments));
 }
开发者ID:alexjkitty,项目名称:estate,代码行数:16,代码来源:MainController.php

示例15: actionComplain

 public function actionComplain($isFancy = 0)
 {
     $id = Yii::app()->request->getParam('id', 0);
     if (!$id) {
         throw404();
     }
     $model = new $this->modelName();
     $modelApartment = Apartment::model()->findByPk($id);
     if (!$modelApartment) {
         throw404();
     }
     if (isset($_POST[$this->modelName]) && BlockIp::checkAllowIp(Yii::app()->controller->currentUserIpLong)) {
         $model->attributes = $_POST[$this->modelName];
         $model->apartment_id = $id;
         $model->session_id = Yii::app()->session->sessionId;
         $model->user_id = 0;
         $model->user_ip = Yii::app()->controller->currentUserIp;
         $model->user_ip_ip2_long = Yii::app()->controller->currentUserIpLong;
         if (!Yii::app()->user->isGuest) {
             $model->email = Yii::app()->user->email;
             $model->name = Yii::app()->user->username;
             $model->user_id = Yii::app()->user->id;
         }
         if ($model->validate()) {
             if ($this->checkAlreadyComplain($model->apartment_id, $model->user_id, $model->session_id)) {
                 if ($model->save(false)) {
                     $notifier = new Notifier();
                     $notifier->raiseEvent('onNewComplain', $model);
                     Yii::app()->user->setFlash('success', tt('Thanks_for_complain', 'apartmentsComplain'));
                     $model = new $this->modelName();
                     // clear fields
                 }
             } else {
                 Yii::app()->user->setFlash('notice', tt('your_already_post_complain', 'apartmentsComplain'));
             }
         }
     }
     if ($isFancy) {
         Yii::app()->clientscript->scriptMap['jquery.js'] = false;
         Yii::app()->clientscript->scriptMap['jquery.min.js'] = false;
         Yii::app()->clientscript->scriptMap['jquery-ui.min.js'] = false;
         $this->renderPartial('complain_form', array('model' => $model, 'apId' => $id, 'isFancy' => true, 'modelApartment' => $modelApartment), false, true);
     } else {
         $this->render('complain_form', array('model' => $model, 'apId' => $id, 'modelApartment' => $modelApartment, 'wtf' => 'huilo'));
     }
 }
开发者ID:barricade86,项目名称:raui,代码行数:46,代码来源:MainController.php


注:本文中的Apartment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。