<?php 
/*********************************************************      
PCR  configuration.

*********************************************************/
require("../sub_inc/operwebfunc.inc");
$helpId = "1.1.1";
$DEBUG = 0;

//==========================================================
//变量定义
//==========================================================

$pubDb	 = 'OMC_PUB';
$backurl_un = "$PHP_SELF?trunkgp=$trunkgp&infoNo=$infoNo&linkset=$linkset";
$backurl = urlencode($backurl_un);


{//设备类型 与设备编号
	getElementInfo($infoNo,$elementInfoArr);
	$this_sysNo = $TypeNo = $elementInfoArr[sysNo];
	$this_subSysNo = $elementInfoArr[subSysNo];
	$TypeIn = $elementInfoArr[typeValue];
	$webname = $elementInfoArr[webName];
	$Spname = $elementInfoArr[eleName];

	$sysId = "130_$this_sysNo" . "_$this_subSysNo";
	$objDB = 'OBJ_130';
	$paramTab = 'param_'.$this_sysNo;	
}

$channelUrl = "pcrChannel.php?linkset=$linkset&trunkgp=$trunkgp&infoNo=$infoNo&sysNo=$this_sysNo&subSysNo=$this_subSysNo";

$NetIdConfArr=array('International','International-S','National','National-S');

?>

<body topmargin="0" leftmargin="12">

<?php

$sccp_sysId = "223_11_".$TypeNo;
$iptrans_sysId = "221_0_".$TypeNo;

$oidsysarr0=array(
	array('oid'=>'2.1',		'sysid'=> $sysId,		'selectsysid'=>'-1'),											
	array('oid'=>'2.2',		'sysid'=> $sysId,		'selectsysid'=>'-1'),
	array('oid'=>'2.3.1',		'sysid'=> $sysId,		'selectsysid'=>'-1')
);

$oidsysarr=array(
	array('oid'=>'2.2',			'sysid'=>'222_99_99',	'selectsysid'=>'-1'),
	array('oid'=>'2.4.1',		'sysid'=>'222_99_99',	'selectsysid'=>'-1'),
	array('oid'=>'2.3',			'sysid'=>'222_99_99',	'selectsysid'=>'-1'),	//获得wxc2 dpc
);

$SaveArr=array(
	array('oidstr'=>'3.1',	'setvalue'=>'A5'	,'sysid'=> $sysId,		'selectsysid'=>'-1')
);

$clockSourceArr = array(
	array('value' => 0,		'name' => 'Lock E1-0'),
	array('value' => 1,		'name' => 'Lock E1-1'),
	array('value' => 2,		'name' => 'Lock E1-2'),
	array('value' => 3,		'name' => 'Lock E1-3'),
	array('value' => 4,		'name' => 'Lock E1-4'),
	array('value' => 5,		'name' => 'Lock E1-5'),
	array('value' => 6,		'name' => 'Lock E1-6'),
	array('value' => 7,		'name' => 'Lock E1-7'),
	
	array('value' => 8,		'name' => 'Internal Clock')
);
$enableArr = array(
	array('value' => 0,		'name' => 'N'),
	array('value' => 1,		'name' => 'Y')
);

$CRC4Arr = array(
	array('value' => 0,		'name' => 'OFF'),
	array('value' => 1,		'name' => 'ON')
);

$NTLTArr = array(
	array('value' => 0,		'name' => 'LT'),
	array('value' => 1,		'name' => 'NT')
);
$E1T1Arr = array(
	array('value' => 0,		'name' => 'E1'),
	array('value' => 1,		'name' => 'T1')
);
$portTypeArr = array(
	array('value' => 0,		'name' => 'SS7'),
	array('value' => 1,		'name' => 'ANSI SS7'),
	array('value' => 2,		'name' => 'ISDN'),
	array('value' => 3,		'name' => 'China No.1'),
	array('value' => 4,		'name' => 'Sri Lanka R2'),
	array('value' => 5,		'name' => 'QSIG'),
	array('value' => 6,		'name' => 'ANSI ISDN')
);

