function OpticalFiberJoin_replaceCableLine($oldCableLine, $newCableLine, $NetworkNode, $tmpT = FALSE) { $ofj = getNodeFibers($NetworkNode, -1, $oldCableLine, $tmpT); if (isset($ofj['error'])) { return $ofj; } foreach ($ofj['rows'] as $row) { $fiber = OpticalFiber_SELECT(0, array('CableLine' => $newCableLine, 'fiber' => $row['fiber']), $tmpT); OpticalFiberJoin_UPDATE(array('OpticalFiber' => $fiber['rows'][0]['id']), array('id' => $row['OFJ_id']), $tmpT); } return $ofj; }
function FiberSplice_Mod($OFJ_id, $CableLine, $fiber, $FiberSpliceOrganizer, $attenuation, $note) { if ($FiberSpliceOrganizer == '') { return array('error' => 'Выберите кассету!'); } $trans = startTransaction(); $wr['id'] = $OFJ_id; $res = OpticalFiberJoin_SELECT(1, $wr); $OpticalFiberSplice = $res['rows'][0]['OpticalFiberSplice']; unset($wr); $wr['fiber'] = $fiber; $wr['CableLine'] = $CableLine; $res = OpticalFiber_SELECT(1, $wr); unset($wr); $upd['OpticalFiber'] = $res['rows'][0]['id']; $wr['id'] = $OFJ_id; $res = OpticalFiberJoin_UPDATE($upd, $wr); if (isset($res['error'])) { if ($trans) { rollbackTransaction(); } return $res; } unset($wr); unset($upd); $wr['id'] = $OpticalFiberSplice; $upd['FiberSpliceOrganizer'] = $FiberSpliceOrganizer; $upd['attenuation'] = $attenuation; $upd['note'] = $note; $res = OpticalFiberSplice_UPDATE($upd, $wr); if (isset($res['error'])) { if ($trans) { rollbackTransaction(); } return $res; } return $trans ? commitTransaction() : 1; }
$cl_col = $arr[0] == -1 ? '?' : (string) ($arr[0] + 1); if (isset($_GET['print'])) { $table_text_fibers .= '<td>' . $cl_col . ' - ' . $arr[1] . '</td>'; } else { $linksD = ' <a href="FiberSplice.php?mode=delete&spliceid=' . $splice_id . '"&networknodeid=' . $networkNodeId . ' onclick="return confirm(\'Удалить?\');">[x]</a>'; $clid = $res['cl_array']['rows'][$j]['clid']; $linksT = ' <a href="Tracing.php?spliceId=' . $res['SpliceArray'][$j][$i][4] . '&fiberId=-1&clid=' . $clid . '">[T]</a>'; $table_text_fibers .= '<td>' . '<a href="FiberSplice.php?mode=change&fiber1=' . $fiber1 . '&fiber2=' . $fiber2 . '&networknodeid=' . $networkNodeId . '&spliceid=' . $splice_id . '&clid2=' . $res['cl_array']['rows'][$arr[0]]['clid'] . '&clid1=' . $res['cl_array']['rows'][$j]['clid'] . '">' . $cl_col . ' - ' . $arr[1] . '</a> ' . $linksD . ' ' . $linksT . '</td>'; } } else { if (!isset($_GET['print'])) { $linksN = '<a href="FiberSplice.php?mode=add&fiber1=' . $fiber1 . '&networknodeid=' . $networkNodeId . '&clid1=' . $res['cl_array']['rows'][$j]['clid'] . '">[+]</a>'; $clid = $res['cl_array']['rows'][$j]['clid']; $wr2['CableLine'] = $clid; $wr2['fiber'] = $i; $res3 = OpticalFiber_SELECT(1, $wr2); $fiberId = $res3['rows'][0]['id']; $linksT = ' <a href="Tracing.php?spliceId=-1&fiberId=' . $fiberId . '&clid=' . $clid . '">[T]</a>'; $table_text_fibers .= '<td>' . $linksN . ' ' . $linksT . '</td>'; } else { $table_text_fibers .= '<td></td>'; } } if ($i == 1 or $fiberPerTube == 1 or $i % $fiberPerTube == 1) { $table_text_module = '<td rowspan="' . $fiberPerTube . '">' . $module . '</td>'; } } for ($k = $i + 1; $k <= $res['cl_array']['rows'][$j]['fiber']; $k++) { if (!isset($res['SpliceArray'][$j][$k])) { break; }
function CableLine_AddDeleteFibers($fibersCount, $cableLine) { $wr['CableLine'] = $cableLine; $res = OpticalFiber_SELECT(1, $wr); unset($wr); $rows = $res['rows']; if ($res['count'] != 0) { $lastFiber = $rows[$res['count'] - 1]['fiber']; } else { $lastFiber = 0; } if ($fibersCount > $lastFiber) { $i = 0; for ($fiber = 1; $fiber <= $fibersCount; $fiber++) { if (!isset($rows[$i]) || $fiber != $rows[$i]['fiber']) { $ins['fiber'] = $fiber; $ins['CableLine'] = $cableLine; $result = OpticalFiber_INSERT($ins); } else { $i++; } } } else { for ($fiber = $fibersCount + 1; $fiber <= $lastFiber; $fiber++) { $wr['id'] = $rows[$i]['fiber']; $result = OpticalFiber_DELETE($wr); } } return $result; }