} } print $pois_text; } elseif ($_GET['mode'] == 'GetNetworkNodesDescription') { require_once 'func/FiberSplice.php'; $res = getNetworkNodeList_NetworkBoxName('', '', ''); $rows = $res['rows']; $dom = new DomDocument('1.0', 'UTF-8'); $nodesDescriptions = $dom->appendChild($dom->createElement('nodesDescriptions')); for ($i = 0; $i < $res['count']; $i++) { $nodeDescription = $nodesDescriptions->appendChild($dom->createElement('nodeDescription')); $OpenGIS = $rows[$i]['OpenGIS']; if (preg_match_all('/(?<x>[0-9.]+),(?<y>[0-9.]+)/', $OpenGIS, $matches)) { //$fiberSpliceCount = getFiberSpliceCount_NetworkNode($rows[$i]['id']); $fiberSpliceCount = $rows[$i]['fiberSpliceCount']; $cableLines_row = getCableLineInfo($rows[$i]['id']); $cableLinesZeroFibers = 0; $cableLinesNotZeroFibers = 0; for ($j = 0; $j < $cableLines_row['count']; $j++) { if ($cableLines_row['rows'][$j]['fiber'] > 0) { $cableLinesNotZeroFibers++; } else { $cableLinesZeroFibers++; } } $desc = 'Ящик: <a target="_blank" href="NetworkBox.php?mode=charac&boxid=' . $rows[$i]['NetworkBox'] . '">' . $rows[$i]['inventoryNumber'] . '</a><br>' . 'Тип ящика: <a target="_blank" href="NetworkBoxType.php?mode=charac&boxtypeid=' . $rows[$i]['NetworkBoxType'] . '">' . $rows[$i]['NBTmarking'] . '</a><br>' . 'Расположение: ' . $rows[$i]['place'] . '<br>' . 'Примечание: ' . str_replace(array("\r\n", "\n", "\r"), "<br>", $rows[$i]['note']) . '<br>' . 'Входящие линии: <ul>' . '<li>Всего: ' . (string) ($cableLinesZeroFibers + $cableLinesNotZeroFibers) . '</li>' . '<li>0 волокон: ' . $cableLinesZeroFibers . '</li>' . '<li>1+ волокон: ' . $cableLinesNotZeroFibers . '</li>' . '</ul>' . 'К-во сварок: ' . $fiberSpliceCount; $fibRes = getFiberTable($rows[$i]['id']); if ($fibRes['maxfiber'] > 0) { $desc .= '<br>[<a target="_blank" href="FiberSplice.php?networknodeid=' . $rows[$i]['id'] . '">Таблица сварок</a>]'; } $index = $nodeDescription->appendChild($dom->createElement('index'));
function getFiberTable($nodeID) { $cl_array = getCableLineInfo($nodeID); $i = 0; $maxfiber = 0; if ($cl_array['count'] == 0) { // TODO: exit and return zero table return; } // Array of cableline points foreach ($cl_array['rows'] as $elem) { if ($maxfiber < $elem['fiber']) { $maxfiber = $elem['fiber']; } $CableLines[$elem['clid']] = $i++; } // Buiding array of fiber splices $fs_array = getNodeFibers($nodeID); $spliceArray = array(); if ($fs_array['count'] > 0) { $rows = $fs_array['rows']; $i = 0; while ($i < count($rows) - 1) { if ($rows[$i]['OpticalFiberSplice'] == $rows[$i + 1]['OpticalFiberSplice']) { $ClA = condAssign($CableLines, $rows[$i]['CableLine'], -1); $ClB = condAssign($CableLines, $rows[$i + 1]['CableLine'], -1); $fA = $rows[$i]['fiber']; $fB = $rows[$i + 1]['fiber']; $FSO = $rows[$i]['FiberSpliceOrganizer']; $spliceId = $rows[$i]['OpticalFiberSplice']; $spliceArray[$ClA][$fA] = array($ClB, $fB, $rows[$i + 1]['OFJ_id'], $FSO, $spliceId); $spliceArray[$ClB][$fB] = array($ClA, $fA, $rows[$i]['OFJ_id'], $FSO, $spliceId); $i = $i + 2; } else { $i++; } } } else { $spliceArray = array(); } $res['maxfiber'] = $maxfiber; $res['CableLines'] = $CableLines; $res['SpliceArray'] = $spliceArray; $res['cl_array'] = $cl_array; return $res; }
$pois_text .= $lat . "\t" . $lon . "\t" . $title . "\t" . $description . "\t" . $icon . "\t" . $iconSize . "\t" . $iconOffset . "\n"; } } print $pois_text; } elseif ($_GET['mode'] == 'GetNetworkNodesDescription') { $res = getNetworkNodeList_NetworkBoxName('', '', '', -1, -1, TRUE); $rows = $res['rows']; $dom = new DomDocument('1.0', 'UTF-8'); $nodesDescriptions = $dom->appendChild($dom->createElement('nodesDescriptions')); for ($i = 0; $i < $res['count']; $i++) { $nodeDescription = $nodesDescriptions->appendChild($dom->createElement('nodeDescription')); $OpenGIS = $rows[$i]['OpenGIS']; if (preg_match_all('/(?<x>[0-9.]+),(?<y>[0-9.]+)/', $OpenGIS, $matches)) { //$fiberSpliceCount = getFiberSpliceCount_NetworkNode($rows[$i]['id']); $fiberSpliceCount = $rows[$i]['fiberSpliceCount']; $cableLines_row = getCableLineInfo($rows[$i]['id'], 1, TRUE); $cableLinesZeroFibers = 0; $cableLinesNotZeroFibers = 0; for ($j = 0; $j < $cableLines_row['count']; $j++) { if ($cableLines_row['rows'][$j]['fiber'] > 0) { $cableLinesNotZeroFibers++; } else { $cableLinesZeroFibers++; } } $desc = 'Ящик: <a target="_blank" href="NetworkBox.php?mode=charac&boxid=' . $rows[$i]['NetworkBox'] . '">' . $rows[$i]['inventoryNumber'] . '</a><br>' . 'Тип ящика: <a target="_blank" href="NetworkBoxType.php?mode=charac&boxtypeid=' . $rows[$i]['NetworkBoxType'] . '">' . $rows[$i]['NBTmarking'] . '</a><br>' . 'Примечание: ' . str_replace(array("\r\n", "\n", "\r"), "<br>", $rows[$i]['note']) . '<br>' . 'Входящие линии: <ul>' . '<li>Всего: ' . (string) ($cableLinesZeroFibers + $cableLinesNotZeroFibers) . '</li>' . '<li>0 волокон: ' . $cableLinesZeroFibers . '</li>' . '<li>1+ волокон: ' . $cableLinesNotZeroFibers . '</li>' . '</ul>' . 'К-во сварок: ' . $fiberSpliceCount . '<br>' . '[<a target="_blank" href="FiberSplice.php?networknodeid=' . $rows[$i]['id'] . '">Таблица сварок</a>]'; $index = $nodeDescription->appendChild($dom->createElement('index')); $index = $index->appendChild($dom->createTextNode($i)); $description = $nodeDescription->appendChild($dom->createElement('description')); $description = $description->appendChild($dom->createTextNode($desc)); }