$backoffArr = array(
	array('value' => 0,		'name' => 'OFF'),
	array('value' => 1,		'name' => 'ON')
);

$circuitSlcArr = array(
	2 => 'Clockwise',
	3 => 'Counterclockwise'
);
$commandArr= array(
	90 => 'Reset',
	165 => 'Initialization',
	238 => 'No operation'
);
$groupArr = array(
	0 => '0',
	1 => '1',
	2 => '2',
	3 => '3'
);
if($_SERVER['REQUEST_METHOD'] == "POST")
{
	if(isset($clockSource_save)||isset($setSys))
	{
		$tmp = $clockSource;
		$tmp = dechex($tmp);
		$tmp = omc_keep_length($tmp,'0',2);
		$oidstr = "2.2.2";
		$objWhereStr = getLevelWhere($oidstr);
		$updSql = "update $paramTab set initValue='$tmp' where $objWhereStr and subSysNo='$this_subSysNo' ";
		mysqli_query($pubConn,$updSql);
		echo mysqli_error($pubConn);		
	}
	if(isset($command_save)||isset($setSys))
	{
		$tmp = $command;
		$tmp = dechex($tmp);
		$tmp = omc_keep_length($tmp,'0',2);
		$oidstr = "2.3.1";
		$objWhereStr = getLevelWhere($oidstr);
		$updSql = "update $paramTab set initValue='$tmp' where $objWhereStr and subSysNo='$this_subSysNo' ";
		mysqli_query($pubConn,$updSql);
		echo mysqli_error($pubConn);		
	}
	{
		for($i=0;$i<8;$i++)
		{
			$setname=${"enable_save_$i"};
			if(isset($setname))
			{
				for($j=7;$j>=0;$j--)
				{
					$bitValue=${"enable_$j"};
					if($j==7)
						$setvalue = $bitValue;
					else
						$setValue .= $bitValue;
				}
				$setValue = bindec($setValue);
				$setValue = strtoupper(dechex($setValue));
				$setValue = omc_keep_length($setValue,'0',2);
				$oidstr = "2.2.1";
				$objWhereStr = getLevelWhere($oidstr);
				$updSql = "update $paramTab set initValue='$setValue' where $objWhereStr and subSysNo='$this_subSysNo' ";
				mysqli_query($pubConn,$updSql);
				echo mysqli_error($pubConn);	
			}
		}
		for($i=4;$i<8;$i++)
		{
			$setname=${"CRC4_save_$i"};
			if(isset($setname))
			{
				for($j=7;$j>3;$j--)
				{
					$bitValue=${"CRC4_$j"};
					$setValue .= $bitValue;
				}
				$setValue .= '0000';
				$setValue = bindec($setValue);
				$setValue = strtoupper(dechex($setValue));
				$setValue = omc_keep_length($setValue,'0',2);
				
				$oidstr = "2.2.3";
				$objWhereStr = getLevelWhere($oidstr);
				$updSql = "update $paramTab set initValue='$setValue' where $objWhereStr and subSysNo='$this_subSysNo' ";
				mysqli_query($pubConn,$updSql);
				echo mysqli_error($pubConn);	
			}
		}
		for($i=0;$i<8;$i++)
		{
			$setname=${"NTLT_save_$i"};
			if(isset($setname))
			{
				for($j=7;$j>=0;$j--)
				{
					$bitValue=${"NTLT_$j"};
					if($j==7)
						$setvalue = $bitValue;
					else
						$setValue .= $bitValue;
				}
				$setValue = bindec($setValue);
				$setValue = strtoupper(dechex($setValue));
				$setValue = omc_keep_length($setValue,'0',2);
				$oidstr = "2.1.1";
				$objWhereStr = getLevelWhere($oidstr);
				$updSql = "update $paramTab set initValue='$setValue' where $objWhereStr and subSysNo='$this_subSysNo' ";
				mysqli_query($pubConn,$updSql);
				echo mysqli_error($pubConn);	
			}
		}
		for($i=0;$i<8;$i++)//E1/T1
		{
			$setname=${"E1T1_save_$i"};
			if(isset($setname))
			{
				for($j=7;$j>=0;$j--)
				{
					$bitValue=${"E1T1_$j"};
					if($j==7)
						$setvalue = $bitValue;
					else
						$setValue .= $bitValue;
				}
				$setValue = bindec($setValue);
				$setValue = strtoupper(dechex($setValue));
				$setValue = omc_keep_length($setValue,'0',2);
				$oidstr = "2.1.5";
				$objWhereStr = getLevelWhere($oidstr);
				$updSql = "update $paramTab set initValue='$setValue' where $objWhereStr and subSysNo='$this_subSysNo' ";
				mysqli_query($pubConn,$updSql);
				echo mysqli_error($pubConn);	
			}
		}
		for($i=0;$i<8;$i++)
		{		
			$setname1=${"portType_save_$i"};
			$setname2=${"backoff_save_$i"};
			$setname3=${"circuitSlc_save_$i"};
			$setname4=${"group_save_$i"};		
			if(isset($setname1)||isset($setname2)||isset($setname3)||isset($setname4))
			{	
				$oidstr = "2.1.2";
				$objWhereStr = getLevelWhere($oidstr);
				$selSql = "select initValue from $paramTab where $objWhereStr and subSysNo='$this_subSysNo' and instanceNo='$i' ";
				$result = mysqli_query($pubConn,$selSql);
				$row = mysqli_fetch_array($result);
				$setValue = $row[initValue];
				
				$tmp1 = ${"circuitSlc_$i"};
				$tmp2 = ${"backoff_$i"};
				$tmp3 = ${"portType_$i"};
				$tmp4 = ${"group_$i"};
				$tmp1 = omc_keep_length(decbin($tmp1),'0',2);
				$tmp2 = omc_keep_length(decbin($tmp2),'0',1);
				$tmp3 = omc_keep_length(decbin($tmp3),'0',3);
				$tmp4 = omc_keep_length(decbin($tmp4),'0',2);			
				$setValue = $tmp4.$tmp3.$tmp2.$tmp1;
				$setValue = bindec($setValue);
				$setValue = strtoupper(dechex($setValue));
				$setValue = omc_keep_length($setValue,'0',2);
				
//				$setValue = setBitValue($setBitValue,'00.0-00.1',$tmp1);
//				$setValue = setBitValue($setBitValue,'00.2-00.2',$tmp2);
//				$setValue = setBitValue($setBitValue,'00.3-00.5',$tmp3);
//				$setValue = setBitValue($setBitValue,'00.6-00.7',$tmp4);
				$updSql = "update $paramTab set initValue='$setValue' where $objWhereStr and subSysNo='$this_subSysNo' and instanceNo='$i' ";
				mysqli_query($pubConn,$updSql);
				echo mysqli_error($pubConn);	
			}
		}
	}
	if(isset($setSys) || isset($getSys))
	{
		if(isset($setSys))
		{
			echo "<br>Setting parameters<br>";
			SetParam($oidsysarr0);				
			SetParam($oidsysarr);	
			
			//SaveParam($SaveArr);
		}
		else
		{ 
			echo "<br>Getting parameters<br>";
			GetParam($oidsysarr0);
			GetParam($oidsysarr);
		}
	}
	echo "<script LANGUAGE=\"JavaScript\">";
	echo "\n window.location.href=\"$backurl_un\";";
	echo "\n </script>";
	exit();
}

