Ejemplo n.º 1
0
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 
$lastFavoritesApartmentCount = ComparisonList::getCountFavoritesApartments();
if ($lastFavoritesApartmentCount > 0) {
    ?>
                    <div class="zayavka shadow">
                        <a href="<?php 
    echo $baseUrl;
    ?>
/comparisonList"><?php 
    echo tt('My favorites', 'common') . ' (' . $lastFavoritesApartmentCount . ')';
    ?>
</a>
                    </div>
                <?php 
}
?>
Ejemplo n.º 2
0
 public function actionDel()
 {
     $userId = $apartmentId = $sessionId = '';
     if (!Yii::app()->user->isGuest) {
         $userId = Yii::app()->user->id;
     }
     $apartmentId = (int) Yii::app()->request->getParam('apId');
     $sessionId = Yii::app()->session->sessionId;
     if ($apartmentId) {
         if ($userId) {
             $result = ComparisonList::model()->findAllByAttributes(array('apartment_id' => $apartmentId, 'user_id' => $userId));
         } else {
             $result = ComparisonList::model()->findAllByAttributes(array('apartment_id' => $apartmentId, 'session_id' => $sessionId));
         }
         if ($result) {
             foreach ($result as $item) {
                 $model = ComparisonList::model()->findByPk($item->id);
                 $model->delete();
             }
         }
         if (Yii::app()->request->isAjaxRequest) {
             echo 'ok';
         } else {
             $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index'));
         }
     }
     Yii::app()->end();
 }
