From f2ac8e9d70142bff61bc8052922cb8c71b16adb1 Mon Sep 17 00:00:00 2001 From: Spitzer Daniel Date: Tue, 16 Apr 2024 16:42:27 +0200 Subject: [PATCH 1/3] =?UTF-8?q?Faserplanung=20=20*=20Sch=C3=A4chte/Verteil?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Layout/default/FiberPlanDispatcher/Form.php | 244 ++++++++++++++++++ Layout/default/FiberPlanDispatcher/Index.php | 122 +++++++++ .../FiberPlanDispatcher.php | 59 +++++ .../FiberPlanDispatcherController.php | 182 +++++++++++++ .../FiberPlanDispatcherModel.php | 137 ++++++++++ .../FiberPlanDispatchersleeve.php | 60 +++++ .../FiberPlanDispatchersleeveController.php | 127 +++++++++ .../FiberPlanDispatchersleeveModel.php | 153 +++++++++++ 8 files changed, 1084 insertions(+) create mode 100644 Layout/default/FiberPlanDispatcher/Form.php create mode 100644 Layout/default/FiberPlanDispatcher/Index.php create mode 100644 application/FiberPlanDispatcher/FiberPlanDispatcher.php create mode 100644 application/FiberPlanDispatcher/FiberPlanDispatcherController.php create mode 100644 application/FiberPlanDispatcher/FiberPlanDispatcherModel.php create mode 100644 application/FiberPlanDispatchersleeve/FiberPlanDispatchersleeve.php create mode 100644 application/FiberPlanDispatchersleeve/FiberPlanDispatchersleeveController.php create mode 100644 application/FiberPlanDispatchersleeve/FiberPlanDispatchersleeveModel.php diff --git a/Layout/default/FiberPlanDispatcher/Form.php b/Layout/default/FiberPlanDispatcher/Form.php new file mode 100644 index 000000000..191924731 --- /dev/null +++ b/Layout/default/FiberPlanDispatcher/Form.php @@ -0,0 +1,244 @@ + + + +
+
+
+
+ +
+

id) ? "Verteiler/Schacht bearbeiten" : "Neuer Verteiler/Schacht" ?>

+
+
+
+ +permissions->isAdmin) { + foreach ($networkaddresses as $networkaddress) { + if ($me->address->id == $networkaddress->address_id) { + $allowedNetworks[$networkaddress->network_id] = "ok"; + } + } +} + +?> + +
+
+ +
+
+ +

id) ? "Verteiler/Schacht bearbeiten" : "Neuer Verteiler/Schacht" ?>

+
+
"> +
+
+
+
+ +
+ +
+ + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
object_type == 2) ? "" : 'style="display:none"' ?>> +
+

Muffe(n) +

+
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+
+ + +
+ +
+ + "> + + +
+
+
+ + + +
+
+ +
+
+ + + + \ No newline at end of file diff --git a/Layout/default/FiberPlanDispatcher/Index.php b/Layout/default/FiberPlanDispatcher/Index.php new file mode 100644 index 000000000..229917b9d --- /dev/null +++ b/Layout/default/FiberPlanDispatcher/Index.php @@ -0,0 +1,122 @@ + + + + + +
+
+
+
+ +
+

Verteiler und Schächte

+
+
+
+ + + +
+
+
+
+
+

