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


PHP Apartment::availableApTypesIds方法代码示例

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


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

示例1: actionView

 public function actionView($id = 0)
 {
     //$this->layout='//layouts/inner';
     Yii::app()->bootstrap->plugins['tooltip'] = array('selector' => ' ', 'options' => array('placement' => 'top'));
     $model = $this->loadModelWith(array('windowTo', 'objType', 'city'));
     if (!in_array($model->type, Apartment::availableApTypesIds()) || !in_array($model->price_type, array_keys(Apartment::getPriceArray(Apartment::PRICE_SALE, true)))) {
         throw404();
     }
     $this->render('view', array('model' => $model, 'statistics' => Apartment::getApartmentVisitCount($model)));
 }
开发者ID:barricade86,项目名称:raui,代码行数:10,代码来源:MainController.php

示例2: 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

示例3: getActiveCity

 public static function getActiveCity()
 {
     if (self::$_activeCity === null) {
         $ownerActiveCond = '';
         if (param('useUserads')) {
             $ownerActiveCond = ' AND ap.owner_active = ' . Apartment::STATUS_ACTIVE . ' ';
         }
         $sql = 'SELECT ac.name_' . Yii::app()->language . ' AS name, ac.id AS id
                 FROM {{apartment}} ap, {{apartment_city}} ac
                 WHERE ac.id = ap.city_id
                 AND ap.type IN (' . implode(',', Apartment::availableApTypesIds()) . ')
                 AND ap.active = ' . Apartment::STATUS_ACTIVE . ' ' . $ownerActiveCond . '
                 ORDER BY ac.sorter';
         $results = Yii::app()->db->createCommand($sql)->queryAll();
         self::$_activeCity = CHtml::listData($results, 'id', 'name');
     }
     return self::$_activeCity;
 }
开发者ID:alexjkitty,项目名称:estate,代码行数:18,代码来源:ApartmentCity.php

示例4: getApartments

 public static function getApartments($limit = 10, $usePagination = 1, $all = 1, $criteria = null)
 {
     $pages = array();
     Yii::app()->getModule('apartments');
     if ($criteria === null) {
         $criteria = new CDbCriteria();
     }
     if (!$all) {
         $criteria->addCondition('t.deleted = 0');
         $criteria->addCondition('t.active = ' . Apartment::STATUS_ACTIVE);
         if (param('useUserads')) {
             $criteria->addCondition('owner_active = ' . Apartment::STATUS_ACTIVE);
         }
     }
     $sort = new CSort('Apartment');
     $sort->attributes = array('price' => 'price', 'date_created' => 'date_created');
     if (!$criteria->order) {
         $sort->defaultOrder = 't.date_up_search DESC, t.sorter DESC';
     }
     $sort->applyOrder($criteria);
     $sorterLinks = self::getSorterLinks($sort);
     $criteria->addCondition('t.owner_id = 1 OR t.owner_active = 1');
     $criteria->addInCondition('t.type', Apartment::availableApTypesIds());
     $criteria->addInCondition('t.price_type', array_keys(Apartment::getPriceArray(Apartment::PRICE_SALE, true)));
     // find count
     $apCount = Apartment::model()->count($criteria);
     if ($usePagination) {
         $pages = new CPagination($apCount);
         $pages->pageSize = $limit;
         $pages->applyLimit($criteria);
     } else {
         $criteria->limit = $limit;
     }
     if (issetModule('seo')) {
         $criteria->with = array('seo');
     }
     //		$apartments = Apartment::model()
     //			->cache(param('cachingTime', 1209600), Apartment::getImagesDependency())
     //			->with(array('images'))
     //			->findAll($criteria);
     return array('pages' => $pages, 'sorterLinks' => $sorterLinks, 'apCount' => $apCount, 'criteria' => $criteria);
 }
开发者ID:barricade86,项目名称:raui,代码行数:42,代码来源:apartmentsHelper.php