Ejemplo n.º 3
0
            if ($item->canShowInView('window_to') && $item->windowTo->getTitle()) {
                echo CHtml::encode($item->windowTo->getTitle());
            }
            ?>
						</td>
					<?php 
        }
        ?>
				</tr>
                <?php 
    }
    ?>

				<?php 
    if (FormDesigner::isShowForAnything('references')) {
        $categories = ComparisonList::getRefCategories();
        if ($categories) {
            foreach ($categories as $category) {
                echo '<tr>';
                echo '<td>';
                echo '<strong>' . CHtml::encode($category->getStrByLang('title')) . ':</strong>';
                echo '</td>';
                foreach ($apartments as $item) {
                    echo '<td>';
                    $item->references = $item->getFullInformation($item->id, $item->type, $category->id);
                    foreach ($item->references as $ref) {
                        echo '<ul class="compare-description-ul">';
                        if ($ref['title']) {
                            foreach ($ref['values'] as $key => $value) {
                                if ($value) {
                                    echo '<li><span>' . CHtml::encode($value) . '</span></li>';
Ejemplo n.º 4
0
 function init()
 {
     if (!oreInstall::isInstalled() && !(Yii::app()->controller->module && Yii::app()->controller->module->id == 'install')) {
         $this->redirect(array('/install'));
     }
     setLang();
     $modulesToCheck = ConfigurationModel::getModulesList();
     foreach ($modulesToCheck as $module) {
         if (param('module_enabled_' . $module) === null) {
             ConfigurationModel::createValue('module_enabled_' . $module, 0);
             Yii::app()->params['module_enabled_' . $module] = 0;
         }
     }
     unset($modulesToCheck);
     $this->assetsGenPath = Yii::getPathOfAlias('webroot.assets');
     $this->assetsGenUrl = Yii::app()->getBaseUrl(true) . '/assets/';
     Yii::app()->user->setState('menu_active', '');
     $this->pageTitle = tt('siteName', 'seo');
     $this->pageKeywords = tt('siteKeywords', 'seo');
     $this->pageDescription = tt('siteDescription', 'seo');
     Yii::app()->name = $this->pageTitle;
     $this->defaultTheme = Themes::getDefaultTheme();
     if (!$this->defaultTheme) {
         $this->defaultTheme = 'classic';
     }
     Yii::app()->theme = $this->defaultTheme;
     $this->baseUrl = Yii::app()->baseUrl;
     $this->baseThemeUrl = Yii::app()->theme->baseUrl;
     if (Yii::app()->getModule('menumanager')) {
         if (!(Yii::app()->controller->module && Yii::app()->controller->module->id == 'install')) {
             $this->infoPages = Menu::getMenuItems(true, 2);
         }
     }
     $subItems = array();
     if (!Yii::app()->user->isGuest) {
         $subItems = HUser::getMenu();
     }
     $this->aData['userCpanelItems'] = Menu::getMenuItems(true, 1);
     $this->aData['userCpanelItems'][] = array('label' => tt('Reserve apartment', 'common'), 'url' => array('/booking/main/mainform'), 'visible' => Yii::app()->user->checkAccess('backend_access') === false, 'linkOptions' => array('class' => 'fancy'), 'itemOptions' => array('class' => 'depth_zero'));
     $this->aData['userCpanelItems'][] = array('label' => Yii::t('common', 'Control panel'), 'url' => array('/usercpanel/main/index'), 'visible' => Yii::app()->user->checkAccess('backend_access') === false, 'items' => $subItems, 'itemOptions' => array('class' => 'depth_zero'), 'submenuOptions' => array('class' => 'sub_menu_dropdown'));
     if (!Yii::app()->user->isGuest) {
         $user = HUser::getModel();
         $this->aData['userCpanelItems'][] = array('label' => '(' . $user->username . ') ' . tt('Logout', 'common'), 'url' => array('/site/logout'), 'itemOptions' => array('class' => 'depth_zero'));
     }
     $this->aData['topMenuItems'] = $this->infoPages;
     // comparison list
     if (issetModule('comparisonList')) {
         if (!Yii::app()->user->isGuest) {
             $resultCompare = ComparisonList::model()->findAllByAttributes(array('user_id' => Yii::app()->user->id));
         } else {
             $resultCompare = ComparisonList::model()->findAllByAttributes(array('session_id' => Yii::app()->session->sessionId));
         }
         if ($resultCompare) {
             foreach ($resultCompare as $item) {
                 $this->apInComparison[] = $item->apartment_id;
             }
         }
     }
     $this->currentUserIp = Yii::app()->request->getUserHostAddress();
     $this->currentUserIpLong = ip2long($this->currentUserIp);
     $this->datePickerLang = Yii::app()->language;
     if ($this->datePickerLang == 'en') {
         $this->datePickerLang = 'en-GB';
     }
     if (demo()) {
         if (isset($_GET['theme']) && array_key_exists($_GET['theme'], Themes::getColorThemesList())) {
             $theme = $_GET['theme'];
             $cookie = new CHttpCookie('theme', $theme);
             $cookie->expire = time() + 86400;
             Yii::app()->request->cookies['theme'] = $cookie;
         }
     }
     parent::init();
 }
Ejemplo n.º 5
0
 function init()
 {
     if (!oreInstall::isInstalled() && !(Yii::app()->controller->module && Yii::app()->controller->module->id == 'install')) {
         $this->redirect(array('/install'));
     }
     setLang();
     $modulesToCheck = ConfigurationModel::getModulesList();
     foreach ($modulesToCheck as $module) {
         if (param('module_enabled_' . $module) === null) {
             ConfigurationModel::createValue('module_enabled_' . $module, 0);
             Yii::app()->params['module_enabled_' . $module] = 0;
         }
     }
     unset($modulesToCheck);
     $this->assetsGenPath = Yii::getPathOfAlias('webroot.assets');
     $this->assetsGenUrl = Yii::app()->getBaseUrl(true) . '/assets/';
     Yii::app()->user->setState('menu_active', '');
     if (isFree()) {
         $this->pageTitle = param('siteTitle');
         $this->pageKeywords = param('siteKeywords');
         $this->pageDescription = param('siteDescription');
     } else {
         if (issetModule('seo')) {
             $this->pageTitle = Seo::getSeoValue('siteName');
             $this->pageKeywords = Seo::getSeoValue('siteKeywords');
             $this->pageDescription = Seo::getSeoValue('siteDescription');
         } else {
             $this->pageTitle = tt('siteName', 'seo');
             $this->pageKeywords = tt('siteKeywords', 'seo');
             $this->pageDescription = tt('siteDescription', 'seo');
         }
     }
     Yii::app()->name = $this->pageTitle;
     if (Yii::app()->getModule('menumanager')) {
         if (!(Yii::app()->controller->module && Yii::app()->controller->module->id == 'install')) {
             $this->infoPages = Menu::getMenuItems(0);
         }
     }
     if (!Yii::app()->user->isGuest && !Yii::app()->user->getState('isAdmin')) {
         $subItems = HUser::getMenu();
     } else {
         $subItems = array();
     }
     $urlAddAd = Yii::app()->user->isGuest && issetModule('guestad') ? array('/guestad/main/create') : array('/userads/main/create');
     $this->aData['userCpanelItems'] = array(array('label' => tt('Add ad', 'common'), 'url' => $urlAddAd, 'visible' => Yii::app()->user->isGuest == false), array('label' => '|', 'visible' => param('useUserads', 0) == 1), array('label' => tt('Special offers', 'common'), 'url' => array('/specialoffers/main/index')), array('label' => tt('Search for listings on the map', 'common'), 'url' => array('/page/2')), array('label' => tt('Contact us', 'common'), 'url' => array('/contactform/main/index')), array('label' => '|', 'visible' => Yii::app()->user->getState('isAdmin') === null), array('label' => tt('Reserve apartment', 'common'), 'url' => array('/booking/main/mainform'), 'visible' => Yii::app()->user->getState('isAdmin') === null, 'linkOptions' => array('class' => 'fancy')), array('label' => '|', 'visible' => Yii::app()->user->getState('isAdmin') === null), array('label' => Yii::t('common', 'Control panel'), 'url' => array('/usercpanel/main/index'), 'visible' => Yii::app()->user->getState('isAdmin') === null, 'items' => $subItems, 'submenuOptions' => array('class' => 'sub_menu_dropdown')));
     if (!Yii::app()->user->isGuest) {
         $user = HUser::getModel();
         $this->aData['userCpanelItems'][] = array('label' => '|');
         $this->aData['userCpanelItems'][] = array('label' => '(' . $user->username . ') ' . tt('Logout', 'common'), 'url' => array('/site/logout'));
     }
     $this->aData['topMenuItems'] = $this->infoPages;
     // comparison list
     if (issetModule('comparisonList')) {
         if (!Yii::app()->user->isGuest) {
             $resultCompare = ComparisonList::model()->findAllByAttributes(array('user_id' => Yii::app()->user->id));
         } else {
             $resultCompare = ComparisonList::model()->findAllByAttributes(array('session_id' => Yii::app()->session->sessionId));
         }
         if ($resultCompare) {
             foreach ($resultCompare as $item) {
                 $this->apInComparison[] = $item->apartment_id;
             }
         }
     }
     parent::init();
 }