if($setSys || $getSys  || $undoSet)
{
	echo "<br><br><h4><font color=\"#0000ff\">Finished!</font></h4>";
	if($DEBUG) exit();
	echo "<script LANGUAGE=\"JavaScript\">";
	echo " location='$PHP_SELF?cause_edit=$cause_edit&trunkgp=$trunkgp&infoNo=$infoNo&linkset=$linkset';";
	echo "</script>";
	exit();
}

{
	echo "<form method=\"POST\" name=\"setForm\" action=\"$PHP_SELF?linkset=$linkset&trunkgp=$trunkgp\">";
	echo "<table border=\"0\" width=\"100%\">";
	echo "<tr>";
	echo "<td width=\"50%\">";
	//echo "$strConfiguration > $strNetwork > PCR";
	echo "Configuration > <a href=\"../overview/overview.php\">Network</a> > <a href=\"#\">PCR</a>";
	echo "</td>";
	echo "<td width=\"50%\" align=\"right\" title=\"Help\">";
	showHelp($helpId);
	echo "</td>";
	echo "</tr>";
	echo "</table>";
	echo "<br>";
	
	echo "</table>";
	{
		echo "<table width=\"100%\">";
		echo "<tr>";
			echo "<td width=\"70%\">";
				echo "<b></b>$Spname";
			echo "</td>";
			echo "<td width=\"20%\" align=\"right\">";
					echo "<input type=\"submit\" title=\"$strTitleGet\" name=\"getSys\" value=\"$strGet\" class=\"button\" style=\"cursor:pointer; left: 1; top: 2; width: 60; height: 25; position: relative\">";
					echo "&nbsp;&nbsp;&nbsp;";
					echo "<input type=\"submit\" title=\"$strTitleSet\" name=\"setSys\" value=\"$strSet\" class=\"button\" style=\"cursor:pointer; left: 1; top: 2; width: 60; height: 25; position: relative\">";
				echo "</td>";
			echo "<td width=\"10%\">";
				echo "<p align=\"right\"><a href=\"javascript:backpage(0,'../overview/overview.php')\"><img align=absBottom border=0 src=\"../../images/left.gif\" width=\"14\" height=\"14\">$strBack</a>";
			echo "</td>";
		echo "</tr>";
		echo "<input type=\"hidden\" name=\"linkset\" value=\"$linkset\">";
		echo "<input type=\"hidden\" name=\"trunkgp\" value=\"$trunkgp\">";
		echo "<input type=\"hidden\" name=\"infoNo\" value=\"$infoNo\">";
		echo "</table>";
		echo "<br>";
	}
}
echo "<table border=\"1\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" bordercolor=\"#666666\" bordercolordark=\"#FFFFFF\">";