示例5: actionMainsearch

    public function actionMainsearch($rss = null)
    {
        $countAjax = Yii::app()->request->getParam('countAjax');
        $href = Yii::app()->getBaseUrl(true) . '/' . Yii::app()->request->getPathInfo();
        Yii::app()->clientScript->registerLinkTag('canonical', null, $href);
        unset($href);
        if (Yii::app()->request->getParam('currency')) {
            setCurrency();
            $this->redirect(array('mainsearch'));
        }
        $criteria = new CDbCriteria();
        $criteria->addCondition('active = ' . Apartment::STATUS_ACTIVE);
        if (param('useUserads')) {
            $criteria->addCondition('owner_active = ' . Apartment::STATUS_ACTIVE);
        }
        $criteria->addInCondition('type', Apartment::availableApTypesIds());
        $this->sApId = (int) Yii::app()->request->getParam('sApId');
        if ($this->sApId) {
            $criteria->addCondition('id = :sApId');
            $criteria->params[':sApId'] = $this->sApId;
            $apCount = Apartment::model()->count($criteria);
            if ($countAjax && Yii::app()->request->isAjaxRequest) {
                $this->echoAjaxCount($apCount);
            }
            if ($apCount) {
                $apartmentModel = Apartment::model()->findByPk($this->sApId);
                Yii::app()->controller->redirect($apartmentModel->getUrl());
                Yii::app()->end();
            }
        }
        // rooms
        if (issetModule('selecttoslider') && param('useRoomSlider') == 1) {
            $roomsMin = Yii::app()->request->getParam('room_min');
            $roomsMax = Yii::app()->request->getParam('room_max');
            if ($roomsMin || $roomsMax) {
                $criteria->addCondition('num_of_rooms >= :roomsMin AND num_of_rooms <= :roomsMax');
                $criteria->params[':roomsMin'] = $roomsMin;
                $criteria->params[':roomsMax'] = $roomsMax;
                $this->roomsCountMin = $roomsMin;
                $this->roomsCountMax = $roomsMax;
            }
        } else {
            $rooms = Yii::app()->request->getParam('rooms');
            if ($rooms) {
                if ($rooms == 4) {
                    $criteria->addCondition('num_of_rooms >= :rooms');
                } else {
                    $criteria->addCondition('num_of_rooms = :rooms');
                }
                $criteria->params[':rooms'] = $rooms;
                $this->roomsCount = $rooms;
            }
        }
        // floor
        if (issetModule('selecttoslider') && param('useFloorSlider') == 1) {
            $floorMin = Yii::app()->request->getParam('floor_min');
            $floorMax = Yii::app()->request->getParam('floor_max');
            if ($floorMin || $floorMax) {
                $criteria->addCondition('floor >= :floorMin AND floor <= :floorMax');
                $criteria->params[':floorMin'] = $floorMin;
                $criteria->params[':floorMax'] = $floorMax;
                $this->floorCountMin = $floorMin;
                $this->floorCountMax = $floorMax;
            }
        } else {
            $floor = Yii::app()->request->getParam('floor');
            if ($floor) {
                $criteria->addCondition('floor = :floor');
                $criteria->params[':floor'] = $floor;
                $this->floorCount = $floor;
            }
        }
        // square
        if (issetModule('selecttoslider') && param('useSquareSlider') == 1) {
            $squareMin = Yii::app()->request->getParam('square_min');
            $squareMax = Yii::app()->request->getParam('square_max');
            if ($squareMin || $squareMax) {
                $criteria->addCondition('square >= :squareMin AND square <= :squareMax');
                $criteria->params[':squareMin'] = $squareMin;
                $criteria->params[':squareMax'] = $squareMax;
                $this->squareCountMin = $squareMin;
                $this->squareCountMax = $squareMax;
            }
        } else {
            $square = Yii::app()->request->getParam('square');
            if ($square) {
                $criteria->addCondition('square <= :square');
                $criteria->params[':square'] = $square;
                $this->squareCount = $square;
            }
        }
        $location = (int) Yii::app()->request->getParam('location_id');
        $subLocation = (int) Yii::app()->request->getParam('sublocation_id');
        $region = (int) Yii::app()->request->getParam('region_id');
        if ($subLocation) {
            if (empty($region)) {
                $criteria->addCondition('sublocation_id = :sublocation_id AND location_id = :location_id');
                $criteria->params[':sublocation_id'] = $subLocation;
                $criteria->params[':location_id'] = $location;
            } else {
//.........这里部分代码省略.........
开发者ID:alexjkitty,项目名称:estate,代码行数:101,代码来源:MainController.php

示例6: actionView

 public function actionView($id = 0, $url = '', $printable = 0)
 {
     // если админ - делаем редирект на просмотр в админку
     //		if(Yii::app()->user->getState('isAdmin')){
     //			$this->redirect(array('backend/main/view', 'id' => $id));
     //		}
     $apartment = NULL;
     if (($id || $url) && issetModule('seo')) {
         $url = $url ? $url : $id;
         $seo = SeoFriendlyUrl::getForView($url, $this->modelName);
         if ($seo) {
             $this->setSeo($seo);
             $id = $seo->model_id;
         }
     }
     if ($id) {
         $apartment = Apartment::model()->with(array('windowTo', 'objType', 'city'))->findByPk($id);
     }
     if (!$apartment) {
         throw404();
     }
     if (!in_array($apartment->type, Apartment::availableApTypesIds())) {
         throw404();
     }
     // "Толстый" запрос из-за JOIN'ов. Кешируем его.
     // Зависимость кеша - выбираем дату последней модификации из 4 таблиц
     //		$apartment = Apartment::model()
     //			->cache(param('cachingTime', 1209600), Apartment::getFullDependency($id))
     //			->with('windowTo', 'comments', 'images', 'objType', 'city')
     //			->findByPk($id);
     //
     //        if (!$apartment)
     //            throw404();
     if ($apartment->owner_id != 1 && $apartment->owner_active == Apartment::STATUS_INACTIVE) {
         if (!(isset(Yii::app()->user->id) && Yii::app()->user->id == $apartment->owner_id) && !Yii::app()->user->getState('isAdmin')) {
             Yii::app()->user->setFlash('notice', tt('apartments_main_index_propertyNotAvailable', 'apartments'));
             throw404();
         }
     }
     if (($apartment->active == Apartment::STATUS_INACTIVE || $apartment->active == Apartment::STATUS_MODERATION) && !Yii::app()->user->getState('isAdmin') && !(isset(Yii::app()->user->id) && Yii::app()->user->id == $apartment->owner_id)) {
         Yii::app()->user->setFlash('notice', tt('apartments_main_index_propertyNotAvailable', 'apartments'));
         //$this->redirect(Yii::app()->homeUrl);
         throw404();
     }
     if ($apartment->active == Apartment::STATUS_MODERATION && $apartment->owner_active == Apartment::STATUS_ACTIVE && $apartment->owner_id == Yii::app()->user->id) {
         Yii::app()->user->setFlash('error', tc('Awaiting moderation'));
     }
     $dateFree = CDateTimeParser::parse($apartment->is_free_to, 'yyyy-MM-dd');
     if ($dateFree && $dateFree < time() - 60 * 60 * 24) {
         $apartment->is_special_offer = 0;
         $apartment->update(array('is_special_offer'));
     }
     if (!Yii::app()->request->isAjaxRequest) {
         $ipAddress = Yii::app()->request->userHostAddress;
         $userAgent = Yii::app()->request->userAgent;
         Apartment::setApartmentVisitCount($apartment, $ipAddress, $userAgent);
     }
     if ($printable) {
         $this->layout = '//layouts/print';
         $this->render('view_print', array('model' => $apartment));
     } else {
         Apartment::model()->setLastVisitedObjectsCookies($apartment->id);
         $this->render('view', array('model' => $apartment, 'statistics' => Apartment::getApartmentVisitCount($apartment)));
     }
 }
开发者ID:alexjkitty,项目名称:estate,代码行数:65,代码来源:MainController.php

示例7: actionView

 public function actionView($id = 0, $url = '', $printable = 0)
 {
     //$this->showSearchForm = false;
     $this->htmlPageId = 'viewlisting';
     $apartment = NULL;
     $seo = NULL;
     if (($id || $url) && issetModule('seo')) {
         $url = $url ? $url : $id;
         $seo = SeoFriendlyUrl::getForView($url, $this->modelName);
         if ($seo) {
             $this->setSeo($seo);
             $id = $seo->model_id;
         }
     }
     if ($id) {
         $apartment = Apartment::model()->with(array('windowTo', 'objType', 'city'))->findByPk($id);
         // избавляемся от дублей
         $apartmentUrl = $apartment->getUrl(false);
         if (!$printable && issetModule('seo') && $apartment->seo && Yii::app()->request->url != $apartmentUrl) {
             $this->redirect($apartmentUrl, true, 301);
         }
     }
     if (!$apartment) {
         throw404();
     }
     if (!in_array($apartment->type, Apartment::availableApTypesIds()) || !in_array($apartment->price_type, array_keys(Apartment::getPriceArray(Apartment::PRICE_SALE, true)))) {
         throw404();
     }
     if ($apartment->owner_id != 1 && $apartment->owner_active == Apartment::STATUS_INACTIVE) {
         if (!(isset(Yii::app()->user->id) && Yii::app()->user->id == $apartment->owner_id) && !Yii::app()->user->checkAccess('backend_access')) {
             Yii::app()->user->setFlash('notice', tt('apartments_main_index_propertyNotAvailable', 'apartments'));
             throw404();
         }
     }
     if (($apartment->active == Apartment::STATUS_INACTIVE || $apartment->active == Apartment::STATUS_MODERATION) && !Yii::app()->user->checkAccess('backend_access') && !(isset(Yii::app()->user->id) && Yii::app()->user->id == $apartment->owner_id)) {
         Yii::app()->user->setFlash('notice', tt('apartments_main_index_propertyNotAvailable', 'apartments'));
         //$this->redirect(Yii::app()->homeUrl);
         throw404();
     }
     if ($apartment->active == Apartment::STATUS_MODERATION && $apartment->owner_active == Apartment::STATUS_ACTIVE && $apartment->owner_id == Yii::app()->user->id) {
         Yii::app()->user->setFlash('error', tc('Awaiting moderation'));
     }
     if ($apartment->deleted) {
         Yii::app()->user->setFlash('error', tt('Listing is deleted', 'apartments'));
     }
     $dateFree = CDateTimeParser::parse($apartment->is_free_to, 'yyyy-MM-dd');
     if ($dateFree && $dateFree < time() - 60 * 60 * 24) {
         $apartment->is_special_offer = 0;
         $apartment->update(array('is_special_offer'));
     }
     if (!Yii::app()->request->isAjaxRequest) {
         $ipAddress = Yii::app()->request->userHostAddress;
         $userAgent = Yii::app()->request->userAgent;
         Apartment::setApartmentVisitCount($apartment, $ipAddress, $userAgent);
     }
     $lastNews = News::getLastNews();
     $lastArticles = Article::getLastArticles();
     #######################################################################
     # для соц. кнопок
     if ($apartment->getStrByLang("title")) {
         Yii::app()->clientScript->registerMetaTag($apartment->getStrByLang("title"), null, null, array('property' => 'og:title'));
     }
     if ($apartment->getStrByLang("description")) {
         Yii::app()->clientScript->registerMetaTag($apartment->getStrByLang("description"), null, null, array('property' => 'og:description'));
     }
     Yii::app()->clientScript->registerMetaTag($apartment->getUrl(), null, null, array('property' => 'og:url'));
     if (Yii::app()->theme->name == 'atlas') {
         $res = Images::getMainThumb(640, 400, $apartment->images);
     } else {
         $res = Images::getMainThumb(300, 200, $apartment->images);
     }
     if (isset($res['thumbUrl']) && $res['thumbUrl']) {
         Yii::app()->clientScript->registerMetaTag($res['thumbUrl'], null, null, array('property' => 'og:image'));
         Yii::app()->clientScript->registerLinkTag('image_src', null, $res['thumbUrl']);
     }
     #######################################################################
     if ($printable) {
         $this->layout = '//layouts/print';
         $this->render('view_print', array('model' => $apartment));
     } else {
         $this->render('view', array('model' => $apartment, 'statistics' => Apartment::getApartmentVisitCount($apartment), 'lastNews' => $lastNews, 'lastArticles' => $lastArticles));
     }
 }
开发者ID:barricade86,项目名称:raui,代码行数:83,代码来源:MainController.php

示例8: getCountModeration

 public static function getCountModeration()
 {
     $sql = "SELECT COUNT(id) FROM {{apartment}} WHERE type IN (" . implode(',', Apartment::availableApTypesIds()) . ") AND active=" . self::STATUS_MODERATION;
     return (int) Yii::app()->db->createCommand($sql)->queryScalar();
 }
开发者ID:alexjkitty,项目名称:estate,代码行数:5,代码来源:Apartment.php

示例9: getDataForListings

 public static function getDataForListings($userId)
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition('active = ' . Apartment::STATUS_ACTIVE);
     if (param('useUserads')) {
         $criteria->addCondition('owner_active = ' . Apartment::STATUS_ACTIVE);
     }
     $criteria->addInCondition('type', Apartment::availableApTypesIds());
     $criteria->addInCondition('price_type', array_keys(Apartment::getPriceArray(Apartment::PRICE_SALE, true)));
     $userModel = User::model()->findByPk($userId);
     $userName = $userModel->getNameForType();
     if ($userModel->type == User::TYPE_AGENCY) {
         $userName = $userModel->getTypeName() . ' "' . $userName . '"';
         $sql = "SELECT id FROM {{users}} WHERE agency_user_id = :user_id AND agent_status=:status";
         $agentsId = Yii::app()->db->createCommand($sql)->queryColumn(array(':user_id' => $userId, ':status' => User::AGENT_STATUS_CONFIRMED));
         $agentsId[] = $userId;
         $criteria->compare('owner_id', $agentsId, false);
     } else {
         $criteria->compare('owner_id', $userId);
     }
     return array('criteria' => $criteria, 'userName' => $userName);
 }
开发者ID:barricade86,项目名称:raui,代码行数:22,代码来源:HUser.php


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