function CableLine_Info($cableLineId) { $wr['id'] = $cableLineId; $res = CableLine_SELECT(0, $wr); $result['CableLine'] = $res; $CableType = $result['CableLine']['rows'][0]['CableType']; $wr['id'] = $CableType; $res = CableType_SELECT(0, $wr); $result['CableLine']['rows'][0]['CableTypeMarking'] = $res['rows'][0]['marking']; $result['CableLine']['rows'][0]['CableTypeManufacturer'] = $res['rows'][0]['manufacturer']; $result['CableLine']['rows'][0]['CableTypeId'] = $res['rows'][0]['id']; $result['CableLinePoints'] = getCableLinePoint_NetworkNodeName($cableLineId); return $result; }
<?php require_once 'backend/CableType.php'; print '<meta charset="UTF-8">'; if (isset($_GET['CableLine']) && ctype_digit($_GET['CableLine'])) { $CableLine = $_GET['CableLine']; $wr['id'] = $CableLine; $cl = CableLine_SELECT(-1, $wr); $CableType = $cl['rows'][0]['CableType']; $wr['id'] = $CableType; $ct = CableType_SELECT(-1, $wr); $fibersCount = $ct['rows'][0]['tubeQuantity'] * $ct['rows'][0]['fiberPerTube']; for ($i = 1; $i <= $fibersCount; $i++) { print "Добавляем волокно #" . $i . "...<br/>"; $ins['CableLine'] = $CableLine; $ins['fiber'] = $i; $query = 'INSERT INTO "OpticalFiber"' . genInsert($ins); PQuery($query); } print "Добавление волокон завершено!"; }
$smarty->assign("id", $rows[0]['id']); $smarty->assign("marking", $rows[0]['marking']); $smarty->assign("manufacturer", $rows[0]['manufacturer']); $smarty->assign("tubeQuantity", $rows[0]['tubeQuantity']); $smarty->assign("fiberPerTube", $rows[0]['fiberPerTube']); $smarty->assign("tensileStrength", $rows[0]['tensileStrength']); $smarty->assign("diameter", $rows[0]['diameter']); $smarty->assign("comment", $rows[0]['comment']); } elseif ($_GET['mode'] == 'charac' and isset($_GET['cabletypeid'])) { if ($_SESSION['class'] > 1) { $message = '!!!'; showMessage($message, 0); } $smarty->assign("mode", "charac"); $wr['id'] = $_GET['cabletypeid']; $res = CableType_SELECT(0, $wr); if ($res['count'] < 1) { $message = 'Типа кабеля с таким ID не существует!<br /> <a href="CableType.php">Назад</a>'; showMessage($message, 0); } $rows = $res['rows']; $changeDelete = '<a href="CableType.php?mode=change&cabletypeid=' . $_GET['cabletypeid'] . '">Изменить</a>'; unset($wr); $wr['CableType'] = $_GET['cabletypeid']; $res2 = CableLine_SELECT('', $wr, '', ''); $changeDelete = ''; if ($res2['count'] == 0) { $changeDelete .= '<a href="CableType.php?mode=delete&cabletypeid=' . $_GET['cabletypeid'] . '">Удалить</a>'; } $smarty->assign("id", $rows[0]['id']);
$smarty->assign("combobox_cabletype_values", $comboBox_CableType_Values); $smarty->assign("combobox_cabletype_text", $comboBox_CableType_Text); $smarty->assign("combobox_cabletype_selected", $cableTypeId); } elseif ($_GET['mode'] == 'add') { if ($_SESSION['class'] > 1) { $message = '!!!'; showMessage($message, 0); } $smarty->assign("mode", "add_change"); $smarty->assign("mod", "2"); $smarty->assign("back", getenv("HTTP_REFERER")); $smarty->assign("id", ''); $smarty->assign("length", '0.00'); $smarty->assign("comment", ''); $smarty->assign("name", ''); $res = CableType_SELECT('', ''); $rows = $res['rows']; $i = -1; while (++$i < $res['count']) { $comboBox_CableType_Values[] = $rows[$i]['id']; $comboBox_CableType_Text[] = $rows[$i]['marking']; } $smarty->assign("combobox_cabletype_values", $comboBox_CableType_Values); $smarty->assign("combobox_cabletype_text", $comboBox_CableType_Text); $smarty->assign("combobox_cabletype_selected", ''); } elseif ($_GET['mode'] == 'delete' and isset($_GET['cablelineid'])) { if ($_SESSION['class'] > 1) { die("!!!"); } $wr['id'] = $_GET['cablelineid']; CableLine_DELETE($wr);