{// Signaling/Traffic
	{//DPC
	$DPC_sysId = '222_99_99';
	
	$DPC_sysIdArr	= explode('_',$DPC_sysId);
	$DPC_sysTypeNo	= $DPC_sysIdArr[0];
	$DPC_sysNo		= $DPC_sysIdArr[1];
	$DPC_subSysNo	= $DPC_sysIdArr[2];
	
	$DPC_oidstr = '2.4.1';
	$DPC_objWhereStr= '';	
	$DPC_objWhereStr =getLevelWhere($DPC_oidstr);
	$DPC_objDb		= 'OBJ_'.$DPC_sysTypeNo;
	$DPC_paramTable = 'param_'.$DPC_sysNo;		
	
	$DPC_paramSql = " SELECT initValue,readValue,instanceNo FROM $DPC_paramTable  
				WHERE $DPC_objWhereStr AND instanceNo ='$linkset' 
				";
	if($DEBUG) echo "$DPC_paramSql<br>";
	$DPC_Result = mysqli_query($pubConn,$DPC_paramSql);
	$DPC_Row	= mysqli_fetch_array($DPC_Result);
	$linkset_DPC		= hexdec(getBitValue($DPC_Row[initValue],'0.0-2.7'));
	$NetID 		= bindec(getBitValue($DPC_Row[initValue],'3.0-3.1'));		
	}

	{//WXC2 OPC ************************
	$oidstr = '2.2';
	$aas_link_Db = 'OBJ_222';	
	$aas_link_Table  = 'param_99';
	
	$subSysNo = 99;
	$objWhereStr= '';
	$objWhereStr =getLevelWhere($oidstr);
	$paramSql = " SELECT initValue,readValue,instanceNo FROM $aas_link_Table  
				WHERE $objWhereStr AND subSysNo = '$subSysNo'
				";
	if($DEBUG) echo "$paramSql<br>";			
	$aas_Result = mysqli_query($pubConn,$paramSql);
	$aas_Row	= mysqli_fetch_array($aas_Result);
								
	$NIbit	= getBitValue($aas_Row[initValue],"0.$NetID");
	$tmp	= $NetID+1+$NIbit*4;
	$oidstr = '2.3.'.$tmp;
	$objWhereStr= '';
	$objWhereStr =getLevelWhere($oidstr);
	$updSql = "SELECT initValue FROM $aas_link_Table
			   WHERE $objWhereStr AND instanceNo = '0' AND subSysNo = '$subSysNo'
							";
	$Result	= mysqli_query($pubConn,$updSql);
	$Row	= mysqli_fetch_array($Result);
	$WXC2PC = hexdec($Row[initValue]);
	}

	echo "<tr >";
	echo "<td width=\"16%\" bgcolor=\"#E6E6E6\" >Signaling point code</td>";
	echo "<td colspan=\"10\">$linkset_DPC&nbsp;</td>";
	echo "<input type=\"hidden\" name=\"DPC\" value=\"$linkset_DPC\">";
	echo "</tr >";
		

	echo "<tr >";
	echo "<td bgcolor=\"#E6E6E6\" >NetWork indicator</td>";
	echo "<td colspan=\"10\">$NetIdConfArr[$NetID]";
	echo "<input type=\"hidden\" name=\"NetID\" value=\"$NetID\">";
	echo "</td>";
	echo "</tr >";
/*	
	echo "<tr >";
	echo "<td bgcolor=\"#E6E6E6\" >WXC2 Point Code</td>";
	echo "<td colspan=\"10\">$WXC2PC<input type=\"hidden\" name=\"WXC2PC\" value=\"$WXC2PC\">";
	echo "</td>";	
	echo "</tr >";
*/
}

