<?php Yii::app()->controller->renderPartial('//site/index-search'); ?> </div> <div class="zayavka shadow"> <a href="<?php echo $baseUrl; ?> /booking/request"><?php echo tt('Application selection', 'common'); ?> </a> </div> <?php $lastViewedApartmentCount = Apartment::getLastVisitedObjects(); if ($lastViewedApartmentCount[0] > 0) { ?> <div class="zayavka shadow"> <a href="<?php echo $baseUrl; ?> /apartments/main/last"><?php echo tt('My views', 'common') . ' (' . $lastViewedApartmentCount[0] . ')'; ?> </a> </div> <?php } ?> <?php
public function actionLast() { $result = array(); $lastViewsCount = 0; $lastViewedApartments = Apartment::getLastVisitedObjects(); if (!empty($lastViewedApartments)) { $lastViewsCount = $lastViewedApartments[0]; $result = $lastViewedApartments[1]; } $criteria = new CDbCriteria(); $criteria->addInCondition("t.id", $result); if (isset($_GET['is_ajax'])) { $this->renderPartial('last_viewed', array('criteria' => $criteria, 'apCount' => $lastViewsCount), false, true); } else { $this->render('last_viewed', array('criteria' => $criteria, 'apCount' => $lastViewsCount)); } }