public function run() { Yii::import('application.modules.apartments.helpers.apartmentsHelper'); $this->widgetTitle = tc('Special offers'); $this->criteria = new CDbCriteria(); $this->criteria->addCondition('is_special_offer = 1'); $result = apartmentsHelper::getApartments(param('countListitng' . User::getModeListShow(), 6), $this->usePagination, 0, $this->criteria); if ($this->count) { $result['count'] = $this->count; } $this->render('widgetApartments_list', $result); }
public function run() { Yii::import('application.modules.apartments.helpers.apartmentsHelper'); $result = apartmentsHelper::getApartments(param('countListitng' . User::getModeListShow(), 10), $this->usePagination, 0, $this->criteria); if (!$this->breadcrumbs) { $this->breadcrumbs = array(Yii::t('common', 'Apartment search')); } if ($this->count) { $result['count'] = $this->count; } else { $result['count'] = $result['apCount']; } $this->render('widgetApartments_list', $result); }
public function run() { Yii::import('application.modules.apartments.helpers.apartmentsHelper'); $dependency = new CDbCacheDependency('SELECT MAX(date_updated) FROM {{apartment}}'); $sql = 'SELECT id FROM {{apartment}} WHERE active="' . Apartment::STATUS_ACTIVE . '" '; if (param('useUserads')) { $sql .= ' AND owner_active = ' . Apartment::STATUS_ACTIVE; } $results = Yii::app()->db->cache(param('cachingTime', 1209600), $dependency)->createCommand($sql)->queryColumn(); shuffle($results); $this->criteria = new CDbCriteria(); $this->criteria->addInCondition('t.id', array_slice($results, 0, param('countListitng' . User::getModeListShow(), 6))); $result = apartmentsHelper::getApartments(param('countListitng' . User::getModeListShow(), 6), $this->usePagination, 0, $this->criteria); if ($this->count) { $result['count'] = $this->count; } $this->render('widgetApartments_list', $result); }
public function viewSimilarAds($data = null) { $similarAds = new SimilarAds(); $criteria = new CDbCriteria(); $criteria->addCondition('active = ' . Apartment::STATUS_ACTIVE); if (param('useUserads')) { $criteria->addCondition('owner_active = ' . Apartment::STATUS_ACTIVE); } if ($data->id) { $criteria->addCondition('t.id != :id'); $criteria->params[':id'] = $data->id; } if (issetModule('location') && param('useLocation', 1)) { if ($data->loc_city) { $criteria->addCondition('loc_city = :loc_city'); $criteria->params[':loc_city'] = $data->loc_city; } } else { if ($data->city_id) { $criteria->addCondition('city_id = :city_id'); $criteria->params[':city_id'] = $data->city_id; } } if ($data->obj_type_id) { $criteria->addCondition('obj_type_id = :obj_type_id'); $criteria->params[':obj_type_id'] = $data->obj_type_id; } if ($data->type) { $criteria->addCondition('type = :type'); $criteria->params[':type'] = $data->type; } if ($data->price_type) { $criteria->addCondition('price_type = :price_type'); $criteria->params[':price_type'] = $data->price_type; } $criteria->limit = param('countListitng' . User::getModeListShow(), 10); $criteria->order = 't.id ASC'; $ads = $similarAds->getSimilarAds($criteria); if ($ads) { $similarAds->publishAssets(); } $this->render('widgetSimilarAds_list', array('ads' => $ads)); }
public function run() { Yii::import('application.modules.apartments.helpers.apartmentsHelper'); $this->criteria = new CDbCriteria(); if ($this->bt_param == 'latest-app-tb-left') { $this->criteria->addCondition('type = 3'); } else { $this->criteria->addCondition('type = 4'); } $result = apartmentsHelper::getApartments(param('countListitng' . User::getModeListShow(), 10), $this->usePagination, 0, $this->criteria); if (!$this->breadcrumbs) { $this->breadcrumbs = array(Yii::t('common', 'Apartment search')); } if ($this->count) { $result['count'] = $this->count; } else { $result['count'] = $result['apCount']; } $result['bt_param'] = $this->bt_param; $this->render('widgetApartments_list_Table', $result); }
<?php $modeListShow = User::getModeListShow(); $route = Controller::getCurrentRoute(); $urlsSwitching = array('block' => Yii::app()->createUrl($route, array('ls' => 'block') + $_GET, '&'), 'table' => Yii::app()->createUrl($route, array('ls' => 'table') + $_GET, '&'), 'map' => Yii::app()->createUrl($route, array('ls' => 'map') + $_GET, '&')); if (!param('useGoogleMap', 0) && !param('useYandexMap', 0) && !param('useOSMMap', 0)) { unset($urlsSwitching['map']); } Yii::app()->clientScript->registerScript('search-vars', "\n\tvar urlsSwitching = " . CJavaScript::encode($urlsSwitching) . ";\n", CClientScript::POS_HEAD); if (!Yii::app()->request->isAjaxRequest) { Yii::app()->clientScript->registerScript('search-params', "\n var updateText = '" . Yii::t('common', 'Loading ...') . "';\n var resultBlock = 'appartment_box';\n var indicator = '" . Yii::app()->request->baseUrl . "/images/pages/indicator.gif';\n var bg_img = '" . Yii::app()->request->baseUrl . "/images/pages/opacity.png';\n\n var useGoogleMap = " . param('useGoogleMap', 0) . ";\n var useYandexMap = " . param('useYandexMap', 0) . ";\n var useOSMap = " . param('useOSMMap', 0) . ";\n\n var modeListShow = " . CJavaScript::encode($modeListShow) . ";\n\n \$('div.appartment_item').live('mouseover mouseout', function(event){\n if (event.type == 'mouseover') {\n \$(this).find('div.apartment_item_edit').show();\n } else {\n \$(this).find('div.apartment_item_edit').hide();\n }\n });\n\n function setListShow(mode){\n modeListShow = mode;\n reloadApartmentList(urlsSwitching[mode]);\n };\n\n\n \$(function () {\n if(modeListShow == 'map'){\n list.apply();\n }\n });\n ", CClientScript::POS_HEAD, array(), true); } ?> <?php if (Yii::app()->request->isAjaxRequest && $route != 'site/index') { ?> <?php if (isset($this->breadcrumbs) && $this->breadcrumbs) { ?> <div class="clear"></div> <?php $this->widget('zii.widgets.CBreadcrumbs', array('links' => $this->breadcrumbs, 'separator' => ' → ')); ?> <div class="clear"></div> <?php } } ?> <div class="title_list">