<?php
/*********************************************************      
 文件说明:         
    功能说明:OMC界面左侧主菜单


    调用关系:调用:header.inc  
             被调用:实现各个功能模块的页面        
    变量说明:
			$OmcTypeNo		在config.inc中定义;
			$myPrivilege	从用户的session中取出

 作者:      
      
修改注释:      
NO.1      
姓名:            
时间:      
修改说明:      
*********************************************************/ 
require("../../inc/header.inc");

$DEBUG = 0;
$pubDb = 'OMC_PUB';
$menuTable='sysMenuConf';
$elementTable='elementExistConf';
$OmcTypeNo = (isset($thisOmcType)?$thisOmcType:0);
$level_1 = $_REQUEST['level_1'];
if($DEBUG) echo "level_1=$level_1<br>";
$level_1 = ($level_1 > 0 ?$level_1 :1);
$myPrivilege = $userInfo['privilege'];
$max_layer=5;
if($selectedLanguage == 'eng'){
	$menuName	= 'name_2';
	$menuRemark	= 'remark_2';
}else{
	$menuName	= 'name_1';
	$menuRemark	= 'remark_1';
}
getSerial();
$tmpSql="SELECT * FROM $elementTable ORDER BY elementNo";
if($DEBUG) echo "<br>menuSql = $menuSql";
$tmpResult = mysqli_query($pubConn,$tmpSql);
echo mysqli_error($pubConn);
while($tmpRow=mysqli_fetch_array($tmpResult)){
    $tmpNum=$tmpRow['elementNo'];
    $elementExistArr[$tmpNum]=$tmpRow['existFlag'];
}


//for($i=0;$i<sizeof($elementExistArr);$i++)
//	echo "<br>$i=$elementExistArr[$i]";

//menuTypeNo level_1 level_2 level_3 level_4 level_5 name_1 name_2 link_1 link_2 privilege remark_1 remark_2 
$menuSql = "SELECT level_1,level_2,level_3,level_4,level_5,$menuName,httpLink,$menuRemark,menuTypeNo 
			FROM $menuTable 
			WHERE  privilege <= '$myPrivilege' AND privilege >= '0'
			AND level_1='$level_1'
			ORDER BY level_1,level_2,level_3,level_4,level_5
			";
if($DEBUG) echo "<br>menuSql = $menuSql";
$menuResult = mysqli_query($pubConn,$menuSql);
echo mysqli_error($pubConn);
$menuRowsNum = mysqli_num_rows($menuResult);

//init menu array
$tmpArrNo=0;
for($i=0;$i< $menuRowsNum;$i++){
	$menuRow=mysqli_fetch_array($menuResult);
	//echo "<br>menuTypeNo=$menuRow[menuTypeNo]";
	if($elementExistArr[$menuRow['menuTypeNo']]!=1)
		continue;
    $menu_arr[$tmpArrNo]=array(0,0,0,0,0,'menuName','menuLink','menuRemak'); //match to $max_layer
    $menu_arr[$tmpArrNo][0]=$menuRow['level_1'];
    $menu_arr[$tmpArrNo][1]=$menuRow['level_2'];
    $menu_arr[$tmpArrNo][2]=$menuRow['level_3'];
    $menu_arr[$tmpArrNo][3]=$menuRow['level_4'];
    $menu_arr[$tmpArrNo][4]=$menuRow['level_5'];
    $menu_arr[$tmpArrNo][$max_layer]=$menuRow[$menuName];
    $menu_arr[$tmpArrNo][$max_layer + 1]=$menuRow['httpLink'];
    $menu_arr[$tmpArrNo][$max_layer + 2]=$menuRow[$menuRemark];
    $tmpArrNo++;
}
$topMenuName=$menu_arr[0][$max_layer];
/*
if($DEBUG){
	echo "<br>menuRowsNum = $menuRowsNum";
	echo "<br>-------------------------------------";
	//显示导入数组的信息
	for($i=0;$i<$menuRowsNum;$i++){
		echo "<br>>";
		for($j=0;$j<$max_layer;$j++){
			if($menu_arr[$i][$j] > 0){
				echo "{$menu_arr[$i][$j]}";
				echo ".";
			}
		}
		echo "-{$menu_arr[$i][$max_layer]}";
		echo "-{$menu_arr[$i][$max_layer+1]}";
		echo "-{$menu_arr[$i][$max_layer+2]}";
	}
}
*/
?>