$otherWhereStr = "and subSysNo=$this_subSysNo";

{//clock source
	
	{//show clockSource
		echo "<tr>";
			echo "<td bgcolor=\"#E6E6E6\">Clock source</td>";
			echo "<td colspan=\"10\">";
			$oidStr = "2.2.2";
			$instanceNo = 0;
			$doingOtherUlr="";
			showParameter($sysId,$oidStr,1,1,$instanceNo,$doingOtherUlr,$otherWhereStr);
			echo"</td>"; 
		echo "</tr>";
	}
	
   {//show COMMAND
		echo "<tr>";
			echo "<td bgcolor=\"#E6E6E6\">Command</td>";
			echo "<td colspan=\"10\">";
			$oidStr = "2.3.1";
			$instanceNo = 0;
			$doingOtherUlr="";
			showParameter($sysId,$oidStr,1,1,$instanceNo,$doingOtherUlr,$otherWhereStr);
			echo"</td>"; 
		echo "</tr>";
	}
}

{
	$oidstr = "2.2.1";
	$objWhereStr = getLevelWhere($oidstr);	
	
	$selSql = "select initValue from $paramTab where $objWhereStr and subSysNo='$this_subSysNo' ";
	$result = mysqli_query($pubConn,$selSql);
	$row = mysqli_fetch_array($result);	
	$enableValue = $row[initValue]; 
	
	$oidstr = "2.2.3";
	$objWhereStr = getLevelWhere($oidstr);	
	
	$selSql = "select initValue from $paramTab where $objWhereStr and subSysNo='$this_subSysNo' ";
	$result = mysqli_query($pubConn,$selSql);
	$row = mysqli_fetch_array($result);	
	$CRC4Value = $row[initValue]; 
	
	$oidstr = "2.1.1";
	$objWhereStr = getLevelWhere($oidstr);	
	
	$selSql = "select initValue from $paramTab where $objWhereStr and subSysNo='$this_subSysNo' ";
	$result = mysqli_query($pubConn,$selSql);
	$row = mysqli_fetch_array($result);	
	$NTLTValue = $row[initValue]; 
	
	
		echo "<tr bgcolor=\"#E6E6E6\">";
			echo "<td rowspan=\"10\" bgcolor=\"#E6E6E6\">E1</td>";
			echo "<td>E1#</td>";
			echo "<td>Enable</td>";
			echo "<td>CRC4</td>";
			echo "<td>Port type</td>";
			echo "<td>Back off</td>";
			echo "<td>Circuit select</td>";
			echo "<td>NT/LT</td>";
			echo "<td>Group</td>";
			echo "<td>Channel</td>";
		echo "</tr>";
		for($i=0; $i<8; $i++)
		{
			$oidstr = "2.1.2";
			$objWhereStr = getLevelWhere($oidstr);	
			
			$selSql = "select initValue from $paramTab where $objWhereStr and subSysNo='$this_subSysNo' and instanceNo='$i'";
			$result = mysqli_query($pubConn,$selSql);
			$row = mysqli_fetch_array($result);	
			$CircuitValue = $row[initValue];
			$portType= bindec(getBitValue($CircuitValue,'00.3-00.5'));
			$backoff = bindec(getBitValue($CircuitValue,'00.2-00.2'));
			$circuitSlc = bindec(getBitValue($CircuitValue,'00.0-00.1'));
			$group = bindec(getBitValue($CircuitValue,'00.6-00.7'));
			echo "<tr>";		
				echo "<td>$i</td>";
				{//Enable
				echo "<td>";
                    $oidStr = "2.2.1";
        			$instanceNo = 0;
        			$doingOtherUlr="";
        			$order = $i+1;
        			showParameter($sysId,$oidStr,$order,1,$instanceNo,$doingOtherUlr,$otherWhereStr);

				echo "</td>";
				}
				
				{//CRC4
				echo "<td>";
					$bitStr = "{0.$i-0.$i}";
					$CRC4[$i]=bindec(getBitValue($CRC4Value,$bitStr));
					if($i < 4)//后四个可以设置，前四个与8ke1板对应(默认为off => 0)
					{
						if($CRC4[$i] == 1)
						{
							$CRC4Value = setBitValue($CRC4Value,$bitStr,'0');
							$oidstr = "2.2.3";
							$objWhereStr = getLevelWhere($oidstr);
							$updSql = "update $paramTab set initValue='$CRC4Value' where $objWhereStr and subSysNo='$this_subSysNo' ";
							mysqli_query($pubConn,$updSql);
							echo mysqli_error($pubConn);	
							if(0)echo "<br>$updSql";
						}
						echo "{$CRC4Arr[0][name]}";
					}
					else
					{
						$oidStr = "2.2.3";
            			$instanceNo = 0;
            			$doingOtherUlr="";
            			$order = $i+1;
            			showParameter($sysId,$oidStr,$order,1,$instanceNo,$doingOtherUlr,$otherWhereStr);
					}
				echo "</td>";
				}
				
				{//port type
				echo "<td>";
				if(isset(${"portType_edit_$i"}))
				{
					echo "<select size=\"1\" value=\"$portType\" name=\"portType_$i\">";
					for($j=0; $j<sizeof($portTypeArr); $j++)
					{
						if($i>=0 && $i< 4)
						{
							if($j > 1)
								continue;
						}
						else
						{
							if($j < 2)
								continue;
						}
						echo "<option value=\"{$portTypeArr[$j][value]}\" ";
						if($portTypeArr[$j][value] == $portType)
							echo "selected";
						echo ">{$portTypeArr[$j][name]}</option>";
					}		
					$portType_save="portType_save_$i";
					echo "</select>";
					echo "<input type=\"submit\" name=\"$portType_save\" value=\"save\" onmouseover=\"this.className='style4'\" 	onmouseout=\"this.className='style3'\" class=\"style3\">";
				}
				else
				{
					echo "<input type=\"hidden\" name=\"portType_$i\" value=\"$portType\">";
					echo "<a href=\"$PHP_SELF?linkset=$linkset&trunkgp=$trunkgp&infoNo=$infoNo&portType_edit_$i=1\">{$portTypeArr[$portType][name]}</a>";		
				}
				echo"</td>"; 
				}
				
				{//back off
				echo "<td>";
				if($i < 4)//前四个与TG中的Backoff相反，设为on
				{
					echo "<input type=\"hidden\" name=\"backoff_$i\" value=\"1\">";
					echo "{$backoffArr[1][name]}";
					if($backoff!=1)
					{
						$oidstr = "2.1.2";
						$objWhereStr = getLevelWhere($oidstr);
						$selSql = "select initValue from $paramTab where $objWhereStr and subSysNo='$this_subSysNo' and instanceNo='$i' ";
						$result = mysqli_query($pubConn,$selSql);
						$row = mysqli_fetch_array($result);
						$setValue = $row[initValue];
						$setValue = setBitValue($setValue,'00.2-00.2','1');
						$updSql = "update $paramTab set initValue='$setValue' where $objWhereStr and subSysNo='$this_subSysNo' and instanceNo='$i' ";
						mysqli_query($pubConn,$updSql);
						echo mysqli_error($pubConn);	
					}
				}
				else
				{
				    $oidStr = "2.1.2";
        			$instanceNo = $i;
        			$doingOtherUlr="";
        			$order = 2;
        			showParameter($sysId,$oidStr,$order,1,$instanceNo,$doingOtherUlr,$otherWhereStr);
				}
				echo"</td>"; 
				}
				
				{//circuit selection
				echo "<td>";
				if($i < 4)//前四个与TG中的circuit selection相反，设为3
				{
					echo "<input type=\"hidden\" name=\"circuitSlc_$i\" value=\"3\">";
					echo "{$circuitSlcArr[3]}";
					if($circuitSlc != 3)
					{
						$oidstr = "2.1.2";
						$objWhereStr = getLevelWhere($oidstr);
						$selSql = "select initValue from $paramTab where $objWhereStr and subSysNo='$this_subSysNo' and instanceNo='$i' ";
						$result = mysqli_query($pubConn,$selSql);
						$row = mysqli_fetch_array($result);
						$setValue = $row[initValue];
						$setValue = setBitValue($setValue,'00.0-00.1','11');
						$updSql = "update $paramTab set initValue='$setValue' where $objWhereStr and subSysNo='$this_subSysNo' and instanceNo='$i' ";
						mysqli_query($pubConn,$updSql);
						echo mysqli_error($pubConn);	
					}
				}
				else
				{
				    $oidStr = "2.1.2";
        			$instanceNo = $i;
        			$doingOtherUlr="";
        			$order = 1;
        			showParameter($sysId,$oidStr,$order,1,$instanceNo,$doingOtherUlr,$otherWhereStr);
				}
				echo"</td>"; 
				}
				
				{//NT/LT
				echo "<td>";
					$bitStr = "{0.$i-0.$i}";
					$NTLT[$i]=bindec(getBitValue($NTLTValue,$bitStr));
					if($i < 4)
					{
						echo "<input type=\"hidden\" name=\"NTLT_$i\" value=\"{$NTLT[$i]}\">";
						echo "--";
					}
					else
					{
    					$oidStr = "2.1.1";
            			$instanceNo = 0;
            			$doingOtherUlr="";
            			$order = $i+1;
            			showParameter($sysId,$oidStr,$order,1,$instanceNo,$doingOtherUlr,$otherWhereStr);
					}
				echo "</td>";
				}
				{//Group
				echo "<td>";
				    $oidStr = "2.1.2";
        			$instanceNo = $i;
        			$doingOtherUlr="";
        			$order = 4;
        			showParameter($sysId,$oidStr,$order,1,$instanceNo,$doingOtherUlr,$otherWhereStr);
				echo"</td>"; 
				}
				echo "<td><a href=\"$channelUrl&E1no=$i\">Edit</a></td>";		
			echo "</tr>";
		}
}
echo "</table>";

echo "<div>";
	echo "<a href=\"./loaddata.php?infoNo=$infoNo&linkset=$linkset&trunkgp=$trunkgp&flag=$flag\">Link to PCR</a>";
	echo "</div>";
echo "<br>";
?>
</form>
</body>
</html>