Liste aller Verteiler und Schächte

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gps_lat) { + $mapslink = '' . rtrim($fiberplandispatcher->gps_lat, 0) . ' , ' . rtrim($fiberplandispatcher->gps_long, 0) . ''; + } else { + $mapslink = 'N/A'; + } + ?> + + + + + + + + + + + + + +
NetzgebietBeschreibungObjektartTypeKoordinatenKommentar
network->name ?>description ?>object_type] ?>type) ?>comment) ?> + $fiberplandispatcher->id]) ?>"> + $fiberplandispatcher->id]) ?>" + onclick="if(!confirm('Verteiler/Schacht wirklich löschen?')) return false;" + class="text-danger" + title="Löschen"> +
+ +
+
+ + + + + + + + + + \ No newline at end of file diff --git a/application/FiberPlanDispatcher/FiberPlanDispatcher.php b/application/FiberPlanDispatcher/FiberPlanDispatcher.php new file mode 100644 index 000000000..2df4ff4b9 --- /dev/null +++ b/application/FiberPlanDispatcher/FiberPlanDispatcher.php @@ -0,0 +1,59 @@ +$name == null) { + + if (!$this->id) { + return null; + } + + if($name == "creator") { + $this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by); + if($this->creator === null) { + $this->creator = new User($this->create_by); + if($this->creator->id) { + mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator); + } + } + return $this->creator; + } + + if($name == "editor") { + $this->editor = mfValuecache::singleton()->get("Worker-id-".$this->edit_by); + if($this->editor === null) { + $this->editor = new User($this->edit_by); + if($this->editor->id) { + mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor); + } + } + return $this->editor; + } + + $classname = ucfirst($name); + $idfield = $name."_id"; + $this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield); + if(!$this->$name) { + $this->$name = new $classname($this->$idfield); + } + + if($this->$name->id) { + mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name); + return $this->$name; + } else { + return null; + } + + } + + return $this->$name; + } + +} \ No newline at end of file diff --git a/application/FiberPlanDispatcher/FiberPlanDispatcherController.php b/application/FiberPlanDispatcher/FiberPlanDispatcherController.php new file mode 100644 index 000000000..acf22c583 --- /dev/null +++ b/application/FiberPlanDispatcher/FiberPlanDispatcherController.php @@ -0,0 +1,182 @@ +needlogin = true; + $me = new User(); + $me->loadMe(); + $this->me = $me; + $this->layout()->set("me", $me); + + if (!$me->is(["Admin"])) { + $this->redirect("Dashboard"); + } + } + + protected function indexAction() + { + + $this->layout()->setTemplate("FiberPlanDispatcher/Index"); + $fiberplandispatchers = FiberPlanDispatcherModel::getAll(); + $this->layout()->set("fiberplandispatchers", $fiberplandispatchers); + + } + + protected function addAction() + { + $this->layout()->setTemplate("FiberPlanDispatcher/Form"); + $networks = NetworkModel::getAll(); + $this->layout()->set("networks", $networks); + $networkaddresses = NetworkAddressModel::getAll(); + $this->layout()->set("networkaddresses", $networkaddresses); + + } + + protected function editAction() + { + $id = $this->request->id; + + if (!is_numeric($id) || !$id) { + $this->layout()->setFlash("Verteiler/Schacht nicht gefunden", "error"); + $this->redirect("FiberPlanDispatcher"); + } + + $fiberplandispatchers = new FiberPlanDispatcher($id); + if ($fiberplandispatchers->id != $id) { + $this->layout()->setFlash("Verteiler/Schacht nicht gefunden", "error"); + $this->redirect("FiberPlanDispatcher"); + } + + $this->layout()->set("fiberplandispatchers", $fiberplandispatchers); + if ($fiberplandispatchers->object_type == "2") { + $sleeves = FiberPlanDispatchersleeveModel::getAllbyDispatcher($id); + $this->layout()->set("sleeves", $sleeves); + } + + return $this->addAction(); + } + + protected function saveAction() + { + $r = $this->request; + $id = $r->id; + //var_dump($r->get());exit; + if (is_numeric($id) && $id > 0) { + $mode = "edit"; + $fiberplandispatcher = new FiberPlanDispatcher($id); + if (!$fiberplandispatcher->id) { + $this->layout()->setFlash("Verteiler/Schacht nicht gefunden", "error"); + $this->redirect("FiberPlanDispatcher"); + } + } else { + $mode = "add"; + } + + $data = []; + $data['network_id'] = trim($r->network_id); + $data['object_type'] = trim($r->object_type); + $data['description'] = trim($r->description); + if ($r->type) { + $data['type'] = trim($r->type); + } + if ($r->gps_lat) { + $data['gps_lat'] = trim($r->gps_lat); + } + if ($r->gps_long) { + $data['gps_long'] = trim($r->gps_long); + } + if ($r->comment) { + $data['comment'] = trim($r->comment); + } + + if (!$data['network_id']) { + $this->layout()->setFlash("Netzgebiet darf nicht leer sein", "error"); + $this->redirect("FiberPlanDispatcher"); + } + if (!$data['object_type']) { + $this->layout()->setFlash("Objekt Typ darf nicht leer sein", "error"); + $this->redirect("FiberPlanDispatcher"); + } + if (!$data['description']) { + $this->layout()->setFlash("Beschreibung darf nicht leer sein", "error"); + $this->redirect("FiberPlanDispatcher"); + } + +// var_dump($_FILES); +// var_dump($upload); +// exit; + + + if ($mode == "edit") { + $fiberplandispatcher->update($data); + + } else { + $fiberplandispatcher = FiberPlanDispatcherModel::create($data); + + } +// var_dump($filestore); +// exit; + $id = $fiberplandispatcher->save(); + if ($mode == "edit") { + if ($data['object_type'] == "2") { + FiberPlanDispatchersleeveModel::deletebyDispatcher($id); + $sleeves = $r->sleeves; + $sleevedata = []; + if (is_array($sleeves)) { + foreach ($sleeves as $sleeve) { + $sleevedata['name'] = trim($sleeve); + $sleevedata['fiberPlanDispatcher_id'] = $id; + $fiberplandispatchersleeve = FiberPlanDispatchersleeveModel::create($sleevedata); + $fiberplandispatchersleeve->save(); + } + } + + } + } else { + if ($data['object_type'] == "2") { + $sleeves = $r->sleeves; + $sleevedata = []; + + if (is_array($sleeves)) { + foreach ($sleeves as $sleeve) { + $sleevedata['name'] = trim($sleeve); + $sleevedata['fiberPlanDispatcher_id'] = $id; + $fiberplandispatchersleeve = FiberPlanDispatchersleeveModel::create($sleevedata); + $fiberplandispatchersleeve->save(); + } + } + + } + } + + if (!$id) { + $this->layout()->setFlash("Verteiler/Schacht konnte nicht angelegt werden", "error"); + $this->redirect("FiberPlanDispatcher"); + } + + if ($mode == "edit") { + $this->layout()->setFlash("Verteiler/Schacht erfolgreich geändert", "success"); + } else if ($mode = "add") { + $this->layout()->setFlash("Verteiler/Schacht erfolgreich angelegt", "success"); + } + $this->redirect("FiberPlanDispatcher"); + } + + + protected function deleteAction() + { + $id = $this->request->id; + $fiberplandispatcher = new FiberPlanDispatcher($id); + if (!$fiberplandispatcher->id || $fiberplandispatcher->id != $id) { + $this->layout()->setFlash("Verteiler/Schacht nicht gefunden.", "error"); + $this->redirect("FiberPlanDispatcher"); + } + + $fiberplandispatcher->delete(); + $this->redirect("FiberPlanDispatcher"); + } + +} \ No newline at end of file diff --git a/application/FiberPlanDispatcher/FiberPlanDispatcherModel.php b/application/FiberPlanDispatcher/FiberPlanDispatcherModel.php new file mode 100644 index 000000000..c3cef2a10 --- /dev/null +++ b/application/FiberPlanDispatcher/FiberPlanDispatcherModel.php @@ -0,0 +1,137 @@ + $value) { + if (property_exists(get_called_class(), $field)) { + if (substr($field, 0, 5) == "vlan_" && !$value) { + $model->$field = null; + continue; + } + $model->$field = $value; + } + } + + $me = mfValuecache::singleton()->get("me"); + if (!$me) { + $me = new User(); + $me->loadMe(); + mfValuecache::singleton()->set("me", $me); + } + + if ($model->create_by === null) { + $model->create_by = $me->id; + } + if ($model->edit_by === null) { + $model->edit_by = $me->id; + } + + return $model; + } + + public static function getOne($id) + { + if (!is_numeric($id) || !$id) { + throw new Exception("Invalid number", 400); + } + $item = []; + $db = FronkDB::singleton(); + + $res = $db->select("Devicetype", "*", "id=$id LIMIT 1"); + if ($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new Devicetype($data); + } + return $item; + } + + public static function getAll() + { + $items = []; + + $db = FronkDB::singleton(); + + $res = $db->select("FiberPlanDispatcher", "*", "1=1 ORDER BY network_id"); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new FiberPlanDispatcher($data); + } + } + return $items; + + } + + public static function getFirst() + { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("Devicetype", "*", "$where ORDER BY name, network_id"); + if ($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new Devicetype($data); + if ($item->id) { + return $item; + } else { + return null; + } + } + return null; + } + + public static function search($filter) + { + $items = []; + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("Devicetype", "*", "$where ORDER BY name, network_id"); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new Devicetype($data); + } + } + return $items; + } + + private static function getSqlFilter($filter) + { + $where = "1=1 "; + + //var_dump($filter);exit; + if (array_key_exists("network_id", $filter)) { + $networkid = $filter['network_id']; + if (is_numeric($networkid)) { + $where .= " AND network_id=$networkid"; + } + } + + //var_dump($filter, $where);exit; + return $where; + } + +} diff --git a/application/FiberPlanDispatchersleeve/FiberPlanDispatchersleeve.php b/application/FiberPlanDispatchersleeve/FiberPlanDispatchersleeve.php new file mode 100644 index 000000000..e9cd1f7c4 --- /dev/null +++ b/application/FiberPlanDispatchersleeve/FiberPlanDispatchersleeve.php @@ -0,0 +1,60 @@ +$name == null) { + + if (!$this->id) { + return null; + } + + if($name == "creator") { + $this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by); + if($this->creator === null) { + $this->creator = new User($this->create_by); + if($this->creator->id) { + mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator); + } + } + return $this->creator; + } + + if($name == "editor") { + $this->editor = mfValuecache::singleton()->get("Worker-id-".$this->edit_by); + if($this->editor === null) { + $this->editor = new User($this->edit_by); + if($this->editor->id) { + mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor); + } + } + return $this->editor; + } + + $classname = ucfirst($name); + $idfield = $name."_id"; + $this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield); + if(!$this->$name) { + $this->$name = new $classname($this->$idfield); + } + + if($this->$name->id) { + mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name); + return $this->$name; + } else { + return null; + } + + } + + return $this->$name; + } + +} \ No newline at end of file diff --git a/application/FiberPlanDispatchersleeve/FiberPlanDispatchersleeveController.php b/application/FiberPlanDispatchersleeve/FiberPlanDispatchersleeveController.php new file mode 100644 index 000000000..98e93e443 --- /dev/null +++ b/application/FiberPlanDispatchersleeve/FiberPlanDispatchersleeveController.php @@ -0,0 +1,127 @@ +needlogin = true; + $me = new User(); + $me->loadMe(); + $this->me = $me; + $this->layout()->set("me", $me); + + if (!$me->is(["Admin"])) { + $this->redirect("Dashboard"); + } + } + + protected function indexAction() + { + + $this->layout()->setTemplate("FiberPlanDispatchersleeve/Index"); + $fiberplandispatchersleeves = FiberPlanDispatchersleeveModel::getAll(); + $this->layout()->set("fiberplandispatchersleeves", $fiberplandispatchersleeves); + + } + + protected function addAction() + { + $fiberPlanDispatchers=FiberPlanDispatcherModel::getAll(); + $this->layout()->set("fiberPlanDispatchers", $fiberPlanDispatchers); + + $this->layout()->setTemplate("FiberPlanDispatchersleeve/Form"); + + } + + protected function editAction() + { + $id = $this->request->id; + + if (!is_numeric($id) || !$id) { + $this->layout()->setFlash("Muffen nicht gefunden", "error"); + $this->redirect("FiberPlanDispatchersleeve"); + } + + $fiberplandispatchersleeves = new FiberPlanDispatchersleeve($id); + if ($fiberplandispatchersleeves->id != $id) { + $this->layout()->setFlash("Muffen nicht gefunden", "error"); + $this->redirect("FiberPlanDispatchersleeve"); + } + + $this->layout()->set("fiberplandispatchersleeves", $fiberplandispatchersleeves); + return $this->addAction(); + } + + protected function saveAction() + { + $r = $this->request; + $id = $r->id; + //var_dump($r->get());exit; + if (is_numeric($id) && $id > 0) { + $mode = "edit"; + $fiberplandispatchersleeves = new FiberPlanDispatchersleeve($id); + if (!$fiberplandispatchersleeves->id) { + $this->layout()->setFlash("Muffe nicht gefunden", "error"); + $this->redirect("FiberPlanDispatchersleeve"); + } + } else { + $mode = "add"; + } + + $data = []; + $data['fiberPlanDispatcher_id'] = trim($r->fiberPlanDispatcher_id); + $data['name'] = trim($r->name); + + + if (!$data['fiberPlanDispatcher_id']) { + $data['fiberPlanDispatcher_id']=NULL; + } + if (!$data['name']) { + $data['name']=NULL; + } + + +// var_dump($_FILES); +// var_dump($upload); +// exit; + + + if ($mode == "edit") { + $fiberplandispatchersleeves->update($data); + + } else { + $fiberplandispatchersleeves = FiberPlanDispatchersleeveModel::create($data); + } +// var_dump($filestore); +// exit; + $id = $fiberplandispatchersleeves->save(); + + if (!$id) { + $this->layout()->setFlash("Muffen konnte nicht angelegt werden", "error"); + $this->redirect("FiberPlanDispatchersleeve"); + } + + if ($mode == "edit") { + $this->layout()->setFlash("Muffen erfolgreich geändert", "success"); + } else if ($mode = "add") { + $this->layout()->setFlash("Muffen erfolgreich angelegt", "success"); + } + $this->redirect("FiberPlanDispatchersleeve"); + } + + + protected function deleteAction() + { + $id = $this->request->id; + $fiberplandispatchersleeves = new FiberPlanDispatchersleeve($id); + if (!$fiberplandispatchersleeves->id || $fiberplandispatchersleeves->id != $id) { + $this->layout()->setFlash("Muffen nicht gefunden.", "error"); + $this->redirect("FiberPlanDispatchersleeve"); + } + + $fiberplandispatchersleeves->delete(); + $this->redirect("FiberPlanDispatchersleeve"); + } + +} diff --git a/application/FiberPlanDispatchersleeve/FiberPlanDispatchersleeveModel.php b/application/FiberPlanDispatchersleeve/FiberPlanDispatchersleeveModel.php new file mode 100644 index 000000000..f24f5f701 --- /dev/null +++ b/application/FiberPlanDispatchersleeve/FiberPlanDispatchersleeveModel.php @@ -0,0 +1,153 @@ + $value) { + if (property_exists(get_called_class(), $field)) { + if (substr($field, 0, 5) == "vlan_" && !$value) { + $model->$field = null; + continue; + } + $model->$field = $value; + } + } + + $me = mfValuecache::singleton()->get("me"); + if (!$me) { + $me = new User(); + $me->loadMe(); + mfValuecache::singleton()->set("me", $me); + } + + if ($model->create_by === null) { + $model->create_by = $me->id; + } + if ($model->edit_by === null) { + $model->edit_by = $me->id; + } + + return $model; + } + + public static function getOne($id) + { + if (!is_numeric($id) || !$id) { + throw new Exception("Invalid number", 400); + } + $item = []; + $db = FronkDB::singleton(); + + $res = $db->select("FiberPlanDispatchersleeve", "*", "id=$id LIMIT 1"); + if ($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new FiberPlanDispatchersleeve($data); + } + return $item; + } + + public static function getAll() + { + $items = []; + + $db = FronkDB::singleton(); + + $res = $db->select("FiberPlanDispatchersleeve", "*", "1=1"); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new FiberPlanDispatchersleeve($data); + } + } + return $items; + + } + + public static function getFirst() + { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("FiberPlanDispatchersleeve", "*", "$where "); + if ($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new FiberPlanDispatchersleeve($data); + if ($item->id) { + return $item; + } else { + return null; + } + } + return null; + } + + public static function search($filter) + { + $items = []; + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("FiberPlanDispatchersleeve", "*", "$where"); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new FiberPlanDispatchersleeve($data); + } + } + return $items; + } + + private static function getSqlFilter($filter) + { + $where = "1=1 "; + + //var_dump($filter);exit; + if (array_key_exists("network_id", $filter)) { + $networkid = $filter['network_id']; + if (is_numeric($networkid)) { + $where .= " AND network_id=$networkid"; + } + } + + //var_dump($filter, $where);exit; + return $where; + } + + public static function getAllbyDispatcher($dispatcher_id) + { + $items = []; + + $db = FronkDB::singleton(); + $sql = "SELECT `id`, `fiberPlanDispatcher_id`, `name` FROM `FiberPlanDispatchersleeve` + WHERE `fiberPlanDispatcher_id`='" . $dispatcher_id . "'"; + + $res = $db->query($sql); + if ($db->num_rows($res)) { + $oldrackid = ""; + $counter = -1; + while ($data = $db->fetch_array($res)) { + $items[] = $data; + } + return $items; + } + } + + public static function deletebyDispatcher($dispatcher_id) + { + $db = FronkDB::singleton(); + $sql = "DELETE FROM `FiberPlanDispatchersleeve` WHERE `fiberPlanDispatcher_id`='" . $dispatcher_id . "'"; + $db->query($sql); + } + + +} From e3f8c2326e67e4851893c653d6c9c3fea297e302 Mon Sep 17 00:00:00 2001 From: Spitzer Daniel Date: Tue, 16 Apr 2024 16:55:16 +0200 Subject: [PATCH 2/3] =?UTF-8?q?Faserplanung=20=20*=20Sch=C3=A4chte/Verteil?= =?UTF-8?q?er=20=20*=20Rohrplanung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Layout/default/FiberPlanPipe/Detail.php | 530 ++++++++++++++++++ Layout/default/FiberPlanPipe/Form.php | 469 ++++++++++++++++ Layout/default/FiberPlanPipe/Index.php | 259 +++++++++ application/FiberPlanPipe/FiberPlanPipe.php | 62 ++ .../FiberPlanPipe/FiberPlanPipeController.php | 281 ++++++++++ .../FiberPlanPipe/FiberPlanPipeModel.php | 376 +++++++++++++ .../FiberPlanPipeEndpoint.php | 64 +++ .../FiberPlanPipeEndpointController.php | 145 +++++ .../FiberPlanPipeEndpointModel.php | 129 +++++ .../FiberPlanPipeManufacturer.php | 42 ++ .../FiberPlanPipeManufacturerModel.php | 126 +++++ .../FiberPlanPipeTemplate.php | 43 ++ .../FiberPlanPipeTemplateModel.php | 127 +++++ .../20240416144500_fiber_plan_pipe.php | 50 ++ ...416144521_fiber_plan_pipe_manufacturer.php | 33 ++ ...0240416144535_fiber_plan_pipe_template.php | 34 ++ ...0240416144626_fiber_plan_pipe_endpoint.php | 36 ++ 17 files changed, 2806 insertions(+) create mode 100644 Layout/default/FiberPlanPipe/Detail.php create mode 100644 Layout/default/FiberPlanPipe/Form.php create mode 100644 Layout/default/FiberPlanPipe/Index.php create mode 100644 application/FiberPlanPipe/FiberPlanPipe.php create mode 100644 application/FiberPlanPipe/FiberPlanPipeController.php create mode 100644 application/FiberPlanPipe/FiberPlanPipeModel.php create mode 100644 application/FiberPlanPipeEndpoint/FiberPlanPipeEndpoint.php create mode 100644 application/FiberPlanPipeEndpoint/FiberPlanPipeEndpointController.php create mode 100644 application/FiberPlanPipeEndpoint/FiberPlanPipeEndpointModel.php create mode 100644 application/FiberPlanPipeManufacturer/FiberPlanPipeManufacturer.php create mode 100644 application/FiberPlanPipeManufacturer/FiberPlanPipeManufacturerModel.php create mode 100644 application/FiberPlanPipeTemplate/FiberPlanPipeTemplate.php create mode 100644 application/FiberPlanPipeTemplate/FiberPlanPipeTemplateModel.php create mode 100644 db/migrations/20240416144500_fiber_plan_pipe.php create mode 100644 db/migrations/20240416144521_fiber_plan_pipe_manufacturer.php create mode 100644 db/migrations/20240416144535_fiber_plan_pipe_template.php create mode 100644 db/migrations/20240416144626_fiber_plan_pipe_endpoint.php diff --git a/Layout/default/FiberPlanPipe/Detail.php b/Layout/default/FiberPlanPipe/Detail.php new file mode 100644 index 000000000..22a8a7c29 --- /dev/null +++ b/Layout/default/FiberPlanPipe/Detail.php @@ -0,0 +1,530 @@ + + + +id] = $pipworkeraddress->company; + +endforeach; + +foreach ($networks as $network): + $Network[$network->id] = $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 { + $responsible = "Person"; +} +if ($fiberplanpipes->type == "3") { + $name = ""; + if ($fiberplanpipes->fiberPlanPipeTemplate->pipe7x4 && $fiberplanpipes->fiberPlanPipeTemplate->pipe14x10) { + $name = $fiberplanpipes->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipes->fiberPlanPipeTemplate->pipe7x4 . "*7x4" . "/" . $fiberplanpipes->fiberPlanPipeTemplate->pipe14x10 . "*14x10"; + } else if ($fiberplanpipes->fiberPlanPipeTemplate->pipe7x4) { + $name = $fiberplanpipes->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipes->fiberPlanPipeTemplate->pipe7x4 . "*7x4"; + } else if ($fiberplanpipes->fiberPlanPipeTemplate->pipe14x10) { + $name = $fiberplanpipes->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipes->fiberPlanPipeTemplate->pipe14x10 . "*14x10"; + } + $typeDescription = $name; +// +} else { + $typeDescription = $dimension_v1Option[$fiberplanpipes->type_description]; +} + +?> + + +
+
+
+
+ +
+

Kabel: description ?> + + $fiberplanpipes->id, 'returnto' => "fiberplanpipe-detail"]) ?>"> + + +

