Faserplanung

* Rohrplanung Updates
 * Migrations
This commit is contained in:
Spitzer Daniel
2024-04-23 17:09:36 +02:00
parent 1db1d583da
commit 6310e2446e
12 changed files with 613 additions and 375 deletions

View File

@@ -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++;
}
}