Poprack
Features: * Komplettes kabelmanagement auf Rack He Modul Basis
This commit is contained in:
@@ -25,7 +25,11 @@ class FiberPlanCableModel
|
||||
private $address_id;
|
||||
private $network_id;
|
||||
private $comment;
|
||||
|
||||
private $parent_cable_id;
|
||||
private $is_branch_cable;
|
||||
private $branch_from_location;
|
||||
private $branch_to_location;
|
||||
private $coordinates;
|
||||
public static $fibersArray = array(1 => 4, 2 => 12, 3 => 24, 4 => 24, 5 => 48, 6 => 96, 7 => 144, 8 => 144, 9 => 192, 10 => 288);
|
||||
|
||||
public static function find($data)
|
||||
@@ -132,12 +136,26 @@ class FiberPlanCableModel
|
||||
private static function getSqlFilter($filter)
|
||||
{
|
||||
$where = "1=1 ";
|
||||
if (array_key_exists("description", $filter) && $filter['description']) {
|
||||
$description = $filter['description'];
|
||||
$where .= " AND description='$description'";
|
||||
}
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if (array_key_exists("network_id", $filter)) {
|
||||
$networkid = $filter['network_id'];
|
||||
if (is_numeric($networkid)) {
|
||||
$where .= " AND network_id=$networkid";
|
||||
if (is_array($filter['network_id'])) {
|
||||
$ids = array_map('intval', $filter['network_id']);
|
||||
$ids = array_filter($ids, function($id) { return $id > 0; });
|
||||
if (!empty($ids)) {
|
||||
$idList = implode(',', $ids);
|
||||
$where .= " AND network_id IN ($idList)";
|
||||
}
|
||||
} else {
|
||||
$network_id = intval($filter['network_id']);
|
||||
if ($network_id > 0) {
|
||||
$where .= " AND network_id=$network_id";
|
||||
} elseif ($network_id === 0) {
|
||||
$where .= " AND (network_id IS NULL OR network_id=0)";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,7 +257,51 @@ INNER JOIN `Address` ON (`Address`.`id`=`Addresstype`.`address_id`)
|
||||
return $items;
|
||||
|
||||
}
|
||||
public static function getCableRoute($cable_id) {
|
||||
$route = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
// SQL-Abfrage mit object_type für Dispatcher
|
||||
$sql = "SELECT
|
||||
fcs.station_order,
|
||||
fcs.station_type,
|
||||
fcs.station_id,
|
||||
CASE
|
||||
WHEN fcs.station_type = 'pop' THEN p.name
|
||||
WHEN fcs.station_type = 'dispatcher' THEN d.description
|
||||
END as station_name,
|
||||
CASE
|
||||
WHEN fcs.station_type = 'pop' THEN p.gps_lat
|
||||
WHEN fcs.station_type = 'dispatcher' THEN d.gps_lat
|
||||
END as gps_lat,
|
||||
CASE
|
||||
WHEN fcs.station_type = 'pop' THEN p.gps_long
|
||||
WHEN fcs.station_type = 'dispatcher' THEN d.gps_long
|
||||
END as gps_long,
|
||||
d.object_type
|
||||
FROM FiberPlanCableStation fcs
|
||||
LEFT JOIN Pop p ON fcs.station_type = 'pop' AND fcs.station_id = p.id
|
||||
LEFT JOIN FiberPlanDispatcher d ON fcs.station_type = 'dispatcher' AND fcs.station_id = d.id
|
||||
WHERE fcs.cable_id = " . intval($cable_id) . "
|
||||
ORDER BY fcs.station_order ASC";
|
||||
|
||||
$res = $db->query($sql);
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_array($res)) {
|
||||
$route[] = [
|
||||
'order' => $data['station_order'],
|
||||
'type' => $data['station_type'],
|
||||
'id' => $data['station_id'],
|
||||
'name' => $data['station_name'],
|
||||
'gps_lat' => $data['gps_lat'],
|
||||
'gps_long' => $data['gps_long'],
|
||||
'object_type' => $data['object_type'] // Neu: object_type hinzugefügt
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $route;
|
||||
}
|
||||
public static function generateEndpoint($endpoint, $destination, $html = 1)
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user