<?php

/**
 * 前台 资讯模块
 * ============================================================================
 * ZhunaCMS 住哪网酒店分销联盟程序php版　BY Tmac PHP MVC framework
 * $Author: zhaojianjun $  <zwttmac@qq.com>
 * $Id: news.php 79 2011-12-15 06:36:06Z zhaojianjun $
 * http://union.zhuna.cn；
 */
class newsAction extends Action
{

    private $tmp_model;
    private $common_model;
    private $hotel_left_model;

    public function _init()
    {
        $this->assign('action', $_GET['TMAC_ACTION']);
        $this->assign('method',$_GET['TMAC_CONTROLLER']);
        $this->tmp_model = Tmac::model('news');
        $this->common_model = Tmac::model('common');
        $this->hotel_left_model = Tmac::model('hotelLeft');
        //搜索块默认值
        $Searchinfo = $this->hotel_left_model->setLeftSearch();
        //设置SearchCookies$Searchinfo
        $sk_array=$this->hotel_left_model->getSearchCookies($Searchinfo);
        //取cityinfo
        $this->cityinfo = $this->hotel_left_model->getCityinfo();

        //footer里的相关设置
        $config_footer = $this->common_model->footer();
        $this->assign($config_footer);
        $this->assign('sk_array', $sk_array);
        $this->assign('cityinfo', $this->cityinfo);
    }

    public function index()
    {
        $class_id = intval($this->getParam('class_id'));
        if (!empty($class_id)) {
            $class_info = $this->tmp_model->getClassInfo($class_id);
        } else {
            $class_info = array('class_name' => '出行资讯');
        }

        $this->assign('class_id', $class_id);
        $this->assign('class_info', $class_info);
        
        //title keywords description k_page(news)
        $keywords_info = $this->hotel_left_model->getKeywordsInfo(6);
        $keywords_array = $keywords_info[1];
        $keywords_search = array('{doname}', '{classname}');
        $keywords_replace = array("$keywords_info[0]", $class_info['class_name']);
        $keywords_array = str_replace($keywords_search, $keywords_replace, $keywords_array);
        $this->assign('keywords_array', $keywords_array);        
        $this->V('news');
    }

}