diff --git a/Layout/default/FiberPlanPipe/Detail.php b/Layout/default/FiberPlanPipe/Detail.php index 22a8a7c29..6e19af1e5 100644 --- a/Layout/default/FiberPlanPipe/Detail.php +++ b/Layout/default/FiberPlanPipe/Detail.php @@ -37,13 +37,16 @@ foreach ($pipworkeraddresses as $pipworkeraddress): endforeach; -foreach ($networks as $network): - $Network[$network->id] = $network->name; +foreach ($fiberplanpipeendpoints as $fiberplanpipeEndpoint): + if ($fiberplanpipeEndpoint->pop_id) { + $networks[$fiberplanpipeEndpoint->pop->network->name] = $fiberplanpipeEndpoint->pop->network->name; + } else if ($fiberplanpipeEndpoint->building_id) { + $networks[$fiberplanpipeEndpoint->building->network->name] = $fiberplanpipeEndpoint->building->network->name; + } else if ($fiberplanpipeEndpoint->fiberPlanDispatcher_id) { + $networks[$fiberplanpipeEndpoint->fiberPlanDispatcher->network->name] = $fiberplanpipeEndpoint->fiberPlanDispatcher->network->name; + } endforeach; -$allNetworks[$fiberplanpipes->startpoint_network_id] = $Network[$fiberplanpipes->startpoint_network_id]; -$allNetworks[$fiberplanpipes->endpoint_network_id] = $Network[$fiberplanpipes->endpoint_network_id]; - if ($fiberplanpipes->address_id) { $responsible = $Pipeworkers[$fiberplanpipes->address_id]; } else { @@ -286,7 +289,7 @@ if ($fiberplanpipes->type == "3") { Netzgebiet (e) - + Rohrtyp @@ -361,6 +364,11 @@ if ($fiberplanpipes->type == "3") { $endpointtype = $fiberplanpipestypes[$endpoint->fiberPlanDispatcher->object_type]; $gps_lat = $endpoint->fiberPlanDispatcher->gps_lat; $gps_long = $endpoint->fiberPlanDispatcher->gps_long; + } elseif ($endpoint->building_id) { + $endpointname = $endpoint->building->street; + $endpointtype = 'Building'; + $gps_lat = $endpoint->building->gps_lat; + $gps_long = $endpoint->building->gps_long; } $coordinates = ""; if ($gps_lat) { @@ -391,13 +399,12 @@ if ($fiberplanpipes->type == "3") { $gps_lat, - "gps_long" => $gps_long, - "name" => $endpointname, - ); - } + $markers[] = array( + "gps_lat" => $gps_lat, + "gps_long" => $gps_long, + "name" => $endpointname, + "type" => $endpointtype + ); ?> type == "3") { $_GET["returnto"]]) ?>"> -
+
- -
- -
- -
-
- -
-
-
- -
- -
-
-
"> - -
- -
-
-
type) ? "display:none" : "" ?>"> - -
- +
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+
"> + +
+ +
+
+
type) ? "display:none" : "" ?>"> + +
+ +
+
+
+ +
+ +
+
+ +
+ - +
+ +
+ +
+
+ +
+
- - -
-
-
- -
- -
-
- -
- -
-
- -
- -
-
-
- -
- -
-
"> - -
-
- +
+
+ +
+
+ +
+ +
+
+
+ +
+ +
+
"> + +
+
+ -
+
-
-
- -
+
+
+ +
+
+
+ +
+
+
+
+
+
+

Legende:

+
+
+
+
+
+
+
+
+
-
@@ -250,7 +328,6 @@ if (isset($_GET['returnto']) && $_GET['returnto'] == "fiberplanpipe-detail") {
- @@ -259,13 +336,26 @@ if (isset($_GET['returnto']) && $_GET['returnto'] == "fiberplanpipe-detail") { diff --git a/Layout/default/FiberPlanPipe/Index.php b/Layout/default/FiberPlanPipe/Index.php index 5d7b844ae..516d0cf2d 100644 --- a/Layout/default/FiberPlanPipe/Index.php +++ b/Layout/default/FiberPlanPipe/Index.php @@ -1,6 +1,3 @@ - - - id] as $fiberplanpipeEndpoint) { + if ($fiberplanpipeEndpoint->pop_id) { + $networks[$fiberplanpipeEndpoint->pop->network->name] = $fiberplanpipeEndpoint->pop->network->name; + $endpoints[] = '(P) ' . $fiberplanpipeEndpoint->pop->name; + } else if ($fiberplanpipeEndpoint->building_id) { + $networks[$fiberplanpipeEndpoint->building->network->name] = $fiberplanpipeEndpoint->building->network->name; + $endpoints[] = '(B) ' . $fiberplanpipeEndpoint->building->street . " " . $fiberplanpipeEndpoint->building->number; + } else if ($fiberplanpipeEndpoint->fiberPlanDispatcher_id) { + $networks[$fiberplanpipeEndpoint->fiberPlanDispatcher->network->name] = $fiberplanpipeEndpoint->fiberPlanDispatcher->network->name; + if ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "1") { + $endpoints[] = '(V) ' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description; + } elseif ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "2") { + $endpoints[] = '(S) ' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description; + } else if ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "3") { + $endpoints[] = '(G) ' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description; + } else if ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "4") { + $endpoints[] = '(A) ' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description; + } + } + } if ($fiberplanpipe->type == "3") { $name = ""; @@ -143,13 +161,15 @@ foreach ($pipworkeraddresses as $pipworkeraddress) { } ?> - $fiberplanpipe->id]) ?>">description ?> + + $fiberplanpipe->id]) ?>">description ?> + type] . " / " . $typeDescription ?> length ?> - - - + + + status] ?> @@ -164,9 +184,6 @@ foreach ($pipworkeraddresses as $pipworkeraddress) { - @@ -193,64 +210,7 @@ foreach ($pipworkeraddresses as $pipworkeraddress) { - + diff --git a/application/FiberPlanPipe/FiberPlanPipeController.php b/application/FiberPlanPipe/FiberPlanPipeController.php index e6bcd569a..17d2f2551 100644 --- a/application/FiberPlanPipe/FiberPlanPipeController.php +++ b/application/FiberPlanPipe/FiberPlanPipeController.php @@ -18,13 +18,12 @@ class FiberPlanPipeController extends mfBaseController protected function indexAction() { - $networks = NetworkModel::getAll(); $this->layout()->setTemplate("FiberPlanPipe/Index"); $fiberplanpipes = FiberPlanPipeModel::getAll(); $pipworkeraddresses = FiberPlanPipeModel::getPipeworkerAddresses(); - $buildings = FiberPlanPipeModel::getBuildingInfoAll(); - $this->layout()->set("networks", $networks); - $this->layout()->set("buildings", $buildings); + $fiberplanpipeEndpoints = FiberPlanPipeEndpointModel::getAll(); + + $this->layout()->set("fiberplanpipeEndpoints", $fiberplanpipeEndpoints); $this->layout()->set("pipworkeraddresses", $pipworkeraddresses); $this->layout()->set("fiberplanpipes", $fiberplanpipes); @@ -66,7 +65,6 @@ class FiberPlanPipeController extends mfBaseController protected function detailAction() { $id = $this->request->id; - $networks = NetworkModel::getAll(); $this->layout()->setTemplate("FiberPlanPipe/Detail"); if (!is_numeric($id) || !$id) { $this->layout()->setFlash("Rohrverzeichnis nicht gefunden", "error"); @@ -77,12 +75,9 @@ class FiberPlanPipeController extends mfBaseController $this->layout()->setFlash("Rohrverzeichnis nicht gefunden", "error"); $this->redirect("FiberPlanPipe"); } - $this->layout()->set("fiberplanpipes", $fiberplanpipes); $pipworkeraddresses = FiberPlanPipeModel::getPipeworkerAddresses(); - $buildings = FiberPlanPipeModel::getBuildingInfoAll(); $fiberplanpipeendpoints = FiberPlanPipeEndpointModel::search(['fiberPlanPipe_id' => $id]); - $this->layout()->set("networks", $networks); - $this->layout()->set("buildings", $buildings); + $this->layout()->set("fiberplanpipes", $fiberplanpipes); $this->layout()->set("pipworkeraddresses", $pipworkeraddresses); $this->layout()->set("fiberplanpipeendpoints", $fiberplanpipeendpoints); } @@ -111,8 +106,6 @@ class FiberPlanPipeController extends mfBaseController { $r = $this->request; $id = $r->id; - var_dump($r->get()); - die(); if (is_numeric($id) && $id > 0) { $mode = "edit"; $fiberplanpipes = new FiberPlanPipe($id); @@ -189,12 +182,6 @@ class FiberPlanPipeController extends mfBaseController if (!$data['length']) { $data['length'] = NULL; } - if (!$data['startpoint']) { - $data['startpoint'] = NULL; - } - if (!$data['endpoint']) { - $data['endpoint'] = NULL; - } if (!$data['status']) { $data['status'] = NULL; } @@ -226,24 +213,42 @@ class FiberPlanPipeController extends mfBaseController $endpoint = $r->endpoint; if (!empty($endpoint)) { + $fiberplanpipeendpoints = FiberPlanPipeEndpointModel::search(['fiberPlanPipe_id' => $id]); + foreach ($fiberplanpipeendpoints as $fiberplanpipeendpoint) { + if (!in_array($fiberplanpipeendpoint->id, $endpoint_id)) { + $fiberplanpipeendpoint->delete(); + } + } $counter = 1; foreach ($endpoint as $key => $Endpoint) { - if ($endpoint_type[$key] == 4) { + unset($endpointarray); + $endpointarray = []; + $endpointarray['fiberPlanDispatcher_id'] = null; + $endpointarray['pop_id'] = null; + $endpointarray['building_id'] = null; + if ($endpoint_type[$key] == 4 || $endpoint_type[$key] == 1) { $endpointarray['fiberPlanDispatcher_id'] = $Endpoint; } else if ($endpoint_type[$key] == 2) { $endpointarray['pop_id'] = $Endpoint; + } else if ($endpoint_type[$key] == 3) { + $endpointarray['building_id'] = $Endpoint; } $endpointarray['fiberPlanPipe_id'] = $id; $endpointarray['sort'] = $counter; +// print_r($endpointarray); +// var_dump($endpoint_id[$key]); +// die(); if ($endpoint_id[$key]) { - $fiberplanpipeendpoint = new FiberPlanPipeEndpoint($id); + $fiberplanpipeendpoint = new FiberPlanPipeEndpoint($endpoint_id[$key]); $fiberplanpipeendpoint->update($endpointarray); + unset($endpoint_id[$key]); } else { $fiberplanpipeendpoint = FiberPlanPipeEndpointModel::create($endpointarray); } $fiberplanpipeendpoint->save(); $counter++; } + } diff --git a/application/FiberPlanPipe/FiberPlanPipeModel.php b/application/FiberPlanPipe/FiberPlanPipeModel.php index 42736fb78..acedc102d 100644 --- a/application/FiberPlanPipe/FiberPlanPipeModel.php +++ b/application/FiberPlanPipe/FiberPlanPipeModel.php @@ -9,13 +9,6 @@ class FiberPlanPipeModel private $type_description; private $fiberplanpipetemplate_id; private $length; - private $startpoint_type; - private $startpoint_network_id; - private $startpoint; - private $midpoint; - private $endpoint_network_id; - private $entpoint_type; - private $endpoint; private $status; private $responsible; private $responsible_text; @@ -212,15 +205,15 @@ INNER JOIN `Address` ON (`Address`.`id`=`Addresstype`.`address_id`) $items = []; $db = FronkDB::singleton(); if ($bdtype == "1") { - $sql = "SELECT `id`,`description` `name` FROM `FiberPlanDispatcher` WHERE network_id='" . $network . "' AND `object_type`='3' "; + $sql = "SELECT `id`,`description` `name`,`gps_lat`,`gps_long` FROM `FiberPlanDispatcher` WHERE network_id='" . $network . "' AND `object_type`='3' "; } else if ($bdtype == "2") { - $sql = "SELECT `Pop`.`id`,`Pop`.`name` FROM `PopNetwork` + $sql = "SELECT `Pop`.`id`,`Pop`.`name`,`gps_lat`,`gps_long` FROM `PopNetwork` INNER JOIN `Pop` ON (`Pop`.`id`=`PopNetwork`.`pop_id`) WHERE `PopNetwork`.`network_id`='" . $network . "'"; } else if ($bdtype == "3") { - $sql = "SELECT `id`,`code` ,`street`, `zip`, `city` name FROM Building WHERE network_id='" . $network . "' ORDER by street"; + $sql = "SELECT `id`,`code` ,`street`, `zip`, `city` name ,`gps_lat`,`gps_long` FROM Building WHERE network_id='" . $network . "' ORDER by street"; } else if ($bdtype == "4") { - $sql = "SELECT `id`,`description` `name` FROM `FiberPlanDispatcher` WHERE network_id='" . $network . "' AND (`object_type`='1' OR `object_type`='2') "; + $sql = "SELECT `id`,`description` `name`,`gps_lat`,`gps_long` FROM `FiberPlanDispatcher` WHERE network_id='" . $network . "' AND (`object_type`='1' OR `object_type`='2') "; } $res = $db->query($sql); @@ -229,6 +222,8 @@ INNER JOIN `Address` ON (`Address`.`id`=`Addresstype`.`address_id`) $counter = 0; while ($data = $db->fetch_array($res)) { $items[$counter]['id'] = $data['id']; + $items[$counter]['gps_lat'] = $data['gps_lat']; + $items[$counter]['gps_long'] = $data['gps_long']; if ($bdtype == "3") { $items[$counter]['name'] = $data['street'] . " " . $data['zip'] . " " . $data['city']; } else { @@ -285,6 +280,7 @@ INNER JOIN `Address` ON (`Address`.`id`=`Addresstype`.`address_id`) } $counter = 1; $endpointuparrow = ""; + $Endpointdownarrow = ""; $typeArray[1] = 'Greenfield'; $typeArray[2] = 'POP'; $typeArray[3] = 'Building'; @@ -293,7 +289,8 @@ INNER JOIN `Address` ON (`Address`.`id`=`Addresstype`.`address_id`) // print_r($buildings); $counter = 1; foreach ($endpoints as $Endpoint) { - + $endpointuparrow = ""; + $Endpointdownarrow = ""; if ($Endpoint->pop_id) { $networkid = $Endpoint->pop->network_id; $endpointid = $Endpoint->pop->id; @@ -312,27 +309,28 @@ INNER JOIN `Address` ON (`Address`.`id`=`Addresstype`.`address_id`) $endpointtype = 3; } $randid = rand(1000, 10000); - if ($counter > 1) { + + if (count($endpoints) == $counter) { + $Endpointuparrow = ''; + } else if ($counter > 1) { $Endpointuparrow = ''; + $Endpointdownarrow = ''; } if ($counter == 1) { $endpointType = "Startpunkt"; $endpointsymbol = ''; - } - else if (count($endpoints)==2) - { + } else if (count($endpoints) == 2) { $endpointcount = $counter - 1; $endpointType = "Standort " . $endpointcount; - $endpointsymbol=''; - } - else { + $endpointsymbol = ''; + } else { $endpointcount = $counter - 1; $endpointType = "Standort " . $endpointcount; $endpointsymbol = ''; } $html = '
- -
'; foreach ($networks as $network) { if ($network->id == $networkid) { $html .= ''; @@ -354,19 +352,19 @@ INNER JOIN `Address` ON (`Address`.`id`=`Addresstype`.`address_id`) } $html .= '
-
- '; $buildings = FiberPlanPipeModel::getBuildingInfo($networkid, $endpointtype, 0); foreach ($buildings as $key => $building) { if ($building['id'] == $endpointid) { - $html .= ''; + $html .= ''; } else { - $html .= ''; + $html .= ''; } } - $html .= '
'; + $html .= '
'; echo $html; $counter++; } diff --git a/application/FiberPlanPipeEndpoint/FiberPlanPipeEndpointModel.php b/application/FiberPlanPipeEndpoint/FiberPlanPipeEndpointModel.php index 7cfee1593..9e575847c 100644 --- a/application/FiberPlanPipeEndpoint/FiberPlanPipeEndpointModel.php +++ b/application/FiberPlanPipeEndpoint/FiberPlanPipeEndpointModel.php @@ -67,10 +67,10 @@ class FiberPlanPipeEndpointModel $db = FronkDB::singleton(); - $res = $db->select("FiberPlanPipeEndpoint", "*", "1=1"); + $res = $db->select("FiberPlanPipeEndpoint", "*", "1=1 ORDER by sort"); if ($db->num_rows($res)) { while ($data = $db->fetch_object($res)) { - $items[] = new FiberPlanPipeEndpoint($data); + $items[$data->fiberPlanPipe_id][$data->sort] = new FiberPlanPipeEndpoint($data); } } return $items; diff --git a/db/migrations/20240423132651_fiber_plan_pipe_drop.php b/db/migrations/20240423132651_fiber_plan_pipe_drop.php new file mode 100644 index 000000000..b0cbc34e6 --- /dev/null +++ b/db/migrations/20240423132651_fiber_plan_pipe_drop.php @@ -0,0 +1,29 @@ +getEnvironment() == "thetool") { + $this->table("FiberPlanPipe")->drop()->save(); + } + + if($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void + { + if($this->getEnvironment() == "thetool") { + + } + + if($this->getEnvironment() == "addressdb") { + + } + } +} diff --git a/db/migrations/20240423132655_fiber_plan_pipe_create.php b/db/migrations/20240423132655_fiber_plan_pipe_create.php new file mode 100644 index 000000000..de8657301 --- /dev/null +++ b/db/migrations/20240423132655_fiber_plan_pipe_create.php @@ -0,0 +1,43 @@ +getEnvironment() == "thetool") { + $table = $this->table("FiberPlanPipe", ["signed" => true]); + $table->addColumn("description", "text", ["null" => false]); + $table->addColumn("gisid", "text", ["null" => true]); + $table->addColumn("type", "integer", ["null" => false]); + $table->addColumn("type_description", "integer", ["null" => true]); + $table->addColumn("fiberPlanPipeTemplate_id", "integer", ["null" => true]); + $table->addColumn("length", "integer", ["null" => false]); + $table->addColumn("status", "integer", ["null" => false]); + $table->addColumn("responsible", "integer", ["null" => false]); + $table->addColumn("responsible_text", "text", ["null" => true]); + $table->addColumn("address_id", "integer", ["null" => true]); + $table->addColumn("comment", "text", ["null" => true]); + $table->addColumn("edit_by", "integer", ["null" => false]); + $table->addColumn("create_by", "integer", ["null" => false]); + $table->addColumn("edit", "integer", ["null" => false]); + $table->addColumn("create", "integer", ["null" => false]); + $table->save(); + } + + if ($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void + { + if ($this->getEnvironment() == "thetool") { + $this->table("FiberPlanPipe")->drop()->save(); + } + if ($this->getEnvironment() == "addressdb") { + } + } +} diff --git a/public/img/markers/marker-dispatcher.png b/public/img/markers/marker-dispatcher.png new file mode 100644 index 000000000..c94a596c2 Binary files /dev/null and b/public/img/markers/marker-dispatcher.png differ diff --git a/public/img/markers/marker-greenfield.png b/public/img/markers/marker-greenfield.png new file mode 100644 index 000000000..48a61ddfe Binary files /dev/null and b/public/img/markers/marker-greenfield.png differ diff --git a/public/img/markers/marker-home.png b/public/img/markers/marker-home.png new file mode 100644 index 000000000..2ac55a95f Binary files /dev/null and b/public/img/markers/marker-home.png differ diff --git a/public/img/markers/marker-pop.png b/public/img/markers/marker-pop.png new file mode 100644 index 000000000..cf04a0dd6 Binary files /dev/null and b/public/img/markers/marker-pop.png differ