<?php
require_once 'Config.php';
/**
 * 单页类
 *
 * @author Wzb
 *        
 */
class USL_Intro extends USL_Base {
	/**
	 * 页面标签
	 *
	 * @var string
	 */
	private $_tag;
	
	/**
	 * 单页对象
	 *
	 * @var object
	 */
	private $_onePageObj;
	
	/**
	 * 构造类
	 *
	 * @param string $tag 标签
	 */
	public function __construct($tag) {
		parent::__construct ();
		$this->init ( $tag );
		$this->setOnePage ();
		$this->setWeiZhi ();
	}
	
	/**
	 * 初始化
	 *
	 * @param string $tag 标签
	 */
	private function init($tag) {
		$this->_weizhi = $this->_tag = $tag;
		switch ($tag) {
			case "lxwm" :
				$this->_onePageObj = BLL_OnePage::getOne ( 2 ); // 联络我们
				break;
			case "hzlc" :
				$this->_onePageObj = BLL_OnePage::getOne ( 1 ); 
				break;
			default :
				die ( COM_OftenJavaScript::showInfo ( "标签错误" ) );
				break;
		}
	}
	
	/**
	 * 设置变量值
	 */
	public function _assignContent() {
		parent::_showComm ();
		$this->_tpl->assign ( "webName", $this->_webStr ); // 网站标题
		$this->_tpl->assign ( "theKeyWords", $this->_keywords ); // 网站关键字
		$this->_tpl->assign ( "theDescription", $this->_description ); // 网站描述
		$this->_tpl->assign ( "leftNav", $this->_leftNav ); // 左侧导航
		$this->_tpl->assign ( "thisName", $this->_thisName ); // 栏目名称
		$this->_tpl->assign ( "address", $this->_address ); // 当前位置
		$this->_tpl->assign ( "onePage", $this->_onePageObj ); // 单页对象
	}
	
	/**
	 * 设置位置信息
	 */
	private function setWeiZhi() {
		switch ($this->weizhiRoot ()) {
			// 在这里进行 “ 当前位置 、左侧导航 ” 的非常规设置!!!!!
			default :
				$this->_leftNav = USL_LeftNav::_Intro ( $this->_onePageObj ['title'], $this->_tag );
				break;
		}
		$this->_address [] = array ("title" => $this->_onePageObj ['title'],"url" => "" );
	}
	
	/**
	 * 设置单页常规信息
	 */
	private function setOnePage() {
		if (count ( $this->_onePageObj ) == 0) {
			die ( COM_OftenJavaScript::showInfo ( "单页不存在" ) );
		}
		$this->_thisName = $this->_onePageObj ['title'];
		$this->_webStr = COM_OftenFunction::setWebName ( $this->_onePageObj ['title'] . '-' );
		$this->_keywords = $this->_onePageObj ['title'];
		$this->_description = COM_OftenFunction::CutStr ( COM_OftenFunction::noHtml ( $this->_onePageObj ['content'] ), 200 );
		// 注意设置这里的内容页图片宽度限制PX
		$this->_onePageObj ['content'] = str_replace ( array ("<img","<IMG" ), "<img onload=\"resize(this,700)\"", $this->_onePageObj ['content'] );
	}
}

// 实例化
$configObj = BLL_WebSet::getOne ();
$thisPage = new USL_Intro ( $_GET ['tag'] );
$thisPage->_assignContent ();
$thisPage->_tpl->display ( "Tpl/Intro.tpl" );
?>