+
+
+
+ +
+
+
+
+
+
+
+

Allgemeine Informationen

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Bezeichnungdescription ?>
GisIdgisid ?>
Länge (m) + length ?> Meter +
Netzgebiet (e)
Rohrtyptype] ?>
Rohrbezeichnung
+
+ + +
+ +
+
+

 

+
+ + + + + + + + + + + + + + + + + + + +
Statusstatus] ?>
Zuständig
Kontaktresponsible_text ?>
Bemerkungcomment) ?>
+
+
+ +
+
+ +
+ +
+
+

Schematische Darstellung +

+ +
+
+ pop_id) { + $endpointname = ' $endpoint->pop->id]) . '" target="_blank">' . $endpoint->pop->name . ''; + $endpointtype = "Pop"; + $gps_lat = $endpoint->pop->gps_lat; + $gps_long = $endpoint->pop->gps_long; + } elseif ($endpoint->fiberPlanDispatcher_id) { + $endpointname = $endpoint->fiberPlanDispatcher->description; + $endpointtype = $fiberplanpipestypes[$endpoint->fiberPlanDispatcher->object_type]; + $gps_lat = $endpoint->fiberPlanDispatcher->gps_lat; + $gps_long = $endpoint->fiberPlanDispatcher->gps_long; + } + $coordinates = ""; + if ($gps_lat) { + $coordinates = round($gps_lat, 5) . " , " . round($gps_long, 5); + $coordinates = '' . $coordinates . ''; + } + ?> + + + + + + + + + + + + + $gps_lat, + "gps_long" => $gps_long, + "name" => $endpointname, + ); + } + ?> +
+
+
+
+
+
+
+ $counter) : + ?> + + + + + + + + + + + + + + + + + +
fibers]['fibers']; ?>
+
+ +
+
+
+
+
+
+ + + + + \ No newline at end of file diff --git a/Layout/default/FiberPlanPipe/Form.php b/Layout/default/FiberPlanPipe/Form.php new file mode 100644 index 000000000..39b56b336 --- /dev/null +++ b/Layout/default/FiberPlanPipe/Form.php @@ -0,0 +1,469 @@ + + + +
+
+
+
+ +
+

