<?php

/**
 * 前台 城市首页 模块 Controller
 * ============================================================================
 * ZhunaCMS 住哪网酒店分销联盟程序php版　BY Tmac PHP MVC framework
 * $Author: zhangwentao $  <zwttmac@qq.com>
 * $Id: city.php 41 2011-12-01 06:58:03Z zhangwentao $
 * http://un.zhuna.cn；
 */
class cityAction extends Action
{

    private $hotel_left_model;
    private $common_model;
    private $liansuo_model;
    private $index_model;
    private $cityinfo;

    public function _init()
    {
        $this->assign('action', $_GET['TMAC_ACTION']);
        $this->assign('method',$_GET['TMAC_CONTROLLER']);
        $this->index_model = Tmac::model('index');
        $this->common_model = Tmac::model('common');
        $this->liansuo_model = Tmac::model('liansuo');
        $this->hotel_left_model = Tmac::model('hotelLeft');

        //取cityinfo
        $this->cityinfo = $this->hotel_left_model->getCityinfo();
        //搜索块默认值
        $sk_array = $Searchinfo = $this->hotel_left_model->setLeftSearch();        
		$this->assign('sk_array', $sk_array);
        //footer里的相关设置
        $config_footer = $this->common_model->footer();
        $this->assign($config_footer);
        $this->assign('cityinfo', $this->cityinfo);
    }

    public function index()
    {
        //取酒店总数/评价总数
        $hotel_count = $this->index_model->getHotelCount();
        //设置首页默认第一的搜索城市 $uncityinfo
        $uncityinfo = $this->index_model->setDefaultCity();

        //title keywords description k_page(city)
        $keywords_info = $this->hotel_left_model->getKeywordsInfo(19);
        $keywords_array = $keywords_info[1];
        $keywords_search = array('{doname}', '{cityname}');
        $keywords_replace = array("$keywords_info[0]", $this->cityinfo['cityname']);
        $keywords_array = str_replace($keywords_search, $keywords_replace, $keywords_array);
        $this->assign('keywords_array', $keywords_array);
        $this->assign($hotel_count);
        $this->assign($uncityinfo);
        $this->V('city');
    }

}