<?php
class Action extends MyTpl{
	private $timer;
	function run(){
		$this->timer = new Timer();
		if(method_exists($this, '_initialize')){
				$this->_initialize();
			}
		$act=isset($_GET["a"])?$_GET["a"]:"index";
		if(method_exists($this,$act)){
				eval('$this->'.$act.'();');
			}else{
				echo '此功能正在建设中...';
			}
	}


	function ShowMsg($msg,$gourl='',$onlymsg=0,$limittime=0)  //页面跳转函数
	{
	$htmlhead  = "<html>\r\n<head>\r\n<title>ELINCMS 信息提示！</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\r\n";
	$htmlhead .= "<base target='_self'/>\r\n<style>div{line-height:160%;}</style></head>\r\n<body leftmargin='0' topmargin='0'>\r\n<center>\r\n<script>\r\n";
	$htmlfoot  = "</script>\r\n</center>\r\n</body>\r\n</html>\r\n";

	if($limittime==0)
	{
		$litime = 1000;
	}
	else
	{
		$litime = $limittime;
	}

	if($gourl=="-1")
	{
		if($limittime==0)
		{
			$litime = 1000;
		}
		$gourl = "javascript:history.go(-1);";
	}

	if($gourl==''||$onlymsg==1)
	{
		$msg = "<script>alert(\"".str_replace("\"","“",$msg)."\");</script>";
	}
	else
	{
		$func = "      var pgo=0;
      function JumpUrl(){
        if(pgo==0){ location='$gourl'; pgo=1; }
      }\r\n";
		$rmsg = $func;
		$rmsg .= "document.write(\"<br /><div style='width:450px;padding:0px;border:1px solid #C5EAF5;'>";
		$rmsg .= "<div style='padding:6px;font-size:12px;border-bottom:1px solid #C5EAF5;background:#C5EAF5;'><b>ELINCMS 信息提示！</b></div>\");\r\n";
		$rmsg .= "document.write(\"<div style='height:130px;font-size:10pt;background:#ffffff'><br />\");\r\n";
		$rmsg .= "document.write(\"".str_replace("\"","“",$msg)."\");\r\n";
		$rmsg .= "document.write(\"";
		if($onlymsg==0)
		{
			if($gourl!="javascript:;" && $gourl!="")
			{
				$rmsg .= "<br /><a href='{$gourl}'>正在指向跳转页面，如果没有反应请点击这里....</a>";
			}
			$rmsg .= "<br/></div>\");\r\n";
			if($gourl!="javascript:;" && $gourl!='')
			{
				$rmsg .= "setTimeout('JumpUrl()',$litime);";
			}
		}
		else
		{
			$rmsg .= "<br/><br/></div>\");\r\n";
		}
		$msg  = $htmlhead.$rmsg.$htmlfoot;
	}
	echo $msg;
	exit();
}

}
?>