id) ? "Rohrverzeichnis bearbeiten" : "Neuer Rohrverzeichnis" ?>

+
+
+
+ + $fiberplanpipes->id]); +} else { + $cancelUrl = self::getUrl("FiberPlanPipe"); +} +?> + +
+
+ +
+
+

id) ? "Rohrverzeichnis bearbeiten" : "Neuer Rohrverzeichnis" ?>

+ +
$_GET["returnto"]]) ?>"> +
+
+ +
+ +
+ +
+
+ +
+
+
+ +
+ +
+
+
"> + +
+ +
+
+
type) ? "display:none" : "" ?>"> + +
+ +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+
+ +
+ +
+
"> + +
+
+ + + +
+ +
+
+ +
+ +
+
+ +
+
+
+ +
+ + + + +
+
+ + +
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/Layout/default/FiberPlanPipe/Index.php b/Layout/default/FiberPlanPipe/Index.php new file mode 100644 index 000000000..5d7b844ae --- /dev/null +++ b/Layout/default/FiberPlanPipe/Index.php @@ -0,0 +1,259 @@ + + + +id] = $network->name; +} +foreach ($pipworkeraddresses as $pipworkeraddress) { + $Pipeworker[$pipworkeraddress->id] = $pipworkeraddress->company; +} +?> + + + + +
+
+
+
+ +
+

Rohrverzeichnisse

+
+
+
+ + + +
+
+
+
+
+

