1) $oids=substr($oids,0,strlen($oids)-1); return $oids; } function getLevel($objIdStr) { $levelArr=explode('.',$objIdStr); for($j=0;$jlevelArr[$j]={$levelArr[$j]}"; if($j == 0){ $levelWhere ="level_$levelNo='${"level_$levelNo"}'"; }else{ $levelWhere .=" AND level_$levelNo='${"level_$levelNo"}'"; } } $levelNo+=1; if($levelNo<=10) $levelWhere.=" AND level_$levelNo=0 "; return($levelWhere); } function getLinkInfo($table,$titleoid,$statusoid,$instance) { global $OMC_server,$mtp3_systypeno; $objDbConn = mysqli_connect($OMC_server[0]['host'],$OMC_server[0]['user'],$OMC_server[0]['password'], "OBJ_".$mtp3_systypeno); $instanceNo=omc_keep_length($instance,"0",4); $tmpwhere=getLevel($titleoid); $sql="select * from $table where $tmpwhere and instanceNo = '$instanceNo' "; //echo "sql=$sql
"; $res=@mysqli_query($objDbConn,$sql); $num=mysqli_num_rows($res); if($num == 0) $linkInfo[Title]=""; else { $row=@mysqli_fetch_array($res); $linkInfo[Title]=$row[initValue]; } $tmpwhere=getLevel($statusoid); $sql="select * from $table where $tmpwhere and instanceNo = '$instanceNo' "; $res=@mysqli_query($objDbConn,$sql); $num=mysqli_num_rows($res); if($num == 0) $linkInfo[Status]=0; else { $row=@mysqli_fetch_array($res); $linkInfo[Status]=$row[initValue]+0; } return $linkInfo; } function getStatusByHeartbeat() { global $mss_platno,$plat_systypeno,$OMC_server; $pubConn = mysqli_connect($OMC_server[0]['host'],$OMC_server[0]['user'],$OMC_server[0]['password'], "OMC_PUB"); $sql="select * from OMC_PUB.sysStat where sysTypeNo=$plat_systypeno and sysNo=$mss_platno order by updateTime desc "; $res=@mysqli_query($pubConn,$sql); $num=mysqli_num_rows($res); if($num == 0) return $StatusSet; $row=@mysqli_fetch_array($res); $baseStat=$row[detailStat]; $compStat=substr($baseStat,38); $compStatLen=strlen($compStat)-1; //echo "$compStat
"; $index=0; $i=0; while($i<$compStatLen) { $tmp=substr($compStat,$i,4); $component[$index][ID]=$tmp+0; $i+=4; $tmp=substr($compStat,$i,4); $component[$index][Length]=hexdec($tmp); $i+=4; $component[$index][Content]=substr($compStat,$i,$component[$index][Length]*2); $i+=$component[$index][Length]*2; $index++; } if($component[1][Length] == 0) return $StatusSet; $mtp3_hb=$component[1][Content]; $pos=0; $link_hb=substr($mtp3_hb,8,256*2); $linkset_hb=substr($mtp3_hb,520,128*2); for($i=0;$i<256;$i++) { $tmpi=hexdec(substr($link_hb,$i*2,2)); $tmpb=omc_keep_length(decbin($tmpi),"0",8); $tmpb=strrev($tmpb); for($j=0;$j<4;$j++) { $tmp2bit=strrev(substr($tmpb,$j*2,2)); $StatusSet[LinkStatus][$i*4+$j]=bindec($tmp2bit); } } for($i=0;$i<128;$i++) { $tmpi=hexdec(substr($linkset_hb,$i*2,2)); $tmpb=omc_keep_length(decbin($tmpi),"0",8); $tmpb=strrev($tmpb); for($j=0;$j<4;$j++) { $tmp2bit=strrev(substr($tmpb,$j*2,2)); $tt=$i*4+$j; $yy=bindec($tmp2bit); $StatusSet[LinkSetStatus][$i*4+$j]=bindec($tmp2bit); } } return $StatusSet; } ?> > /tmp/test.txt"); if($num > 0) $response.="layer".$field_sep."blank_row_id".$field_sep."hide".$line_sep; else $response.="layer".$field_sep."blank_row_id".$field_sep."show".$line_sep; for($index=0;$index<$maxRowPerPage;$index++) { //system("echo 'linksetCount=$linksetCount' >> /tmp/test.txt"); if($index < $linksetCount) $response.="layer".$field_sep."row_id_{$index}".$field_sep."show".$line_sep; else $response.="layer".$field_sep."row_id_{$index}".$field_sep."hide".$line_sep; } $linkset_id_cond=" and ("; for($index=0;$index < $num;$index++) { $row=@mysqli_fetch_array($res); $linkset[$index][Instance]=$row[instanceNo]+0; $linkset_id_cond.=" initValue={$linkset[$index][Instance]} "; if($index != ($num-1)) $linkset_id_cond.=" or "; $linkset[$index][LinkIndex]=0; $index_mirror[$linkset[$index][Instance]][Index]=$index; } $linkset_id_cond.=") "; if($num == 0) $linkset_id_cond=""; $statusSet=getStatusByHeartbeat(); //get linkset status and title $tmpwhere=getLevel($linkset_title_oid); $from=$current_page_no * $maxRowPerPage; $sql="select * from $mtp3_param_table where $tmpwhere order by instanceNo LIMIT $from, $maxRowPerPage "; $res=@mysqli_query($objDbConn,$sql); $num=mysqli_num_rows($res); for($index=0;$index < $num;$index++) { $row=@mysqli_fetch_array($res); $instance=$row[instanceNo]+0; $pos=$index_mirror[$instance][Index]; $linkset[$index][Title]=$row[initValue]; } $tmpwhere=getLevel($linkset_status_oid); $from=$current_page_no * $maxRowPerPage; $sql="select * from $mtp3_param_table where $tmpwhere order by instanceNo LIMIT $from, $maxRowPerPage "; $res=@mysqli_query($objDbConn,$sql); $num=mysqli_num_rows($res); for($index=0;$index < $num;$index++) { $row=@mysqli_fetch_array($res); $instance=$row[instanceNo]+0; $pos=$index_mirror[$instance][Index]; //$linkset[$index][Status]=$row[initValue]+0; $linkset[$index][Status]=$statusSet[LinkSetStatus][$instance]+0; } $status_value=array(0=>"N",1=>"Y",2=>"I",3=>"--"); $status_color=array(0=>"#ff0000",1=>"#0000ff",2=>"#cecece",3=>"#000000"); for($index=0;$index<$linksetCount;$index++) { if(strlen($linkset[$index][Title])>0) $value=$linkset[$index][Instance]."[".$linkset[$index][Title]."]"; else $value=$linkset[$index][Instance]; $response.="obj".$field_sep."ls_title_id_{$index}".$field_sep.$value.$field_sep."#000000".$line_sep; $value=$linkset[$index][Status]+0; $response.="obj".$field_sep."ls_status_id_{$index}".$field_sep.$status_value[$value].$field_sep.$status_color[$value].$line_sep; } //get link status //echo "AAA=$link_lsID_oid
"; $tmpwhere=getLevel($link_lsID_oid); $from=$current_page_no * $maxRowPerPage; $sql="select * from $mtp3_param_table where $tmpwhere $linkset_id_cond order by instanceNo asc "; //echo "SSSSS=$sql
"; $res=@mysqli_query($objDbConn,$sql); $num=mysqli_num_rows($res); for($index=0;$index<$num;$index++) { $row=@mysqli_fetch_array($res); $ls_instance=$row[initValue]+0; $lk_instance=$row[instanceNo]+0; $ls_index=$index_mirror[$ls_instance][Index]; $lk_index=$linkset[$ls_index][LinkIndex]; $lkInfo=getLinkInfo($mtp3_param_table,$link_title_oid,$link_status_oid,$lk_instance); $value=$lk_instance; //$color=$status_color[$lkInfo[Status]]; $color=$status_color[$statusSet[LinkStatus][$lk_instance]]; $response.="obj".$field_sep."lk_status_id_{$ls_index}_{$lk_index}".$field_sep."{$value}".$field_sep."{$color}".$line_sep; //$response.="title".$field_sep."lk_title_id_{$ls_index}_{$lk_index}".$field_sep."{$lkInfo[Title]}".$line_sep; $linkset[$ls_index][LinkIndex]++; } for($index=0;$index<$num;$index++) { for($j=$linkset[$index][LinkIndex];$j<$maxRowPerPage;$j++) { $response.="obj".$field_sep."lk_status_id_{$index}_{$j}".$field_sep."--".$field_sep."#000000".$line_sep; //$response.="obj".$field_sep."lk_status_id_{$index}_{$j}".$field_sep."--".$line_sep; } } $response=substr($response,0,strlen($response)-1); //system("date >> /tmp/test.txt"); echo $response; ?>