<base target="contents">
<style type="text/css">
<!--
body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;BACKGROUND-IMAGE: url(../../images/background_left.gif);BACKGROUND-REPEAT: no-repeat;BACKGROUND-POSITION:top left;BACKGROUND-COLOR: #f0efef;OVERFLOW: hidden}
A:link{ color: #000000}
A:visited {color: #000000}
A:hover   {color: #000000; background:#AAFFFF; text-decoration: underline;}
A:active  {color: #000000; background:#FFFF80;}
.parent	  {}
.child	  {}
-->
</style>

<!-- OMC Sever's timezone must is GMT0-->
<script LANGUAGE="JavaScript" language="JavaScript1.2">
var server_timestamp=<?php echo mktime(); ?>;
var timeoffset=<?php echo date("Z"); ?>;
server_timestamp=server_timestamp+timeoffset;
var now = new Date();
var client_timestamp = now.getTime() / 1000;
var diff_seconds = server_timestamp - client_timestamp;

function clock()
{
	now = new Date();
	var timeZoneOffsetMin = now.getTimezoneOffset();
	var years   = now.getFullYear();
	var months  = now.getMonth();
	var days    = now.getDate();
	var hours   = now.getHours();
	var minutes = now.getMinutes()+timeZoneOffsetMin;
	//var minutes = now.getMinutes();
	var seconds = now.getSeconds()+diff_seconds;

	theDate=new Date(Date.UTC(years,months,days,hours,minutes,seconds));
	var DateYear=theDate.getFullYear();
      
	var DateMonth=theDate.getUTCMonth()+1;
	DateMonth=((DateMonth < 10) ? "0" : "")+DateMonth;
      
	var DateDay=theDate.getUTCDate();
	DateDay=((DateDay < 10) ? "0" : "")+DateDay;

	var DateHour=theDate.getUTCHours();
	DateHour=((DateHour < 10) ? "0" : "")+DateHour;

	var DateMinute=theDate.getUTCMinutes();
	DateMinute=((DateMinute < 10) ? "0" : "")+DateMinute;

	var DateSecond=theDate.getUTCSeconds();
	DateSecond=((DateSecond < 10) ? "0" : "")+DateSecond;

	var Time=" "+DateYear+"-"+DateMonth+"-"+DateDay+" "+DateHour+":"+DateMinute+":"+DateSecond;
		
	document.clock.time.value=Time;
	Timer = setTimeout("clock()",1000);
}

function show_id(web_id)
{
	document.page_num.p_num.value =" # "+web_id;
}

function adjustTreeHeight()
{
	var offsetW=document.body.offsetWidth;
	var offsetH=document.body.offsetHeight;
	var scrollH=document.body.scrollHeight;
	var scrollW=document.body.scrollWidth;
	var clientH=document.body.clientHeight;
	var clientW=document.body.clientWidth;
	
	var browserr = navigator.appName;
	if(browserr == "Microsoft Internet Explorer")
	{
		document.getElementById('tree_id').height=offsetH-160;
	}
	else
	{
		document.getElementById('tree_id').height=offsetH-210;
	}
}

</script>

</head>
<!--
<body onLoad="clock();initIt();">
-->
<body topmargin="5" leftmargin="5" onLoad="clock();adjustTreeHeight();" onresize="adjustTreeHeight();">

<table border="0" cellpadding="0" cellspacing="0">
<tr><td>
	<form name="clock">
		<table border="0" cellpadding="0" cellspacing="0">
		<tr><td align="center" title="OMC Server's time">&nbsp;
		<INPUT TYPE="text" NAME="time" SIZE="20" style="background-color:transparent;background:;border-left:medium none;border-right:medium none;border-top:medium none;border-bottom:medium none;font-size: 9pt" READONLY VALUE="">
		</td></tr>
		
		<tr><td align="center" title="Field Name">
		<?php
		$fieldName = getPubVar('fieldName');
		echo "<font size=2>&nbsp;$fieldName</font>";
		?>
		</td></tr> 
<?php
			echo "<tr><td align=\"center\">SN:<font color=\"$ttlSrlClr\">$ttlSerial</font></td></tr>";
?>		
<tr><td align="center">
<?php echo "[{$userInfo['ID']}]"; ?>
</td></tr>    
		</table>
	</form>
</td></tr>           
</table>


<script LANGUAGE="JavaScript" type="text/javascript">
<!--
<!--检测浏览器的名称与版本2-->
var NS = (document.layers) ? 1 : 0;
var IE=((navigator.appName=="Microsoft Internet Explorer")&&(parseInt(navigator.appVersion)>=3))?1:0;
<!--window.document.write("<br>NS="+NS+",IE="+IE);-->
var bV=parseInt(navigator.appVersion);
DOM=(!document.layers && !document.all && bV>=4) ? true : false; // A hack to guess if the browser supports the DOM
capable = (NS || IE || DOM) ? true : false;
//function expandIt(){return}
//function expandAll(){return}
//-->
</script>



<?php
/*************************************下面是顺序显示菜单程序***************************************/ 
echo "<table border=0 height=100% cellspacing=0 cellpadding=0>";
echo "<tr>";
echo "<td id=\"tree_id\" valign=top>";
echo "<iframe name=\"menuTree\" src=\"./menuTree.php?level_1=$level_1\" width=\"100%\" height=\"100%\" align=\"middle\" framespacing=0 border=0 frameborder=0 style=\"position:relative;top:5;left:5;filter:chroma(color=#ffffff);\">";
echo "</iframe>";

echo "</td></tr>";
?>
<tr><td id="online_id" valign=top align=left>

<table>
<tr>
	<td>&nbsp;</td>
</tr>
<tr>
<td><a href="javascript:openHelp('0.0');">Online Help</a></td>
</tr>
<tr>
<td><a href="./siteMap.php">Site map</a></td>
</tr>
<tr><td>
<div onclick="javascript:logout();"; style="cursor:w-resize" title="Logout OMC">
<img src="../../images/logout.gif"  align=absBottom border=0 >
<?php echo "&nbsp;<b>$strExit</b>"; ?>
</div>
</td>
</tr>

</table>

</td></tr></table>



<script language="javascript">
	function logout()
	{
		var isLogout=confirm('Do you want to logout?');
		if(isLogout == 1){
			window.parent.parent.location.href="../../security/logout/logout.php";
			return(true);
		}
		return(false);
	}
</script>



</body>

</html>