Liste aller Rohrverzeichnisse

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + type == "3") { + $name = ""; + if ($fiberplanpipe->fiberPlanPipeTemplate->pipe7x4 && $fiberplanpipe->fiberPlanPipeTemplate->pipe14x10) { + $name = $fiberplanpipe->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipe->fiberPlanPipeTemplate->pipe7x4 . "*7x4" . "/" . $fiberplanpipe->fiberPlanPipeTemplate->pipe14x10 . "*14x10"; + } else if ($fiberplanpipe->fiberPlanPipeTemplate->pipe7x4) { + $name = $fiberplanpipe->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipe->fiberPlanPipeTemplate->pipe7x4 . "*7x4"; + } else if ($fiberplanpipe->fiberPlanPipeTemplate->pipe14x10) { + $name = $fiberplanpipe->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipe->fiberPlanPipeTemplate->pipe14x10 . "*14x10"; + } + $typeDescription = $name; +// + } else { + $typeDescription = $dimension_v1Option[$fiberplanpipe->type_description]; + } + $startpoint = '' . $starting_pointOption[$fiberplanpipe->startpoint_type] . "/" . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['name'] . ''; + $endpoint = '' . $starting_pointOption[$fiberplanpipe->entpoint_type] . "/" . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['name'] . ''; + + $responsible = $responsibleOption[$fiberplanpipe->responsible]; + + if ($fiberplanpipe->address_id) { + $responsible .= " " . $Pipeworker[$fiberplanpipe->address_id]; + if ($fiberplanpipe->responsible_text) { + $responsible .= " (" . $fiberplanpipe->responsible_text . ")"; + } + } else { + $responsible .= " " . $fiberplanpipe->responsible_text; + } + if ($fiberplanpipe->startpoint_network_id == $fiberplanpipe->endpoint_network_id) { + $networkName = $Network[$fiberplanpipe->startpoint_network_id]; + } else { + $networkName = $Network[$fiberplanpipe->startpoint_network_id] . " / " . $Network[$fiberplanpipe->endpoint_network_id]; + } + ?> + + + + + + + + + + + + + + +
BezeichnungType/BezeichnungLänge (m)Netzgebiet(e)AnfangspunktEndpunktZuständigStatus
$fiberplanpipe->id]) ?>">description ?>type] . " / " . $typeDescription ?>length ?>status] ?> + $fiberplanpipe->id]) ?>"> + $fiberplanpipe->id]) ?>" + onclick="if(!confirm('Rohrverzeichnis wirklich löschen?')) return false;" + class="text-danger" + title="Löschen"> +
+ +
+
+ +
+ + + + + + + + + + \ No newline at end of file diff --git a/application/FiberPlanPipe/FiberPlanPipe.php b/application/FiberPlanPipe/FiberPlanPipe.php new file mode 100644 index 000000000..8aefdd859 --- /dev/null +++ b/application/FiberPlanPipe/FiberPlanPipe.php @@ -0,0 +1,62 @@ +$name == null) { + + if (!$this->id) { + return null; + } + + if($name == "creator") { + $this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by); + if($this->creator === null) { + $this->creator = new User($this->create_by); + if($this->creator->id) { + mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator); + } + } + return $this->creator; + } + + if($name == "editor") { + $this->editor = mfValuecache::singleton()->get("Worker-id-".$this->edit_by); + if($this->editor === null) { + $this->editor = new User($this->edit_by); + if($this->editor->id) { + mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor); + } + } + return $this->editor; + } + + $classname = ucfirst($name); + $idfield = $name."_id"; + $this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield); + if(!$this->$name) { + $this->$name = new $classname($this->$idfield); + } + + if($this->$name->id) { + mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name); + return $this->$name; + } else { + return null; + } + + } + + return $this->$name; + } + +} \ No newline at end of file diff --git a/application/FiberPlanPipe/FiberPlanPipeController.php b/application/FiberPlanPipe/FiberPlanPipeController.php new file mode 100644 index 000000000..e6bcd569a --- /dev/null +++ b/application/FiberPlanPipe/FiberPlanPipeController.php @@ -0,0 +1,281 @@ +needlogin = true; + $me = new User(); + $me->loadMe(); + $this->me = $me; + $this->layout()->set("me", $me); + + if (!$me->is(["Admin"])) { + $this->redirect("Dashboard"); + } + } + + 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); + $this->layout()->set("pipworkeraddresses", $pipworkeraddresses); + $this->layout()->set("fiberplanpipes", $fiberplanpipes); + + } + + protected function addAction() + { + $networks = NetworkModel::getAll(); + $fiberplanpipetemplates = FiberPlanPipeModel::getTemplates(); + $pipworkeraddresses = FiberPlanPipeModel::getPipeworkerAddresses(); + $this->layout()->set("networks", $networks); + $this->layout()->set("pipworkeraddresses", $pipworkeraddresses); + $this->layout()->set("fiberplanpipetemplates", $fiberplanpipetemplates); + + $this->layout()->setTemplate("FiberPlanPipe/Form"); + + } + + protected function apiAction() + { + $do = $this->request->do; + $network = $this->request->network_id; + $bdtype = $this->request->bdtype; + + + switch ($do) { + case "getBuildingInfo": + $return = $this->getBuildingInfo($network, $bdtype); + break; + case "getPops": + $return = $this->getPops($network); + break; + default: + $return = false; + } + + } + + 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"); + $this->redirect("FiberPlanPipe"); + } + $fiberplanpipes = new FiberPlanPipe($id); + if ($fiberplanpipes->id != $id) { + $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("pipworkeraddresses", $pipworkeraddresses); + $this->layout()->set("fiberplanpipeendpoints", $fiberplanpipeendpoints); + } + + protected function editAction() + { + $id = $this->request->id; + + if (!is_numeric($id) || !$id) { + $this->layout()->setFlash("Rohrverzeichnis nicht gefunden", "error"); + $this->redirect("FiberPlanPipe"); + } + + $fiberplanpipes = new FiberPlanPipe($id); + if ($fiberplanpipes->id != $id) { + $this->layout()->setFlash("Rohrverzeichnis nicht gefunden", "error"); + $this->redirect("FiberPlanPipe"); + } + $fiberplanpipeendpoints = FiberPlanPipeEndpointModel::search(['fiberPlanPipe_id' => $id]); + $this->layout()->set("fiberplanpipeendpoints", $fiberplanpipeendpoints); + $this->layout()->set("fiberplanpipes", $fiberplanpipes); + return $this->addAction(); + } + + protected function saveAction() + { + $r = $this->request; + $id = $r->id; + var_dump($r->get()); + die(); + if (is_numeric($id) && $id > 0) { + $mode = "edit"; + $fiberplanpipes = new FiberPlanPipe($id); + if (!$fiberplanpipes->id) { + $this->layout()->setFlash("Rohrverzeichnisse nicht gefunden", "error"); + $this->redirect("FiberPlanPipe"); + } + } else { + $mode = "add"; + } + + $data = []; + $data['description'] = trim($r->description); + $data['gisid'] = trim($r->gisid); + $data['type'] = trim($r->type); + $data['type_description'] = trim($r->type_description); + $data['fiberplanpipetemplate_id'] = trim($r->fiberplanpipetemplate_id); + $data['length'] = trim($r->length); + $data['status'] = trim($r->status); + $data['responsible'] = trim($r->responsible); + $data['responsible_text'] = trim($r->responsible_text); + $data['address_id'] = trim($r->address_id); + $data['comment'] = trim($r->comment); + + $returnUrl = "FiberPlanPipe"; + $returnAction = "Index"; + $returnVariables = array(); + $returnAnker = ""; + if ($this->request->returnto) { + + if (strpos($this->request->returnto, "-") !== false) { + $urls = explode('-', $this->request->returnto); + $urlCounter = 0; + $returnUrlGen = ""; + foreach ($urls as $url) { + if ($urlCounter > 0) { + $returnUrlGen .= "/"; + $returnUrlGen .= ucfirst($url); + } else { + $returnUrlGen .= 'FiberPlanPipe'; + } + $urlCounter++; + } + $returnAction = ""; + $returnVariables['id'] = $id; + $returnUrl = $returnUrlGen; + } else { + $returnUrl = ucfirst($this->request->returnto); + + } + } + if (!$data['description']) { + $this->layout()->setFlash("Bezeichnung darf nicht leer sein", "error"); + $this->redirect("FiberPlanPipe"); + } + if (!$data['type']) { + $data['type'] = NULL; + } + if (!$data['gisid']) { + $data['gisid'] = NULL; + } + if (!$data['responsible_text']) { + $data['responsible_text'] = NULL; + } + if (!$data['address_id']) { + $data['address_id'] = NULL; + } + if (!$data['type_description']) { + $data['type_description'] = NULL; + } + if (!$data['fiberplanpipetemplate_id']) { + $data['fiberplanpipetemplate_id'] = NULL; + } + if (!$data['length']) { + $data['length'] = NULL; + } + if (!$data['startpoint']) { + $data['startpoint'] = NULL; + } + if (!$data['endpoint']) { + $data['endpoint'] = NULL; + } + if (!$data['status']) { + $data['status'] = NULL; + } + if (!$data['responsible']) { + $data['responsible'] = NULL; + } + if (!$data['comment']) { + $data['comment'] = NULL; + } + + +// var_dump($_FILES); +// var_dump($upload); +// exit; + + + if ($mode == "edit") { + $fiberplanpipes->update($data); + + } else { + $fiberplanpipes = FiberPlanPipeModel::create($data); + } +// var_dump($filestore); +// exit; + $id = $fiberplanpipes->save(); + + $endpoint_id = $r->endpointid; + $endpoint_type = $r->endpoint_type; + $endpoint = $r->endpoint; + + if (!empty($endpoint)) { + $counter = 1; + foreach ($endpoint as $key => $Endpoint) { + if ($endpoint_type[$key] == 4) { + $endpointarray['fiberPlanDispatcher_id'] = $Endpoint; + } else if ($endpoint_type[$key] == 2) { + $endpointarray['pop_id'] = $Endpoint; + } + $endpointarray['fiberPlanPipe_id'] = $id; + $endpointarray['sort'] = $counter; + if ($endpoint_id[$key]) { + $fiberplanpipeendpoint = new FiberPlanPipeEndpoint($id); + $fiberplanpipeendpoint->update($endpointarray); + } else { + $fiberplanpipeendpoint = FiberPlanPipeEndpointModel::create($endpointarray); + } + $fiberplanpipeendpoint->save(); + $counter++; + } + } + + + if (!$id) { + $this->layout()->setFlash("Rohrverzeichnis konnte nicht angelegt werden", "error"); + $this->redirect($returnUrl, $returnAction, $returnVariables, $returnAnker); + } + + if ($mode == "edit") { + $this->layout()->setFlash("Rohrverzeichnis erfolgreich geändert", "success"); + } else if ($mode = "add") { + $this->layout()->setFlash("Rohrverzeichnis erfolgreich angelegt", "success"); + } + $this->redirect($returnUrl, $returnAction, $returnVariables, $returnAnker); + } + + + protected function deleteAction() + { + $id = $this->request->id; + $fiberplanpipes = new FiberPlanPipe($id); + if (!$fiberplanpipes->id || $fiberplanpipes->id != $id) { + $this->layout()->setFlash("Rohrverzeichnis nicht gefunden.", "error"); + $this->redirect("FiberPlanPipe"); + } + + $fiberplanpipes->delete(); + $this->redirect("FiberPlanPipe"); + } + + protected function getBuildingInfo($network, $bdtype) + { + FiberPlanPipeModel::getBuildingInfo($network, $bdtype); + } +} diff --git a/application/FiberPlanPipe/FiberPlanPipeModel.php b/application/FiberPlanPipe/FiberPlanPipeModel.php new file mode 100644 index 000000000..42736fb78 --- /dev/null +++ b/application/FiberPlanPipe/FiberPlanPipeModel.php @@ -0,0 +1,376 @@ + "MR7", 2 => "MR14", 3 => "MR16", 4 => "MR20", 5 => "PE32", 6 => "PE40", 7 => "PE50", 8 => "KSR50", 9 => "KSR80", 10 => "KSR100"); + public static $type_definition = array(1 => "Enzel", 2 => "Schutzrohr", 3 => "Verband"); + + public static function find($data) + { + + } + + public static function create(array $data) + { + $model = new FiberPlanPipe(); + + foreach ($data as $field => $value) { + if (property_exists(get_called_class(), $field)) { + if (substr($field, 0, 5) == "vlan_" && !$value) { + $model->$field = null; + continue; + } + $model->$field = $value; + } + } + + $me = mfValuecache::singleton()->get("me"); + if (!$me) { + $me = new User(); + $me->loadMe(); + mfValuecache::singleton()->set("me", $me); + } + + if ($model->create_by === null) { + $model->create_by = $me->id; + } + if ($model->edit_by === null) { + $model->edit_by = $me->id; + } + + return $model; + } + + public static function getOne($id) + { + if (!is_numeric($id) || !$id) { + throw new Exception("Invalid number", 400); + } + $item = []; + $db = FronkDB::singleton(); + + $res = $db->select("FiberPlanPipe", "*", "id=$id LIMIT 1"); + if ($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new FiberPlanPipe($data); + } + return $item; + } + + public static function getAll() + { + $items = []; + + $db = FronkDB::singleton(); + + $res = $db->select("FiberPlanPipe", "*", "1=1"); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new FiberPlanPipe($data); + } + } + return $items; + + } + + public static function getAllPipeManufacturer() + { + $items = []; + + $db = FronkDB::singleton(); + + $res = $db->select("FiberPlanPipeManufacturer", "*", "1=1"); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new FiberPlanPipe($data); + } + } + return $items; + + } + + public static function getAllPipe() + { + $items = []; + $db = FronkDB::singleton(); + $sql = "SELECT `FiberPlanPipe`.`id`,`FiberPlanPipe`.`description`,`FiberPlanPipe`.`type`,`FiberPlanPipe`.`type_description`,`FiberPlanPipe`.`startpoint_network_id`, `FiberPlanPipe`.`endpoint_network_id`,`FiberPlanPipeTemplate`. `fiberPlanPipeManufacturer_id`,`FiberPlanPipeTemplate`.`pipe7x4`,`FiberPlanPipeTemplate`.`pipe14x10` FROM `FiberPlanPipe` +LEFT JOIN `FiberPlanPipeTemplate` ON `FiberPlanPipe`.`fiberPlanPipeTemplate_id`=`FiberPlanPipeTemplate`.id"; + $res = $db->query($sql); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new FiberPlanPipe($data); + } + } + return $items; + + + } + + + public static function getFirst() + { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("FiberPlanPipe", "*", "$where "); + if ($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new FiberPlanPipe($data); + if ($item->id) { + return $item; + } else { + return null; + } + } + return null; + } + + public static function search($filter) + { + $items = []; + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("FiberPlanPipe", "*", "$where"); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new FiberPlanPipe($data); + } + } + return $items; + } + + private static function getSqlFilter($filter) + { + $where = "1=1 "; + + //var_dump($filter);exit; + if (array_key_exists("network_id", $filter)) { + $networkid = $filter['network_id']; + if (is_numeric($networkid)) { + $where .= " AND network_id=$networkid"; + } + } + + //var_dump($filter, $where);exit; + return $where; + } + + public static function getTemplates() + { + $items = []; + $db = FronkDB::singleton(); + $sql = "SELECT `FiberPlanPipeTemplate`.id,FiberPlanPipeTemplate.pipe7x4,FiberPlanPipeTemplate.pipe14x10,FiberPlanPipeManufacturer.name FROM `FiberPlanPipeTemplate` INNER JOIN FiberPlanPipeManufacturer ON FiberPlanPipeManufacturer.id=FiberPlanPipeTemplate.fiberPlanPipeManufacturer_id "; + $res = $db->query($sql); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new FiberPlanPipe($data); + } + } + return $items; + + } + + public static function getPipeworkerAddresses() + { + $items = []; + $db = FronkDB::singleton(); + $sql = "SELECT `Addresstype`.`id`,`Address`.`company` FROM `Addresstype` +INNER JOIN `Address` ON (`Address`.`id`=`Addresstype`.`address_id`) + WHERE `type` = 'pipeworker' ORDER by `Address`.`company` "; + $res = $db->query($sql); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new FiberPlanPipe($data); + } + } + return $items; + + } + + public static function getBuildingInfo($network, $bdtype, $api = 1) + { + $items = []; + $db = FronkDB::singleton(); + if ($bdtype == "1") { + $sql = "SELECT `id`,`description` `name` FROM `FiberPlanDispatcher` WHERE network_id='" . $network . "' AND `object_type`='3' "; + } else if ($bdtype == "2") { + $sql = "SELECT `Pop`.`id`,`Pop`.`name` 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"; + } else if ($bdtype == "4") { + $sql = "SELECT `id`,`description` `name` FROM `FiberPlanDispatcher` WHERE network_id='" . $network . "' AND (`object_type`='1' OR `object_type`='2') "; + } + + $res = $db->query($sql); + + if ($db->num_rows($res)) { + $counter = 0; + while ($data = $db->fetch_array($res)) { + $items[$counter]['id'] = $data['id']; + if ($bdtype == "3") { + $items[$counter]['name'] = $data['street'] . " " . $data['zip'] . " " . $data['city']; + } else { + $items[$counter]['name'] = $data['name']; + } + $counter++; + } + } + if ($api === 1) { + echo json_encode($items); + exit; + } else { + return $items; + } + } + + public static function getBuildingInfoAll() + { + $items = []; + $db = FronkDB::singleton(); + $sql = "SELECT `id`, `fiberPlanDispatcher_id`, `name` FROM `FiberPlanDispatchersleeve` ORDER by id"; + $res = $db->query($sql); + if ($db->num_rows($res)) { + while ($data = $db->fetch_array($res)) { + $sleeves[$data['fiberPlanDispatcher_id']][$data['id']] = $data['name']; + } + } + + $sql = "SELECT '1' as `type`,'Greenfield' as `typename`,`id`,`description` as `name`,`gps_lat`,`gps_long` FROM `FiberPlanDispatcher` WHERE `object_type`='3' + UNION + SELECT '2' as `type`,'Pop' as `typename`,`id`,`name`,`gps_lat`,`gps_long` FROM `Pop` + UNION + SELECT '3' as `type`,'Building' as `typename`,`id`,CONCAT_WS(' ',`street`, `zip`, `city`) as name,`gps_lat`,`gps_long` FROM Building + UNION + SELECT '4' as `type`,'Schacht-Verteiler' as `typename`,`id`,`description` as `name`,`gps_lat`,`gps_long` FROM `FiberPlanDispatcher` WHERE (`object_type`='1' OR `object_type`='2')"; + $res = $db->query($sql); + if ($db->num_rows($res)) { + while ($data = $db->fetch_array($res)) { + $items[$data['type']][$data['id']] = $data; + if ($data['type'] == 4) { + $items[$data['type']][$data['id']]['sleeves'] = $sleeves[$data['id']]; + } + } + } + return $items; + + } + + public static function generateEndpoints($endpoints, $networks) + { + + foreach ($networks as $network) { + $Network[$network->id] = $network->name; + } + $counter = 1; + $endpointuparrow = ""; + $typeArray[1] = 'Greenfield'; + $typeArray[2] = 'POP'; + $typeArray[3] = 'Building'; + $typeArray[4] = 'Schacht-Verteiler'; + +// print_r($buildings); + $counter = 1; + foreach ($endpoints as $Endpoint) { + + if ($Endpoint->pop_id) { + $networkid = $Endpoint->pop->network_id; + $endpointid = $Endpoint->pop->id; + $endpointtype = 2; + } else if ($Endpoint->fiberPlanDispatcher_id) { + $networkid = $Endpoint->fiberPlanDispatcher->network_id; + $endpointid = $Endpoint->fiberPlanDispatcher->id; + if ($Endpoint->fiberPlanDispatcher->object_type == 3) { + $endpointtype = 1; + } else { + $endpointtype = 4; + } + } else if ($Endpoint->building_id) { + $networkid = $Endpoint->building->network_id; + $endpointid = $Endpoint->building->id; + $endpointtype = 3; + } + $randid = rand(1000, 10000); + if ($counter > 1) { + $Endpointuparrow = ''; + } + if ($counter == 1) { + $endpointType = "Startpunkt"; + $endpointsymbol = ''; + } + else if (count($endpoints)==2) + { + $endpointcount = $counter - 1; + $endpointType = "Standort " . $endpointcount; + $endpointsymbol=''; + } + else { + $endpointcount = $counter - 1; + $endpointType = "Standort " . $endpointcount; + $endpointsymbol = ''; + } + $html = '
+ +
+
+
+
+
'; + echo $html; + $counter++; + } + + } + +} diff --git a/application/FiberPlanPipeEndpoint/FiberPlanPipeEndpoint.php b/application/FiberPlanPipeEndpoint/FiberPlanPipeEndpoint.php new file mode 100644 index 000000000..7229b9b7b --- /dev/null +++ b/application/FiberPlanPipeEndpoint/FiberPlanPipeEndpoint.php @@ -0,0 +1,64 @@ +$name == null) { + + if (!$this->id) { + return null; + } + + if ($name == "creator") { + $this->creator = mfValuecache::singleton()->get("Worker-id-" . $this->create_by); + if ($this->creator === null) { + $this->creator = new User($this->create_by); + if ($this->creator->id) { + mfValuecache::singleton()->set("Worker-id-" . $this->create_by, $this->creator); + } + } + return $this->creator; + } + + if ($name == "editor") { + $this->editor = mfValuecache::singleton()->get("Worker-id-" . $this->edit_by); + if ($this->editor === null) { + $this->editor = new User($this->edit_by); + if ($this->editor->id) { + mfValuecache::singleton()->set("Worker-id-" . $this->edit_by, $this->editor); + } + } + return $this->editor; + } + + $classname = ucfirst($name); + $idfield = $name . "_id"; + $this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-" . $this->$idfield); + if (!$this->$name) { + $this->$name = new $classname($this->$idfield); + } + + if ($this->$name->id) { + mfValuecache::singleton()->set("mfObjectmodel-$name-" . $this->$name->id, $this->$name); + return $this->$name; + } else { + return null; + } + + } + + return $this->$name; +} + +} \ No newline at end of file diff --git a/application/FiberPlanPipeEndpoint/FiberPlanPipeEndpointController.php b/application/FiberPlanPipeEndpoint/FiberPlanPipeEndpointController.php new file mode 100644 index 000000000..a72e4d5bf --- /dev/null +++ b/application/FiberPlanPipeEndpoint/FiberPlanPipeEndpointController.php @@ -0,0 +1,145 @@ +needlogin = true; + $me = new User(); + $me->loadMe(); + $this->me = $me; + $this->layout()->set("me", $me); + + if (!$me->is(["Admin"])) { + $this->redirect("Dashboard"); + } + } + + protected function indexAction() + { + + $this->layout()->setTemplate("FiberPlanPipeEndpoint/Index"); + $fiberplanpipeendpoints = FiberPlanPipeEndpointModel::getAll(); + $this->layout()->set("fiberplanpipeendpoints", $fiberplanpipeendpoints); + + } + + protected function addAction() + { + $fiberPlanPipes=FiberPlanPipeModel::getAll(); + $this->layout()->set("fiberPlanPipes", $fiberPlanPipes); + $pops=PopModel::getAll(); + $this->layout()->set("pops", $pops); + $fiberPlanDispatchers=FiberPlanDispatcherModel::getAll(); + $this->layout()->set("fiberPlanDispatchers", $fiberPlanDispatchers); + $buildings=BuildingModel::getAll(); + $this->layout()->set("buildings", $buildings); + + $this->layout()->setTemplate("FiberPlanPipeEndpoint/Form"); + + } + + protected function editAction() + { + $id = $this->request->id; + + if (!is_numeric($id) || !$id) { + $this->layout()->setFlash("dfsdf nicht gefunden", "error"); + $this->redirect("FiberPlanPipeEndpoint"); + } + + $fiberplanpipeendpoints = new FiberPlanPipeEndpoint($id); + if ($fiberplanpipeendpoints->id != $id) { + $this->layout()->setFlash("dfsdf nicht gefunden", "error"); + $this->redirect("FiberPlanPipeEndpoint"); + } + + $this->layout()->set("fiberplanpipeendpoints", $fiberplanpipeendpoints); + return $this->addAction(); + } + + protected function saveAction() + { + $r = $this->request; + $id = $r->id; + //var_dump($r->get());exit; + if (is_numeric($id) && $id > 0) { + $mode = "edit"; + $fiberplanpipeendpoints = new FiberPlanPipeEndpoint($id); + if (!$fiberplanpipeendpoints->id) { + $this->layout()->setFlash("sdfsdf nicht gefunden", "error"); + $this->redirect("FiberPlanPipeEndpoint"); + } + } else { + $mode = "add"; + } + + $data = []; + $data['fiberPlanPipe_id'] = trim($r->fiberPlanPipe_id); + $data['pop_id'] = trim($r->pop_id); + $data['fiberPlanDispatcher_id'] = trim($r->fiberPlanDispatcher_id); + $data['building_id'] = trim($r->building_id); + $data['sort'] = trim($r->sort); + + + if (!$data['fiberPlanPipe_id']) { + $data['fiberPlanPipe_id']=NULL; + } + if (!$data['pop_id']) { + $data['pop_id']=NULL; + } + if (!$data['fiberPlanDispatcher_id']) { + $data['fiberPlanDispatcher_id']=NULL; + } + if (!$data['building_id']) { + $data['building_id']=NULL; + } + if (!$data['sort']) { + $data['sort']=NULL; + } + + +// var_dump($_FILES); +// var_dump($upload); +// exit; + + + if ($mode == "edit") { + $fiberplanpipeendpoints->update($data); + + } else { + $fiberplanpipeendpoints = FiberPlanPipeEndpointModel::create($data); + } +// var_dump($filestore); +// exit; + $id = $fiberplanpipeendpoints->save(); + + if (!$id) { + $this->layout()->setFlash("dfsdf konnte nicht angelegt werden", "error"); + $this->redirect("FiberPlanPipeEndpoint"); + } + + if ($mode == "edit") { + $this->layout()->setFlash("dfsdf erfolgreich geändert", "success"); + } else if ($mode = "add") { + $this->layout()->setFlash("dfsdf erfolgreich angelegt", "success"); + } + $this->redirect("FiberPlanPipeEndpoint"); + } + + + protected function deleteAction() + { + $id = $this->request->id; + $fiberplanpipeendpoints = new FiberPlanPipeEndpoint($id); + if (!$fiberplanpipeendpoints->id || $fiberplanpipeendpoints->id != $id) { + $this->layout()->setFlash("dfsdf nicht gefunden.", "error"); + $this->redirect("FiberPlanPipeEndpoint"); + } + + $fiberplanpipeendpoints->delete(); + $this->redirect("FiberPlanPipeEndpoint"); + } + +} diff --git a/application/FiberPlanPipeEndpoint/FiberPlanPipeEndpointModel.php b/application/FiberPlanPipeEndpoint/FiberPlanPipeEndpointModel.php new file mode 100644 index 000000000..7cfee1593 --- /dev/null +++ b/application/FiberPlanPipeEndpoint/FiberPlanPipeEndpointModel.php @@ -0,0 +1,129 @@ + $value) { + if (property_exists(get_called_class(), $field)) { + if (substr($field, 0, 5) == "vlan_" && !$value) { + $model->$field = null; + continue; + } + $model->$field = $value; + } + } + + $me = mfValuecache::singleton()->get("me"); + if (!$me) { + $me = new User(); + $me->loadMe(); + mfValuecache::singleton()->set("me", $me); + } + + if ($model->create_by === null) { + $model->create_by = $me->id; + } + if ($model->edit_by === null) { + $model->edit_by = $me->id; + } + + return $model; + } + + public static function getOne($id) + { + if (!is_numeric($id) || !$id) { + throw new Exception("Invalid number", 400); + } + $item = []; + $db = FronkDB::singleton(); + + $res = $db->select("FiberPlanPipeEndpoint", "*", "id=$id LIMIT 1"); + if ($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new FiberPlanPipeEndpoint($data); + } + return $item; + } + + public static function getAll() + { + $items = []; + + $db = FronkDB::singleton(); + + $res = $db->select("FiberPlanPipeEndpoint", "*", "1=1"); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new FiberPlanPipeEndpoint($data); + } + } + return $items; + + } + + public static function getFirst() + { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("FiberPlanPipeEndpoint", "*", "$where "); + if ($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new FiberPlanPipeEndpoint($data); + if ($item->id) { + return $item; + } else { + return null; + } + } + return null; + } + + public static function search($filter) + { + $items = []; + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("FiberPlanPipeEndpoint", "*", "$where ORDER by sort"); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new FiberPlanPipeEndpoint($data); + } + } + return $items; + } + + private static function getSqlFilter($filter) + { + $where = "1=1 "; + + //var_dump($filter);exit; + if (array_key_exists("fiberPlanPipe_id", $filter)) { + $fiberPlanPipe_id = $filter['fiberPlanPipe_id']; + if (is_numeric($fiberPlanPipe_id)) { + $where .= " AND fiberPlanPipe_id=$fiberPlanPipe_id"; + } + } + + //var_dump($filter, $where);exit; + return $where; + } + +} diff --git a/application/FiberPlanPipeManufacturer/FiberPlanPipeManufacturer.php b/application/FiberPlanPipeManufacturer/FiberPlanPipeManufacturer.php new file mode 100644 index 000000000..83cdb68e6 --- /dev/null +++ b/application/FiberPlanPipeManufacturer/FiberPlanPipeManufacturer.php @@ -0,0 +1,42 @@ +$name == null) { + + if (!$this->id) { + return null; + } + + if ($name == "creator") { + $this->creator = new User($this->create_by); + return $this->creator; + } + + if ($name == "editor") { + $this->editor = new User($this->edit_by); + return $this->editor; + } + + $classname = ucfirst($name); + $idfield = $name . "_id"; + $this->$name = new $classname($this->$idfield); + + if ($this->$name->id) { + return $this->$name; + } else { + return null; + } + } + + return $this->$name; + } + +} \ No newline at end of file diff --git a/application/FiberPlanPipeManufacturer/FiberPlanPipeManufacturerModel.php b/application/FiberPlanPipeManufacturer/FiberPlanPipeManufacturerModel.php new file mode 100644 index 000000000..09556f05f --- /dev/null +++ b/application/FiberPlanPipeManufacturer/FiberPlanPipeManufacturerModel.php @@ -0,0 +1,126 @@ + $value) { + if (property_exists(get_called_class(), $field)) { + if (substr($field, 0, 5) == "vlan_" && !$value) { + $model->$field = null; + continue; + } + $model->$field = $value; + } + } + + $me = mfValuecache::singleton()->get("me"); + if (!$me) { + $me = new User(); + $me->loadMe(); + mfValuecache::singleton()->set("me", $me); + } + + if ($model->create_by === null) { + $model->create_by = $me->id; + } + if ($model->edit_by === null) { + $model->edit_by = $me->id; + } + + return $model; + } + + public static function getOne($id) + { + if (!is_numeric($id) || !$id) { + throw new Exception("Invalid number", 400); + } + $item = []; + $db = FronkDB::singleton(); + + $res = $db->select("FiberPlanPipeManufacturer", "*", "id=$id LIMIT 1"); + if ($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new FiberPlanPipeManufacturer($data); + } + return $item; + } + + public static function getAll() + { + $items = []; + + $db = FronkDB::singleton(); + + $res = $db->select("FiberPlanPipeManufacturer", "*", "1=1"); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new FiberPlanPipeManufacturer($data); + } + } + return $items; + + } + + public static function getFirst() + { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("FiberPlanPipeManufacturer", "*", "$where "); + if ($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new FiberPlanPipeManufacturer($data); + if ($item->id) { + return $item; + } else { + return null; + } + } + return null; + } + + public static function search($filter) + { + $items = []; + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("FiberPlanPipeManufacturer", "*", "$where"); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new FiberPlanPipeManufacturer($data); + } + } + return $items; + } + + private static function getSqlFilter($filter) + { + $where = "1=1 "; + + //var_dump($filter);exit; + if (array_key_exists("network_id", $filter)) { + $networkid = $filter['network_id']; + if (is_numeric($networkid)) { + $where .= " AND network_id=$networkid"; + } + } + + //var_dump($filter, $where);exit; + return $where; + } + +} diff --git a/application/FiberPlanPipeTemplate/FiberPlanPipeTemplate.php b/application/FiberPlanPipeTemplate/FiberPlanPipeTemplate.php new file mode 100644 index 000000000..d85308607 --- /dev/null +++ b/application/FiberPlanPipeTemplate/FiberPlanPipeTemplate.php @@ -0,0 +1,43 @@ +$name == null) { + + if (!$this->id) { + return null; + } + + if ($name == "creator") { + $this->creator = new User($this->create_by); + return $this->creator; + } + + if ($name == "editor") { + $this->editor = new User($this->edit_by); + return $this->editor; + } + + $classname = ucfirst($name); + $idfield = $name . "_id"; + $this->$name = new $classname($this->$idfield); + + if ($this->$name->id) { + return $this->$name; + } else { + return null; + } + } + + return $this->$name; + } + +} \ No newline at end of file diff --git a/application/FiberPlanPipeTemplate/FiberPlanPipeTemplateModel.php b/application/FiberPlanPipeTemplate/FiberPlanPipeTemplateModel.php new file mode 100644 index 000000000..fec7e6ae4 --- /dev/null +++ b/application/FiberPlanPipeTemplate/FiberPlanPipeTemplateModel.php @@ -0,0 +1,127 @@ + $value) { + if (property_exists(get_called_class(), $field)) { + if (substr($field, 0, 5) == "vlan_" && !$value) { + $model->$field = null; + continue; + } + $model->$field = $value; + } + } + + $me = mfValuecache::singleton()->get("me"); + if (!$me) { + $me = new User(); + $me->loadMe(); + mfValuecache::singleton()->set("me", $me); + } + + if ($model->create_by === null) { + $model->create_by = $me->id; + } + if ($model->edit_by === null) { + $model->edit_by = $me->id; + } + + return $model; + } + + public static function getOne($id) + { + if (!is_numeric($id) || !$id) { + throw new Exception("Invalid number", 400); + } + $item = []; + $db = FronkDB::singleton(); + + $res = $db->select("FiberPlanPipeTemplate", "*", "id=$id LIMIT 1"); + if ($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new FiberPlanPipeTemplate($data); + } + return $item; + } + + public static function getAll() + { + $items = []; + + $db = FronkDB::singleton(); + + $res = $db->select("FiberPlanPipeTemplate", "*", "1=1"); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new FiberPlanPipeTemplate($data); + } + } + return $items; + + } + + public static function getFirst() + { + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("FiberPlanPipeTemplate", "*", "$where "); + if ($db->num_rows($res)) { + $data = $db->fetch_object($res); + $item = new FiberPlanPipeTemplate($data); + if ($item->id) { + return $item; + } else { + return null; + } + } + return null; + } + + public static function search($filter) + { + $items = []; + $db = FronkDB::singleton(); + + $where = self::getSqlFilter($filter); + $res = $db->select("FiberPlanPipeTemplate", "*", "$where"); + if ($db->num_rows($res)) { + while ($data = $db->fetch_object($res)) { + $items[] = new FiberPlanPipeTemplate($data); + } + } + return $items; + } + + private static function getSqlFilter($filter) + { + $where = "1=1 "; + + //var_dump($filter);exit; + if (array_key_exists("network_id", $filter)) { + $networkid = $filter['network_id']; + if (is_numeric($networkid)) { + $where .= " AND network_id=$networkid"; + } + } + + //var_dump($filter, $where);exit; + return $where; + } + +} diff --git a/db/migrations/20240416144500_fiber_plan_pipe.php b/db/migrations/20240416144500_fiber_plan_pipe.php new file mode 100644 index 000000000..d05660684 --- /dev/null +++ b/db/migrations/20240416144500_fiber_plan_pipe.php @@ -0,0 +1,50 @@ +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("startpoint_type", "integer", ["null" => false]); + $table->addColumn("startpoint_network_id", "integer", ["null" => false]); + $table->addColumn("startpoint", "integer", ["null" => false]); + $table->addColumn("midpoint", "text", ["null" => true]); + $table->addColumn("entpoint_type", "integer", ["null" => false]); + $table->addColumn("endpoint_network_id", "integer", ["null" => false]); + $table->addColumn("endpoint", "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") { + } + } +} \ No newline at end of file diff --git a/db/migrations/20240416144521_fiber_plan_pipe_manufacturer.php b/db/migrations/20240416144521_fiber_plan_pipe_manufacturer.php new file mode 100644 index 000000000..a25203848 --- /dev/null +++ b/db/migrations/20240416144521_fiber_plan_pipe_manufacturer.php @@ -0,0 +1,33 @@ +getEnvironment() == "thetool") { + $table = $this->table("FiberPlanPipeManufacturer", ["signed" => true]); + $table->addColumn("name", "string", ["null" => false]); + $table->addColumn("colors", "text", ["null" => true]); + $table->addColumn("create_by", "integer", ["null" => false]); + $table->addColumn("edit_by", "integer", ["null" => false]); + $table->addColumn("create", "integer", ["null" => false]); + $table->addColumn("edit", "integer", ["null" => false]); + $table->save(); + } + + if ($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void + { + if ($this->getEnvironment() == "thetool") { + $this->table("FiberPlanPipeManufacturer")->drop()->save(); + } + if ($this->getEnvironment() == "addressdb") { + } + } +} \ No newline at end of file diff --git a/db/migrations/20240416144535_fiber_plan_pipe_template.php b/db/migrations/20240416144535_fiber_plan_pipe_template.php new file mode 100644 index 000000000..2360807b6 --- /dev/null +++ b/db/migrations/20240416144535_fiber_plan_pipe_template.php @@ -0,0 +1,34 @@ +getEnvironment() == "thetool") { + $table = $this->table("FiberPlanPipeTemplate", ["signed" => true]); + $table->addColumn("fiberPlanPipeManufacturer_id", "integer", ["null" => false]); + $table->addColumn("pipe7x4", "integer", ["null" => true]); + $table->addColumn("pipe14x10", "integer", ["null" => true]); + $table->addColumn("create_by", "integer", ["null" => false]); + $table->addColumn("edit_by", "integer", ["null" => false]); + $table->addColumn("create", "integer", ["null" => false]); + $table->addColumn("edit", "integer", ["null" => false]); + $table->save(); + } + + if ($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void + { + if ($this->getEnvironment() == "thetool") { + $this->table("FiberPlanPipeTemplate")->drop()->save(); + } + if ($this->getEnvironment() == "addressdb") { + } + } +} \ No newline at end of file diff --git a/db/migrations/20240416144626_fiber_plan_pipe_endpoint.php b/db/migrations/20240416144626_fiber_plan_pipe_endpoint.php new file mode 100644 index 000000000..e78a3196e --- /dev/null +++ b/db/migrations/20240416144626_fiber_plan_pipe_endpoint.php @@ -0,0 +1,36 @@ +getEnvironment() == "thetool") { + $table = $this->table("FiberPlanPipeEndpoint", ["signed" => true]); + $table->addColumn("fiberPlanPipe_id", "integer", ["null" => false]); + $table->addColumn("pop_id", "integer", ["null" => true]); + $table->addColumn("fiberPlanDispatcher_id", "integer", ["null" => true]); + $table->addColumn("building_id", "integer", ["null" => true]); + $table->addColumn("sort", "integer", ["null" => false]); + $table->addColumn("create_by", "integer", ["null" => false]); + $table->addColumn("edit_by", "integer", ["null" => false]); + $table->addColumn("create", "integer", ["null" => false]); + $table->addColumn("edit", "integer", ["null" => false]); + $table->save(); + } + + if ($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void + { + if ($this->getEnvironment() == "thetool") { + $this->table("FiberPlanPipeEndpoint")->drop()->save(); + } + if ($this->getEnvironment() == "addressdb") { + } + } +} \ No newline at end of file From 8a8eb60377868ba2f370cc92d24e772b399d9be1 Mon Sep 17 00:00:00 2001 From: Spitzer Daniel Date: Tue, 16 Apr 2024 16:57:26 +0200 Subject: [PATCH 3/3] =?UTF-8?q?Faserplanung=20=20*=20Sch=C3=A4chte/Verteil?= =?UTF-8?q?er=20=20*=20Rohrplanung=20=20*=20Menufreischaltung=20=20*=20Mig?= =?UTF-8?q?rations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Layout/default/menu.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Layout/default/menu.php b/Layout/default/menu.php index d9abd36ee..b80205db0 100644 --- a/Layout/default/menu.php +++ b/Layout/default/menu.php @@ -98,9 +98,9 @@ is(["Admin","netowner","lineplanner","lineworker"]) && $me->can("Linework")): ?>
  • "> Leitungsbau
  • is(["Admin","netowner","netoperator","lineworker"]) && $me->can("Patching")): ?>
  • "> Patchungen
  • is(["Admin","netowner","pipeplanner","lineplanner","pipeworker","netoperator","lineworker"]) && $me->can("Filestore")): ?>
  • "> Dateiablage
  • -is(["Admin","netowner","pipeplanner","pipeplanner"]) && $me->is("employee")): ?> -is(["Admin","netowner","lineplanner","lineworker"]) && $me->is("employee")): ?> -is(["Admin","netowner","lineplanner","lineworker"]) && $me->is("employee")): ?> + is(["Admin","netowner","pipeplanner","pipeplanner"]) && $me->is("employee")): ?>
  • "> Verteiler und Schächte
  • + is(["Admin","netowner","lineplanner","lineworker"]) && $me->is("employee")): ?>
  • "> Rohrverzeichnis
  • +is(["Admin","netowner","lineplanner","lineworker"]) && $me->is("employee")): ?>