<?php
	session_start();
	ini_set('session.gc_maxlifetime', 99999999); //设置时间 永不过期	
	//判断是否登录系统
	if($_SESSION['main_wx_userlogined']!="1" | $_SESSION['main_wx_userno']=="")
	{
		//没有登录开始启动登录
		header('location:..\loginwx.php?rset=0');
		exit;
	}
	
	header("Content-type: text/html; charset=gb2312"); 
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="gb2312">	
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
	<meta name="apple-mobile-web-app-capable" content="1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=0">
	<meta name="apple-touch-fullscreen" content="1">

	<title>客房云点通</title>

	<link rel="stylesheet" href="jsp4/jquery.mobile-1.4.3.min.css">
	<script src="jsp4/jquery.js"></script>
	<script src="jsp4/jquery.mobile-1.4.3.min.js"></script>
	<link rel="stylesheet" href="css/mycss.css"> 
	
	<script>
		//清空登录信息资料
		var ddt=<?php echo $_SESSION["main_defusernoflag_ydtpos"]; ?>;
		if(ddt=="1")
		{	ddt=<?php echo $_SESSION["main_defuserno_ydtpos"]; ?>;
			localStorage["main_defuserno_ydtpos"]=ddt;
		}
	</script>
</head>

<script>	
	//隐藏维信右上角菜单
	function onBridgeReady(){
		WeixinJSBridge.call('hideOptionMenu');
	}

	if (typeof WeixinJSBridge == "undefined")
	{
		if( document.addEventListener )
		{
			document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
		}
		else if (document.attachEvent)
		{
			document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
			document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
		}
	}
	else
	{
		onBridgeReady();
	}
</script>

<?php		
	require_once("db/db.php");	
	require_once("common/common.php");
	
	//得到默认日期
	$strnewchainname = trim($_SESSION['ChainName']);
	$nowchainno=trim($_SESSION['ChainNo']);
?>

<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">

<section data-role="page" id="pagechain">
	<header data-role="header" data-position="fixed" data-tap-toggle="false">
		<table width="100%" height="35" border="0" cellpadding="0" cellspacing="0">
		   <tr>
			<td height="35" width="45" align="right">
				<a href="index.php?selno=<?php echo $nowchainno;?>" data-role="button" target="_parent" data-iconpos="notext" data-icon="carat-l">
			</td>
			<td height="35" align="center">
				<span style="color:#000;font: 12px/1.5 '微软雅黑',tahoma, Srial, helvetica, sans-serif; font-size:18px;text-shadow:none;"><?php echo $strnewchainname;?></span>
			</td>
			<td height="35" width="45" ></td>
		  </tr>
		</table>
	</header>
	<article data-role="content">
		<ul data-role="listview" data-inset="true">    
		 <?php
		 
			$selchainno="";
			$selchainname="";
		 
			$userno=trim($_SESSION['main_wx_userno']);
					
			$sql=sprintf("SELECT Chain_No,Chain_Name FROM dbo.TRF_AppGetChainFromUser('%s');",$userno);
			$result = querySql($sql);
										
			while($row = fetch_array($result))
			{
				$selchainno = $row['Chain_No'];  
				$selchainname = $row['Chain_Name'];
				
		?>
			<li>
				<a class="ui-btn ui-corner-all ui-shadow ui-btn-inline" href="index.php?selno=<?php echo $selchainno;?>" target="_blank" >
				<?php echo $selchainname;?><span class="ui-li-count">
				<?php echo $selchainno;?></span></a>
			</li> 
		<?php
			}
			//释放数据库
			freeResult($result);
			closeDb();
		 ?>
		  
		</ul> 
	</article>
	
</section>
</body>
	
</html>