本文整理汇总了PHP中Apartment::findAllWithCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Apartment::findAllWithCache方法的具体用法?PHP Apartment::findAllWithCache怎么用?PHP Apartment::findAllWithCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Apartment
的用法示例。
在下文中一共展示了Apartment::findAllWithCache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: array
<?php
if (empty($apartments)) {
$apartments = Apartment::findAllWithCache($criteria);
}
$findIds = $countImagesArr = array();
foreach ($apartments as $item) {
$findIds[] = $item->id;
}
if (count($findIds) > 0) {
$countImagesArr = Images::getApartmentsCountImages($findIds);
}
foreach ($apartments as $item) {
$addClass = '';
if ($item->is_special_offer) {
$addClass = 'special_offer_highlight';
} elseif ($item->date_up_search != '0000-00-00 00:00:00') {
$addClass = 'up_in_search';
}
?>
<div class="appartment_item <?php
echo $addClass;
?>
" lat="<?php
echo $item->lat;
?>
" lng="<?php
echo $item->lng;
?>
" ap_id="<?php
echo $item->id;
示例3: run
public function run()
{
Yii::app()->getModule('apartments');
$criteria = $this->criteria ? $this->criteria : new CDbCriteria();
if ($this->filterOn) {
Yii::app()->controller->aData['searchOnMap'] = true;
$this->renderFilter($criteria);
}
if (param('useYandexMap', 1)) {
echo $this->render('application.modules.apartments.views.backend._ymap', '', true);
CustomYMap::init()->createMap();
} elseif (param('useGoogleMap', 1)) {
CustomGMap::createMap();
} else {
echo '<div id="osmap"></div>';
CustomOSMap::createMap();
}
$lang = Yii::app()->language;
$criteria->select = 'lat, lng, id, type, address_' . $lang . ', title_' . $lang . ', address_' . $lang;
$ownerActiveCond = '';
if (param('useUserads')) {
$ownerActiveCond = ' AND owner_active = ' . Apartment::STATUS_ACTIVE . ' ';
}
$criteria->addCondition('lat <> "" AND lat <> "0" AND active=' . Apartment::STATUS_ACTIVE . ' AND (owner_id=1 OR owner_id>1 ' . $ownerActiveCond . ')');
$apartments = Apartment::findAllWithCache($criteria);
if (param('useYandexMap', 1)) {
$lats = array();
$lngs = array();
foreach ($apartments as $apartment) {
$lats[] = $apartment->lat;
$lngs[] = $apartment->lng;
CustomYMap::init()->addMarker($apartment->lat, $apartment->lng, $this->render('application.modules.apartments.views.backend._marker', array('model' => $apartment), true), true, $apartment);
}
if ($lats && $lngs) {
CustomYMap::init()->setBounds(min($lats), max($lats), min($lngs), max($lngs));
if ($this->withCluster) {
CustomYMap::init()->setClusterer();
} else {
CustomYMap::init()->withoutClusterer();
}
} else {
$minLat = param('module_apartments_ymapsCenterX') - param('module_apartments_ymapsSpanX') / 2;
$maxLat = param('module_apartments_ymapsCenterX') + param('module_apartments_ymapsSpanX') / 2;
$minLng = param('module_apartments_ymapsCenterY') - param('module_apartments_ymapsSpanY') / 2;
$maxLng = param('module_apartments_ymapsCenterY') + param('module_apartments_ymapsSpanY') / 2;
CustomYMap::init()->setBounds($minLng, $maxLng, $minLat, $maxLat);
}
CustomYMap::init()->changeZoom(0, '+');
CustomYMap::init()->processScripts(true);
} elseif (param('useGoogleMap', 1)) {
foreach ($apartments as $apartment) {
CustomGMap::addMarker($apartment, $this->render('application.modules.apartments.views.backend._marker', array('model' => $apartment), true));
}
if ($this->withCluster) {
CustomGMap::clusterMarkers();
}
CustomGMap::setCenter();
CustomGMap::render();
} elseif (param('useOSMMap', 1)) {
foreach ($apartments as $apartment) {
CustomOSMap::addMarker($apartment, $this->render('application.modules.apartments.views.backend._marker', array('model' => $apartment), true));
}
if ($this->withCluster) {
CustomOSMap::clusterMarkers();
}
CustomOSMap::setCenter();
CustomOSMap::render();
}
}