Exemplo n.º 1
0
function CableType_Add($marking, $manufacturer, $tubeQuantity, $fiberPerTube, $tensileStrength, $diameter, $comment)
{
    if (CableType_Check($marking, $manufacturer, $tubeQuantity, $fiberPerTube, $tensileStrength, $diameter, $comment) == 0) {
        return 0;
    }
    $ins['marking'] = $marking;
    $ins['manufacturer'] = $manufacturer;
    $ins['tubeQuantity'] = $tubeQuantity;
    $ins['fiberPerTube'] = $fiberPerTube;
    $ins['tensileStrength'] = $tensileStrength;
    $ins['diameter'] = $diameter;
    $ins['comment'] = $comment;
    $res = CableType_INSERT($ins);
    if (isset($res['error'])) {
        return $res;
    }
    CableLine_AddOpticalFiberForAll();
    return 1;
}
Exemplo n.º 2
0
function addCableLinePoint($coors, $CableType, $length, $name, $comment, $tmpT = FALSE)
{
    if ($length == "") {
        $ins['length'] = "NULL";
    } else {
        $ins['length'] = floatval(str_replace(',', '.', $length)) * 100;
    }
    $ins['CableType'] = $CableType;
    $ins['name'] = $name;
    $ins['comment'] = $comment;
    $query = 'INSERT INTO "' . tmpTable('CableLine', $tmpT) . '"' . genInsert($ins) . ' RETURNING id';
    $res = PQuery($query);
    $CableLine = $res['rows'][0]['id'];
    $seq = 1;
    unset($ins);
    for ($i = 0; $i < count($coors); $i++) {
        $coor = "(" . $coors[$i]->lon . "," . $coors[$i]->lat . ")";
        $ins['OpenGIS'] = $coor;
        $ins['sequence'] = $seq++;
        $ins['CableLine'] = $CableLine;
        $query = 'INSERT INTO "' . tmpTable('CableLinePoint', $tmpT) . '"' . genInsert($ins);
        PQuery($query);
    }
    CableLine_AddOpticalFiberForAll();
}