<?php
/*********************************************************      
 程序说明：         
    功能说明：告警查询的下部页面，查询显示
    调用关系：
    变量说明：

    作者： 
      
修改注释：      
NO.1      
姓名：            
时间：      
修改说明：      
*********************************************************/
require("../../inc/header.inc");
$DEBUG = 0;
getSerial();//get serial number
//==========================================================
//变量定义
//==========================================================
$dbName		= 'OMC_PUB';
$defTable	= 'sysAlarmConf';
$logTable	= 'sysAlarmLog';

$alarmNumArr[1][number]	=0;
$alarmNumArr[1][title]	="Critical Alarm";
$alarmNumArr[1][bgcolor]="#FF0000";
//$alarmNumArr[1][bgcolor]="#FF9900";

$alarmNumArr[2][number]	=0;
$alarmNumArr[2][title]	="Major Alarm";
$alarmNumArr[2][bgcolor]="#FF9900";
//$alarmNumArr[2][bgcolor]="#FFCC99";

$alarmNumArr[3][number]	=0;
$alarmNumArr[3][title]	="Minor Alarm";  
$alarmNumArr[3][bgcolor]="#FFFF99";

$alarmNumArr[4][number]	=0;
$alarmNumArr[4][title]	="Warning";  
$alarmNumArr[4][bgcolor]="#CCFFFF";

$alarmNumArr[5][number]	=0;
$alarmNumArr[5][title]	="Undefined Alarm"; 
$alarmNumArr[5][bgcolor]="#99CCFF";
//==========================================================
//输入变量
//==========================================================


//==========================================================
//数据处理
//==========================================================

$showSql=" SELECT  t2.alarmLevel,count(*) as number
			FROM $logTable as t1,$defTable as t2
			WHERE t1.clearTime = '0000-00-00 00:00:00' 
				AND t1.sysTypeNo = t2.sysTypeNo 
				AND t1.compCode  = t2.compCode 
				AND t1.alarmCode = t2.alarmCode
			GROUP BY t2.alarmLevel
		";
if($DEBUG) echo "<br>showSql=$showSql";
$result=@mysqli_query($pubConn,$showSql);
echo mysqli_error($pubConn);

while($rows=@mysqli_fetch_array($result)){
	$alarmNumArr[$rows[alarmLevel]][number]=$rows[number];
}

//==========================================================
//输出并显示数据
//==========================================================

?>
<script language="JavaScript">
function refreshpage()
{
	setInterval(ref,10000);
}
function ref()
{
	window.location.href="./alarmNumList.php";
}
</script>

<body leftmargin="0" topmargin="0" onload="javascript:refreshpage();">
<style type="text/css">
<!--
A:link    {text-decoration: none; color: #000000}
A:visited {text-decoration: none; color: #000000}
A:hover   {text-decoration: none; color: #FFFFFF}
-->
</style>

<meta http-equiv="refresh" content="10 url=<?php echo "$PHP_SELF"; ?>">
<meta http-equiv="pragma" content="no-cache">
<div align="right">
<table border="0" width="100%">
<tr>
<td width="55%"  title="Serial Number">
<?php
echo "SN:<font color=\"$ttlSrlClr\">$ttlSerial</font>";
?>
</td>
<td width="45%">
<TABLE  border="1" width="100%" cellpadding="1" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF" bgcolor="#FFFFFF">
<?
//echo "<a href=\"../../fault/alarmList/alarmList_index.php\" >{$alarmNumArr[$i][number]}</a>";
echo "<tr align=\"center\">";
for($i=1;$i<=sizeof($alarmNumArr);$i++){
	echo "\n <td width=\"15%\" bgcolor=\"{$alarmNumArr[$i][bgcolor]}\" title=\"{$alarmNumArr[$i][title]}\">";
	echo "<b>{$alarmNumArr[$i][number]}</b>";
	echo "</td>";
}
echo "</tr>";
?>

</table>
</td>
</tr>
</table>
</div>
</body>
</html>
