<?php
require("../sub_inc/commfunc.php");
$helpId = "6.2.1.3"; 
$DEBUG = 0;

if($DEBUG) echo "<br>正在调试中！！";
//==========================================================
//变量定义
//==========================================================
$pubDb			= 'OMC_PUB';
$numberPerPage	= 100;		//每页纪录数
$paramTable		='OBJ_222.param_99';

$nGetComm	= 0;
$nSetComm	= 3;

$sysId		='222_99_99';

$linkAttConfArr=array(
	array('Linkset no.',	'00.0-00.7'),
	array('SLC no.',		'01.0-01.7'),
	array('CPC IP.',		'02.0-05.7')
);

//==========================================================
//输入变量
//==========================================================
if($DEBUG) echo "<br>setInstanceNo=$setInstanceNo";
if($DEBUG) echo "<BR>setObjIdStr  =$setObjIdStr";
//==========================================================
//数据处理
//==========================================================
//处理get/set命令
if($_SERVER['REQUEST_METHOD'] == "POST"){	

}

//==========================================================
//输出并显示数据
//==========================================================
$objIdStr	='2.5.1';
if($DEBUG) echo "<BR>";
?>

<body topmargin="0" leftmargin="12">
<?php
echo "<form method=\"POST\" name=\"setForm\" action=\"$PHP_SELF\">";
echo "<table border=\"0\" width=\"100%\">";
echo "<tr>";
echo "<td width=\"50%\">";
echo "Configuration > <a href=\"../overview/overview.php?scroll_y=1000\">Network</a> > <a href=\"#\">Link overview</a>";
echo "</td>";
echo "<td width=\"50%\" align=\"right\" title=\"Help\">";
//showHelp($helpId);
echo "</td>";
echo "<td>";
echo "<p align=\"right\"><a href=\"../../element/overview/overview.php?scroll_y=1000\"><img align=absBottom border=0 src=\"../../images/left.gif\" width=\"14\" height=\"14\">$strBack</a>";
echo "</td></tr>";
echo "</table>";
?>
<br>
<table border="1" width="100%" cellpadding="1" cellspacing="0" bordercolor="#666666" bordercolordark="#FFFFFF">
<?php 
echo "<tr bgcolor=\"#E6E6E6\">";
echo "<td width=\"10%\">No.</td>";
echo "<td width=\"30%\">Linkset no.</td>";
echo "<td width=\"30%\">SLC no.</td>";
echo "<td width=\"30%\">CPC IP</td>";
echo "</tr>";

$levelWhere = getLevelWhere($objIdStr);
if($DEBUG) echo "<BR>levelWhere=$levelWhere";

$getSql="SELECT initValue,instanceNo  FROM $paramTable 
			WHERE $levelWhere
		";
if($DEBUG) echo "<BR>getSql=$getSql";
$result	=mysqli_query($pubConn,$getSql);
echo mysqli_error($pubConn);

while($rows=mysqli_fetch_array($result))
{
	$instanceNo=$rows[1];
	$value=$rows[0];
	$linksetNo	=getBitValue($value,$linkAttConfArr[0][1]);
	$linksetNo	=hexdec($linksetNo);
	$slcNo		=getBitValue($value,$linkAttConfArr[1][1]);
	$slcNo		=hexdec($slcNo);
	if($linksetNo > '127' || $slcNo > '15'){
		continue;
	}
	$cpcIpHex		=getBitValue($value,$linkAttConfArr[2][1]);
	$cpcIp = '';
	for($i=0; $i< 4; $i++)
	{
		$tmp = substr($cpcIpHex, $i*2, 2);
		$tmp = hexdec($tmp);
		$cpcIp .= "$tmp.";
	}
	$cpcIp = rtrim($cpcIp,'.');

	if($objIdStr == $setObjIdStr && $instanceNo == $setInstanceNo){
		echo "<tr bgcolor=\"#CCFFCC\">";
	}else{
		echo "<tr onMouseOver=\"this.bgColor='#D2F0FF'\" onMouseOut=\"this.bgColor='#ffffff'\">";
	}
	echo "<td>$instanceNo</td>";
	echo "<td>$linksetNo</td>";
	echo "<td>$slcNo</td>";
	echo "<td>$cpcIp</td>";
	echo "</tr>";
}
?>
</table>
</form>
&nbsp;
</body>
</html>
