Merge branch 'spidev' into 'master'

Faserplanung

See merge request fronk/thetool!334
This commit is contained in:
Frank Schubert
2024-04-16 14:58:44 +00:00
26 changed files with 3893 additions and 3 deletions

View File

@@ -0,0 +1,244 @@
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<li class="breadcrumb-item"><a
href="<?= self::getUrl("FiberPlanDispatcher") ?>">Verteiler/Schächte</a></li>
<li class="breadcrumb-item active"><?= ($fiberplandispatchers->id) ? "bearbeiten" : "Neu" ?></li>
</ol>
</div>
<h4 class="page-title"><?= ($fiberplandispatchers->id) ? "Verteiler/Schacht bearbeiten" : "Neuer Verteiler/Schacht" ?></h4>
</div>
</div>
</div>
<!-- end page title -->
<?php
if (!$me->permissions->isAdmin) {
foreach ($networkaddresses as $networkaddress) {
if ($me->address->id == $networkaddress->address_id) {
$allowedNetworks[$networkaddress->network_id] = "ok";
}
}
}
?>
<style>
.fa-circle-plus {
color: #00b125;
cursor: pointer;
font-size: 17px;
margin-left: 5px;
}
.remove-sleeve {
cursor: pointer;
color: #ff0606;
font-size: 17px;
margin-left: 5px;
}
</style>
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<h4 class="header-title mb-2"><?= ($fiberplandispatchers->id) ? "Verteiler/Schacht bearbeiten" : "Neuer Verteiler/Schacht" ?></h4>
<div class="col-12">
<form class="form-horizontal" method="post"
action="<?= self::getUrl("FiberPlanDispatcher", "save") ?>">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-6">
<input type="hidden" name="id" value="<?= $fiberplandispatchers->id ?>"/>
<div class="form-group row">
<label class="col-lg-4 col-form-label" for="network_id">Netzgebiet
*</label>
<div class="col-lg-5">
<select class="select2 form-control "
name="network_id" id="network_id">
<option value="">&nbsp;</option>
<?php foreach ($networks as $key => $network):
if (!$me->permissions->isAdmin) {
if (!array_key_exists($network->id, $allowedNetworks)) {
continue;
}
}
?>
<option value="<?= $network->id ?>" <?= ($fiberplandispatchers->network_id == $network->id) ? "selected='selected'" : "" ?>><?= ($network->name) ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-4 col-form-label" for="gps_lat">Beschreibung
*</label>
<div class="col-lg-4">
<input type="text" required="required" step="any"
class="form-control" name="description" id="description"
value="<?= $fiberplandispatchers->description ?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-4 col-form-label" for="object_type">Objekt Typ
*</label>
<div class="col-lg-4">
<select class="select2 form-control" required="required"
name="object_type" id="object_type">
<option value="1" <?= ($fiberplandispatchers->object_type == '1') ? "selected='selected'" : "" ?>>
Verteiler
</option>
<option value="2" <?= ($fiberplandispatchers->object_type == '2') ? "selected='selected'" : "" ?>>
Schacht
</option>
<option value="3" <?= ($fiberplandispatchers->object_type == '3') ? "selected='selected'" : "" ?>>
Greenfield
</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-4 col-form-label" for="type">Typ</label>
<div class="col-lg-4">
<textarea id="type" name="type"
class="form-control"><?= $fiberplandispatchers->type ?></textarea>
</div>
</div>
<div class="form-group row">
<label class="col-lg-4 col-form-label" for="gps_lat">GPS
Breite/Länge</label>
<div class="col-lg-3">
<input type="number" step="any" class="form-control" name="gps_lat"
id="gps_lat" placeholder="GPS Breite"
value="<?= $fiberplandispatchers->gps_lat ?>">
</div>
<div class="col-lg-3">
<input type="number" step="any" class="form-control" name="gps_long"
id="gps_long" placeholder="GPS Länge"
value="<?= $fiberplandispatchers->gps_long ?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-4 col-form-label" for="comment">Kommentar</label>
<div class="col-lg-5">
<textarea id="comment" name="comment"
class="form-control"><?= $fiberplandispatchers->comment ?></textarea>
</div>
</div>
</div>
<div id="sleeves-main" class="col-6" <?= ($fiberplandispatchers->object_type == 2) ? "" : 'style="display:none"' ?>>
<div class="row">
<h4>Muffe(n) <i class="fa-regular fa-circle-plus add-sleeve"></i>
</h4>
</div>
<div id="sleeves-div">
<?php
if ($sleeves):
foreach ($sleeves as $sleeve) : ?>
<div class="form-group row">
<label class="col-lg-3 col-form-label"
>Muffe <i data-popid="5"
class="fa-regular fa-circle-minus remove-sleeve"></i></label>
<div class="col-lg-4">
<input type="text" required="required" step="any"
class="form-control" name="sleeves[]"
value="<?= $sleeve['name']; ?>">
</div>
</div>
<?php
endforeach;
endif;
?>
</div>
</div>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2"></label>
<div class="col-lg-10">
<button type="submit" class="btn btn-primary">Speichern</button>
<a href="<?= self::getUrl("FiberPlanDispatcher") ?>">
<button type="button" class="btn btn-secondary">Abbrechen</button>
</a>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$("#network_id").select2({placeholder: ""});
$("#object_type").select2();
// disable mousewheel on a input number field when in focus
$('form').on('focus', 'input[type=number]', function (e) {
$(this).on('wheel.disableScroll', function (e) {
e.preventDefault()
})
});
$('form').on('blur', 'input[type=number]', function (e) {
$(this).off('wheel.disableScroll')
});
$(document).ready(function () {
$("body").on("click", ".remove-sleeve", function () {
$(this).closest('.form-group').remove();
});
$("body").on("change", "#object_type", function (){
if ($(this).val()=="2")
{
$('#sleeves-main').show()
}
else
{
$('#sleeves-main').hide()
$('#sleeves-div').empty()
}
});
$("body").on("click", ".add-sleeve", function () {
if ($('#sleeves-div').find('.form-group').length < 5) {
$('#sleeves-div').append(`<div class="form-group row">
<label class="col-lg-3 col-form-label"
>Muffe <i data-popid="5" class="fa-regular fa-circle-minus remove-sleeve"></i></label>
<div class="col-lg-4">
<input type="text" required="required" step="any"
class="form-control" name="sleeves[]"
value="">
</div>
</div>`);
}
})
})
;
</script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -0,0 +1,122 @@
<?php
$objecttype[1] = 'Verteiler';
$objecttype[2] = 'Schacht';
$objecttype[3] = 'Greenfield';
?>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<li class="breadcrumb-item active">Verteiler und Schächte</li>
</ol>
</div>
<h4 class="page-title">Verteiler und Schächte</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="card">
<div class="card-body mb-3">
<div class="row">
<div class="col-12">
<div class="float-left">
<h4 class="header-title">Liste aller Verteiler und Schächte</h4>
</div>
<div class="float-right">
<a class="btn btn-primary mb-2" href="<?= self::getUrl("FiberPlanDispatcher", "add") ?>"><i
class="fas fa-plus"></i> Neuen Verteiler/Schacht anlegen</a>
</div>
</div>
</div>
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
<table id="datatable" class="table table-striped table-hover table-sm">
<thead>
<tr>
<th class="text-center">Netzgebiet</th>
<th class="text-center">Beschreibung</th>
<th class="text-center">Objektart</th>
<th class="text-center">Type</th>
<th class="text-center">Koordinaten</th>
<th class="text-center">Kommentar</th>
<th class="edit-weight"></th>
</tr>
<tr id="filterrow">
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<thead>
<tbody>
<?php foreach ($fiberplandispatchers as $fiberplandispatcher): ?>
<?php
if ($fiberplandispatcher->gps_lat) {
$mapslink = '<a
title="Google-Maps: ' . $fiberplandispatcher->gps_lat . ' , ' . $fiberplandispatcher->gps_long . '"
class="mapsLink"
href="http://maps.google.com/?q=' . $fiberplandispatcher->gps_lat . ' , ' . $fiberplandispatcher->gps_long . '"
target="_blank">' . rtrim($fiberplandispatcher->gps_lat, 0) . ' , ' . rtrim($fiberplandispatcher->gps_long, 0) . '</a>';
} else {
$mapslink = 'N/A';
}
?>
<tr>
<td><?= $fiberplandispatcher->network->name ?></td>
<td><?= $fiberplandispatcher->description ?></td>
<td class="text-center"><?= $objecttype[$fiberplandispatcher->object_type] ?></td>
<td class="text-left"><?= nl2br($fiberplandispatcher->type) ?></td>
<td class="text-center"><?= $mapslink ?></td>
<td class="text-left"><?= nl2br($fiberplandispatcher->comment) ?></td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?= self::getUrl("FiberPlanDispatcher", "edit", ["id" => $fiberplandispatcher->id]) ?>"><i
class="far fa-edit" title="Bearbeiten"></i></a>
<a href="<?= self::getUrl("FiberPlanDispatcher", "delete", ["id" => $fiberplandispatcher->id]) ?>"
onclick="if(!confirm('Verteiler/Schacht wirklich löschen?')) return false;"
class="text-danger"
title="Löschen"><i class="fas fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var hidesearch = [6];
$(document).ready(function () {
});
</script>
<script type="text/javascript"
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -0,0 +1,530 @@
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<?php
$markers = [];
$typeOption[1] = "Einzel";
$typeOption[2] = "Schutzrohr";
$typeOption[3] = "Verband";
$starting_pointOption[1] = "Greenfield";
$starting_pointOption[2] = "POP";
$starting_pointOption[3] = "Building";
$starting_pointOption[4] = "Schacht-Verteiler";
$fiberplanpipestypes[1] = "Verteiler";
$fiberplanpipestypes[2] = "Schacht";
$fiberplanpipestypes[3] = "Greenfield";
$fiberplanpipestypes[4] = "Abzweigepunkt";
$dimension_v1Option[1] = "MR7";
$dimension_v1Option[2] = "MR14";
$dimension_v1Option[3] = "MR16";
$dimension_v1Option[4] = "MR20";
$dimension_v1Option[5] = "PE32";
$dimension_v1Option[6] = "PE40";
$dimension_v1Option[7] = "PE50";
$dimension_v1Option[8] = "KSR50";
$dimension_v1Option[9] = "KSR80";
$dimension_v1Option[10] = "KSR100";
$dimension_v2Option[1] = "Anzahl";
$dimension_v2Option[2] = "Dimenson";
$dimension_v2Option[3] = "Farben";
$state[10] = 'Geplant';
$state[20] = 'Umsetzung';
$state[30] = 'Fertiggestellt';
foreach ($pipworkeraddresses as $pipworkeraddress):
$Pipeworkers[$pipworkeraddress->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];
}
?>
<style>
#map {
height: 600px;
width: 100%;
}
.card-border {
border-left: 1px solid #428bca;
border-left-width: 5px;
border-radius: 3px;
}
.fiber-rack-div {
margin-top: 5px;
margin-bottom: 5px;
}
.fiber-color {
color: #0d6efd;
float: right;
margin-left: 5px;
}
.fiber-module-div {
padding-left: 5px;
padding-right: 5px;
margin-left: 5px;
margin-right: 5px;
margin-bottom: 5px;
border: 1px solid #e3e3e3;
}
.sp-border-rl {
padding-left: 5px;
padding-right: 5px;
}
.sp-table-border {
border: 1px solid #bfbfbf;
border-radius: 10px;
display: inline;
}
.sp-table-border > tbody {
padding: 10px;
}
.sp-table-border > thead td {
padding: 10px 0px 0px 0px;
font-weight: bold;
text-align: center;
font-size: 20px;
}
.sp-port-lines {
width: 50px;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
#olt-splitter td {
height: 30px;
width: 150px;
border: 1px solid #bfbfbf;
margin-top: 15px;
display: block;
border-radius: 5px;
}
#olt-splitter-table thead {
padding: 10px 0px 0px 0px;
font-weight: bold;
font-size: 20px;
}
#olt-splitter-table thead td {
padding-top: 12px;
text-align: center;
}
.sp-splitter-count {
padding: 3px 10px 3px 10px;
width: 50px;
}
.sp-splitter-count-left {
padding: 3px 0px 3px 10px;
width: 50px;
}
.sp-splitter-count-right {
padding: 3px 10px 3px 0px;
width: 50px;
text-align: right;
}
.sp-splitter-count-edit {
-ms-user-select: None;
-moz-user-select: None;
-webkit-user-select: None;
user-select: None;
cursor: pointer;
}
.sp-splitter-count-show {
width: 46px;
display: inline-block;
text-align: center;
cursor: pointer;
text-decoration: underline;
padding-top: 2px;
-ms-user-select: None;
-moz-user-select: None;
-webkit-user-select: None;
user-select: None;
}
.sp-white-border {
border-color: #fff !important;
}
.sp-ont-text {
padding: 0px 5px 0px 5px;
}
.fa-circle-check {
color: #07ad2b;
}
.fa-circle-xmark {
color: #ff0000;
}
.fa-rotate-right {
color: #0d6efd;
cursor: pointer;
}
.ont-refresh-span, .ontdetail-refresh-span {
display: inline-block;
width: 20px;
margin-right: 50px;
min-height: 1px;
color: #0d6efd;
}
.text-decoration-underline {
text-decoration: underline;
cursor: pointer;
}
.condensed-ont th {
padding: 6px 0.85rem 6px 0.85rem !important;
}
.condensed-ont td {
padding: 6px 0.85rem 6px 0.85rem !important;
}
</style>
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<li class="breadcrumb-item"><a href="<?= self::getUrl("FiberPlanPipe") ?>">Rohrverzeichnis</a>
</li>
<li class="breadcrumb-item active">Kabelverzeichnis Detail</li>
</ol>
</div>
<h4 class="page-title">Kabel: <span
class="font-weight-normal ml-1"><?= $fiberplanpipes->description ?></span>
<span class="ml-2">
<a href="<?= self::getUrl("FiberPlanPipe", "edit", ["id" => $fiberplanpipes->id, 'returnto' => "fiberplanpipe-detail"]) ?>">
<button class="btn btn-primary">Bearbeiten</button>
</a>
</span></h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-4 card-border">
<div>
<h4>Allgemeine Informationen </h4>
</div>
<div>
<table class="table table-sm">
<tbody>
<tr>
<th class="w-50">Bezeichnung</th>
<td><?= $fiberplanpipes->description ?> </td>
</tr>
<tr>
<th>GisId</th>
<td><?= $fiberplanpipes->gisid ?> </td>
</tr>
<tr>
<th>Länge (m)</th>
<td>
<?= $fiberplanpipes->length ?> Meter
</td>
</tr>
<tr>
<th>Netzgebiet (e)</th>
<td><?= implode(', ', $allNetworks) ?> </td>
</tr>
<tr>
<th>Rohrtyp</th>
<td><?= $typeOption[$fiberplanpipes->type] ?></td>
</tr>
<tr>
<th>Rohrbezeichnung</th>
<td><?= $typeDescription ?> </td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-4 ">
<div>
<h4>&nbsp;</h4>
</div>
<table class="table table-sm">
<tbody>
<tr>
<th>Status</th>
<td><?= $state[$fiberplanpipes->status] ?> </td>
</tr>
<tr>
<th>Zuständig</th>
<td><?= $responsible ?> </td>
</tr>
<tr>
<th>Kontakt</th>
<td><?= $fiberplanpipes->responsible_text ?> </td>
</tr>
<tr>
<th>Bemerkung</th>
<td><?= nl2br($fiberplanpipes->comment) ?> </td>
</tr>
</tbody>
</table>
</div>
<div class="col-3 ">
</div>
</div>
<div class="row pb-3 pt-4 ">
<div class="col-12 text-center card-border">
<div>
<h4 class="text-left mb-3">Schematische Darstellung <i data-toggle="modal"
data-target="#pipemap"
class="fa-duotone fa-map-location-dot font-24"
style="--fa-primary-color: #fa0000; --fa-secondary-color: #232423;margin-left:5px;cursor:pointer"></i>
</h4>
</div>
<div class="ml-2">
<?php
if ($fiberplanpipeendpoints) :
$endpointcounter = count($fiberplanpipeendpoints);
$counter = 1;
foreach ($fiberplanpipeendpoints as $endpoint):
if ($endpoint->pop_id) {
$endpointname = '<a href="' . self::getUrl("Pop", "Detail", ["id" => $endpoint->pop->id]) . '" target="_blank">' . $endpoint->pop->name . '</a>';
$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 = '<a title="Google-Maps: ' . $coordinates . '" class="mapsLink" href="http://maps.google.com/?q=' . $coordinates . '" target="_blank">' . $coordinates . '</a>';
}
?>
<table class="sp-table-border float-left border-collapse: collapse;"
style="min-height: 150px;">
<thead style="display: inline;">
<tr>
<th colspan="3"
class="text-center font-15">
<div class="pt-2 pl-2 pr-2"><?= $endpointtype; ?></div>
</th>
</tr>
<tr>
<th colspan="3"
class="text-center font-15">
<div class="pl-2 pr-2"><?= $endpointname; ?></div>
</th>
</tr>
<tr>
<th colspan="3"
class="text-center font-13">
<div class="pb-2 pl-2 pr-2"><?= $coordinates ?></div>
</th>
</tr>
</thead>
<?php
if ($gps_lat) {
$markers[] = array(
"gps_lat" => $gps_lat,
"gps_long" => $gps_long,
"name" => $endpointname,
);
}
?>
</table>
<?php
if ($endpointcounter > $counter) :
?>
<table id="olt-port-table" class="float-left" style="width: 100px">
<thead>
<tr>
<td style="height:40px;"></td>
</tr>
</thead>
<tbody id="olt-ports">
<tr>
<td data-oltport="0"
class="font-13"><?= $fibers[$fiberplancables->fibers]['fibers']; ?></td>
</tr>
<tr>
<td data-oltport="0" class="sp-port-lines"
style="width: 70px; background-color: <?= $pipecolor; ?> ;height: <?= $pipeheight; ?>;"></td>
</tr>
<tr>
<td data-oltport="0" class="font-13"><?= $pipesub; ?>
</td>
</tr>
</tbody>
</table>
<?php
endif;
$counter++;
endforeach;
endif;
?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="pipemap" tabindex="-1" role="dialog" aria-labelledby="pipemap"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="pipemapLabel">Rohrverzeichnis</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div id="map"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Schließen</button>
</div>
</div>
</div>
</div>
<?php if ($markers) :
?>
<script type="text/javascript">
var marker;
var polylinec;
var polyline;
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19
}).addTo(map);
L.MakiMarkers.accessToken = '<?=TT_MAPBOX_TILE_API_TOKEN?>';
$(document).ready(function () {
var locations = [<?php
$counter = 0;
$lat = 0;
$long = 0;
foreach ($markers as $marker):
if ($counter > 0) echo ',';
?>
['<?= $marker['name'] ?>', <?= $marker['gps_lat'] ?>, <?= $marker['gps_long'] ?>]
<?php
$lat = $lat + $marker['gps_lat'];
$long = $long + $marker['gps_long'];
$counter++;
endforeach;
$lat = $lat / $counter;
$long = $long / $counter;
?>
];
var startlat = <?=$lat ?>;
var startlong = <?=$long ?>;
console.log('<?=$lat . " " . $long ?>')
$('#pipemap').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
map.remove();
map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19
}).addTo(map);
var icon_name = "town";
var icon_color = "#ec98a2";
var icon = L.MakiMarkers.icon({icon: icon_name, color: icon_color, size: "l"});
var oldlat;
var oldlong;
map.setView([startlat, startlong], 14)
for (var i = 0; i < locations.length; i++) {
marker = new L.marker([locations[i][1], locations[i][2]]).addTo(map)
.bindPopup(locations[i][0]);
if (oldlong) {
polylinec = [
[oldlat, oldlong],
[locations[i][1], locations[i][2]]
];
polyline = L.polyline(polylinec, {color: 'red'}).addTo(map);
polyline = null;
console.log(polylinec);
}
oldlong = locations[i][2];
oldlat = locations[i][1];
}
});
$('#pipemap').on('shown.bs.modal', function (event) {
map.invalidateSize();
});
});
</script>
<?php endif; ?>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -0,0 +1,469 @@
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<li class="breadcrumb-item"><a
href="<?= self::getUrl("FiberPlanPipe") ?>">Rohrverzeichnisse</a></li>
<li class="breadcrumb-item active"><?= ($fiberplanpipes->id) ? "bearbeiten" : "Neu" ?></li>
</ol>
</div>
<h4 class="page-title"><?= ($fiberplanpipes->id) ? "Rohrverzeichnis bearbeiten" : "Neuer Rohrverzeichnis" ?></h4>
</div>
</div>
</div>
<style>
.fa-circle-plus {
color: #00b125;
cursor: pointer;
font-size: 17px;
float: right;
}
.remove-endpoint {
cursor: pointer;
color: #ff0606;
font-size: 17px;
float: right;
margin-left: 7px;
}
.fa-up {
color: #0d6efd;
font-size: 17px;
cursor: pointer;
float: right;
margin-left: 10px;
}
</style>
<?php
if (isset($_GET['returnto']) && $_GET['returnto'] == "fiberplanpipe-detail") {
$cancelUrl = self::getUrl("FiberPlanPipe", "Detail", ["id" => $fiberplanpipes->id]);
} else {
$cancelUrl = self::getUrl("FiberPlanPipe");
}
?>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<h4 class="header-title mb-2"><?= ($fiberplanpipes->id) ? "Rohrverzeichnis bearbeiten" : "Neuer Rohrverzeichnis" ?></h4>
<form class="form-horizontal" method="post"
action="<?= self::getUrl("FiberPlanPipe", "save", ["returnto" => $_GET["returnto"]]) ?>">
<div class="card">
<div class="card-body">
<input type="hidden" name="id" value="<?= $fiberplanpipes->id ?>"/>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="description">Bezeichnung * / Gis
Id</label>
<div class="col-lg-2">
<input required="required" type="text" id="description" name="description"
class="form-control"
value="<?= $fiberplanpipes->description ?>"/>
</div>
<div class="col-lg-1">
<input type="text" id="gisid" name="gisid" placeholder="Gis Id"
class="form-control"
value="<?= $fiberplanpipes->gisid ?>"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="type">Type *</label>
<div class="col-lg-3">
<select required="required" id="type" name="type" class="select2 form-control">
<option value=""></option>
<option value="1" <?= ($fiberplanpipes->type == "1") ? "selected='selected'" : "" ?>>
Einzel
</option>
<option value="2" <?= ($fiberplanpipes->type == "2") ? "selected='selected'" : "" ?>>
Schutzrohr
</option>
<option value="3" <?= ($fiberplanpipes->type == "3") ? "selected='selected'" : "" ?>>
Verband
</option>
</select>
</div>
</div>
<div class="form-group row" id="dimesion-div"
style="<?= ($fiberplanpipes->type == "3") ? "display:none" : "" ?>">
<label class="col-lg-2 col-form-label" for="type_description">Dimension *</label>
<div class="col-lg-3">
<select required="required" <?= ($fiberplanpipes->type == "3") ? 'disabled="disabled"' : "" ?>
id="type_description" name="type_description"
class="select2 form-control">
<option value=""></option>
<option value="1" <?= ($fiberplanpipes->type_description == "1") ? "selected='selected'" : "" ?>>
MR7
</option>
<option value="2" <?= ($fiberplanpipes->type_description == "2") ? "selected='selected'" : "" ?>>
MR14
</option>
<option value="3" <?= ($fiberplanpipes->type_description == "3") ? "selected='selected'" : "" ?>>
MR16
</option>
<option value="4" <?= ($fiberplanpipes->type_description == "4") ? "selected='selected'" : "" ?>>
MR20
</option>
<option value="5" <?= ($fiberplanpipes->type_description == "5") ? "selected='selected'" : "" ?>>
PE32
</option>
<option value="6" <?= ($fiberplanpipes->type_description == "6") ? "selected='selected'" : "" ?>>
PE40
</option>
<option value="7" <?= ($fiberplanpipes->type_description == "7") ? "selected='selected'" : "" ?>>
PE50
</option>
<option value="8" <?= ($fiberplanpipes->type_description == "8") ? "selected='selected'" : "" ?>>
KSR50
</option>
<option value="9" <?= ($fiberplanpipes->type_description == "9") ? "selected='selected'" : "" ?>>
KSR80
</option>
<option value="10" <?= ($fiberplanpipes->type_description == "10") ? "selected='selected'" : "" ?>>
KSR100
</option>
</select>
</div>
</div>
<div class="form-group row" id="dimension-bundle-div"
style="<?= ($fiberplanpipes->type < "3" || !$fiberplanpipes->type) ? "display:none" : "" ?>">
<label class="col-lg-2 col-form-label" for="fiberplanpipetemplate_id">Multirohr
*</label>
<div class="col-lg-3">
<select <?= ($fiberplanpipes->type < "3" || !$fiberplanpipes->type) ? 'disabled="disabled"' : "" ?>
required="required" id="fiberplanpipetemplate_id"
name="fiberplanpipetemplate_id"
class="select2 form-control">
<option value=""></option>
<?php foreach ($fiberplanpipetemplates as $fiberplanpipetemplate) :
$name = "";
if ($fiberplanpipetemplate->pipe7x4 && $fiberplanpipetemplate->pipe14x10) {
$name = $fiberplanpipetemplate->name . " " . $fiberplanpipetemplate->pipe7x4 . "*7x4" . "/" . $fiberplanpipetemplate->pipe14x10 . "*14x10";
} else if ($fiberplanpipetemplate->pipe7x4) {
$name = $fiberplanpipetemplate->name . " " . $fiberplanpipetemplate->pipe7x4 . "*7x4";
} else if ($fiberplanpipetemplate->pipe14x10) {
$name = $fiberplanpipetemplate->name . " " . $fiberplanpipetemplate->pipe14x10 . "*14x10";
}
?>
<option <?= ($fiberplanpipetemplate->id == $fiberplanpipes->fiberPlanPipeTemplate_id) ? "selected='selected'" : "" ?>
value="<?= $fiberplanpipetemplate->id ?>"><?= $name ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="length">Länge (m) *</label>
<div class="col-lg-1">
<input required="required" type="number" step="any" id="length" name="length"
class="form-control"
value="<?= $fiberplanpipes->length ?>"/>
</div>
</div>
<div id="endpoints">
<?php if ($fiberplanpipeendpoints) :
FiberPlanPipeModel::generateEndpoints($fiberplanpipeendpoints, $networks);
endif;
?>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="status">Status *</label>
<div class="col-lg-2">
<select id="status" name="status" class="select2 form-control"
required="required">
<option value=""></option>
<option value="10" <?= ($fiberplanpipes->status == "10") ? "selected='selected'" : "" ?>>
Geplant
</option>
<option value="20" <?= ($fiberplanpipes->status == "20") ? "selected='selected'" : "" ?>>
Umsetzung
</option>
<option value="30" <?= ($fiberplanpipes->status == "30") ? "selected='selected'" : "" ?>>
Fertiggestellt
</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="responsible">Zuständig</label>
<div class="col-lg-2">
<select id="responsible" name="responsible" class="select2 form-control">
<option value=""></option>
<option value="1" <?= ($fiberplanpipes->responsible == "1") ? "selected='selected'" : "" ?>>
Tiefbaufirma
</option>
<option value="2" <?= ($fiberplanpipes->responsible == "2") ? "selected='selected'" : "" ?>>
Person
</option>
</select>
</div>
<div id="responsible-div" class="col-lg-3"
style="<?= ($fiberplanpipes->responsible != "1") ? "display:none" : "" ?>">
<select id="address_id" name="address_id"
class="select2 form-control" <?= ($fiberplanpipes->responsible != "1") ? 'disabled="disabled"' : "" ?> >
<option value=""></option>
<?php foreach ($pipworkeraddresses as $pipworkeraddress): ?>
<option value="<?= $pipworkeraddress->id ?>" <?= ($fiberplanpipes->address_id == $pipworkeraddress->id) ? "selected='selected'" : "" ?>><?= $pipworkeraddress->company ?></option>
<?php endforeach; ?>
</select>
</div>
<div id="responsible_text-div" class="col-lg-3">
<input id="responsible_text" name="responsible_text"
value="<?= $fiberplanpipes->responsible_text ?>"
placeholder="Ansprechsperson"
class="form-control"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="comment">Kommentar</label>
<div class="col-lg-3">
<textarea id="comment" name="comment"
class="form-control"><?= $fiberplanpipes->comment ?></textarea>
</div>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2"></label>
<div class="col-lg-10">
<button type="submit" class="btn btn-primary">Speichern</button>
<a href="<?= $cancelUrl ?>">
<button type="button" class="btn btn-secondary">Abbrechen</button>
</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function checkendpoints() {
let endpointcounter = $('.endpoint-label').length;
let endpointtext;
$('.endpoint-label').each(function (index) {
$(this).find('.move-endpoint-up').remove();
if (index == 0) {
endpointtext = "Startpunkt";
$(this).find('.endpointsymbol').html('<i id="add-endpoint" class="fa-regular fa-circle-plus"></i>');
} else if (endpointcounter == 2) {
endpointtext = 'Standort ' + index;
$(this).closest('.endpoint-maindiv').find('.label-text').after('<i title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>');
$(this).find('.endpointsymbol').html('');
} else if (index > 0) {
endpointtext = 'Standort ' + index;
$(this).closest('.endpoint-maindiv').find('.label-text').after('<i title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>');
$(this).find('.endpointsymbol').html('<i class="fa-regular fa-circle-minus remove-endpoint"></i>');
}
$(this).find('.label-text').text(endpointtext + ' *');
});
}
$("body").on("change", ".endpoint_type,.endpoint_network_id ", function () {
const splitid = $(this).attr('id').split('_');
let thisid = splitid[0];
var options;
if ($.trim($("#" + thisid + "_endpoint_network_id").val()) != "" && $.trim($("#" + thisid + "_endpoint_type").val())) {
$.getJSON("<?= self::getUrl("FiberPlanPipe", "api", ['do' => 'getBuildingInfo']) ?>&network_id=" + $.trim($("#" + thisid + "_endpoint_network_id").val()) + "&bdtype=" + $.trim($("#" + thisid + "_endpoint_type").val()), {})
.done(function (data) {
$.each(data, function (k, val) {
options = options + '<option value="' + val.id + '">' + val.name + '</option>';
});
$("#" + thisid + "_mid-point-building").empty();
$("#" + thisid + "_mid-point-building").append('<select id=' + thisid + '_endpoint" required="required" name="endpoint[]" class="select2 form-control">' + options + '</select>');
$(".select2").select2({placeholder: ""});
});
}
});
$("body").on("click", ".move-endpoint-up", function () {
$(this).closest('.endpoint-maindiv').insertBefore($(this).closest('.endpoint-maindiv').prev());
checkendpoints();
});
$("body").on("click", ".remove-endpoint", function () {
let endpointcounter;
$(this).closest('.endpoint-maindiv').remove();
checkendpoints();
});
$("body").on("change", "#startpoint_type,#network_id", function () {
var options;
if ($.trim($("#network_id").val()) != "" && $.trim($("#startpoint_type").val())) {
$.getJSON("<?= self::getUrl("FiberPlanPipe", "api", ['do' => 'getBuildingInfo']) ?>&network_id=" + $.trim($("#network_id").val()) + "&bdtype=" + $.trim($("#startpoint_type").val()), {})
.done(function (data) {
$.each(data, function (k, val) {
options = options + '<option value="' + val.id + '">' + val.name + '</option>';
});
$('#starting-point-building').empty();
$('#starting-point-building').append('<select id="startpoint" required="required" name="startpoint" class="select2 form-control">' + options + '</select>');
$(".select2").select2({placeholder: ""});
});
}
});
$("body").on("change", "#entpoint_type,#network_id2", function () {
var options;
if ($.trim($("#network_id2").val()) != "" && $.trim($("#entpoint_type").val())) {
$.getJSON("<?= self::getUrl("FiberPlanPipe", "api", ['do' => 'getBuildingInfo']) ?>&network_id=" + $.trim($("#network_id2").val()) + "&bdtype=" + $.trim($("#entpoint_type").val()), {})
.done(function (data) {
$.each(data, function (k, val) {
options = options + '<option value="' + val.id + '">' + val.name + '</option>';
});
$('#end-point-building').empty();
$('#end-point-building').append('<select id="endpoint" name="endpoint" required="required" class="select2 form-control">' + options + '</select><input type="hidden" name="endpointid[]" value="">');
$(".select2").select2({placeholder: ""});
});
}
});
$("body").on("change", "#type", function () {
if ($(this).val() < 3) {
$('#dimesion-div').show();
$('#dimension-bundle-div').hide();
$("#type_description").prop("disabled", false);
$("#fiberplanpipetemplate_id").prop("disabled", true);
$(".select2").select2({placeholder: ""});
} else {
$('#dimesion-div').hide();
$('#dimension-bundle-div').show();
$("#type_description").prop("disabled", true);
$("#fiberplanpipetemplate_id").prop("disabled", false);
$(".select2").select2({placeholder: ""});
}
});
$("body").on("change", "#responsible", function () {
if ($(this).val() == 1) {
$('#responsible-div').show();
$("#address_id").prop("disabled", false);
$(".select2").select2({placeholder: ""});
} else {
$('#responsible-div').hide();
$("#address_id").prop("disabled", true);
$(".select2").select2({placeholder: ""});
}
});
// disable mousewheel on a input number field when in focus
$('form').on('focus', 'input[type=number]', function (e) {
$(this).on('wheel.disableScroll', function (e) {
e.preventDefault()
})
});
$('form').on('blur', 'input[type=number]', function (e) {
$(this).off('wheel.disableScroll')
});
$(document).ready(function () {
$(".select2").select2({placeholder: ""});
if ($.trim($("#network_id").val()) != "" && $.trim($("#startpoint_type").val())) {
$.getJSON("<?= self::getUrl("FiberPlanPipe", "api", ['do' => 'getBuildingInfo']) ?>&network_id=" + $.trim($("#network_id").val()) + "&bdtype=" + $.trim($("#startpoint_type").val()), {})
.done(function (data) {
var options;
$.each(data, function (k, val) {
if ($('#startpoint_type').data('startpoint') == val.id) {
options = options + '<option selected="selected" value="' + val.id + '">' + val.name + '</option>';
} else {
options = options + '<option value="' + val.id + '">' + val.name + '</option>';
}
});
$('#starting-point-building').empty();
$('#starting-point-building').append('<select id="startpoint" name="startpoint" required="required" class="select2 form-control">' + options + '</select>');
$(".select2").select2({placeholder: ""});
});
}
if ($.trim($("#network_id2").val()) != "" && $.trim($("#entpoint_type").val())) {
$.getJSON("<?= self::getUrl("FiberPlanPipe", "api", ['do' => 'getBuildingInfo']) ?>&network_id=" + $.trim($("#network_id2").val()) + "&bdtype=" + $.trim($("#entpoint_type").val()), {})
.done(function (data) {
var options;
$.each(data, function (k, val) {
if ($('#entpoint_type').data('endpoint') == val.id) {
options = options + '<option selected="selected" value="' + val.id + '">' + val.name + '</option>';
} else {
options = options + '<option value="' + val.id + '">' + val.name + '</option>';
}
});
$('#end-point-building').empty();
$('#end-point-building').append('<select id="endpoint" name="endpoint" required="required" class="select2 form-control">' + options + '</select>');
$(".select2").select2({placeholder: ""});
});
}
$("body").on("click", "#add-endpoint", function (event) {
let randid = Math.floor(Math.random() * 10000);
let endpointtype = $('#startpoint_type').html();
let endpointcounter = $('.endpoint-maindiv').length + 1;
let endpointuparrow = "";
let standorttext = "";
if (endpointcounter > 1) {
endpointuparrow = '<i title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>';
}
if (endpointcounter <= 7) {
$('#endpoints').append(`<div class="form-group row endpoint-maindiv">
<label class="col-lg-2 col-form-label endpoint-label" for="` + randid + `_endpoint_network_id"><span class="label-text">Standort ` + $('.endpoint-maindiv').length + ` * </span>` + endpointuparrow + `<span class="endpointsymbol"><i class="fa-regular fa-circle-minus remove-endpoint"></i></span></label>
<div class="col-lg-2"><select id="` + randid + `_endpoint_network_id" required="required" name="endpoint_network_id[]"
class="select2 form-control endpoint_network_id">` + $('#network_id').html() + `</select></div>
<div class="col-lg-2 ">
<select id="` + randid + `_endpoint_type" name="endpoint_type[]" required="required"
class="select2 form-control endpoint_type" data-startpoint="" : "" >
<option value=""></option>
<option value="4">
Schacht-Verteiler
</option>
</select>
</div>
<div class="col-lg-2" id="` + randid + `_mid-point-building">
</div>
</div>`);
$('#' + randid + '_endpoint_network_id').val($('#network_id').val());
checkendpoints();
$(".select2").select2({placeholder: ""});
}
});
});
</script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -0,0 +1,259 @@
<?php
$typeOption[1] = "Einzel";
$typeOption[2] = "Schutzrohr";
$typeOption[3] = "Verband";
$dimension_v1Option[1] = "MR7";
$dimension_v1Option[2] = "MR14";
$dimension_v1Option[3] = "MR16";
$dimension_v1Option[4] = "MR20";
$dimension_v1Option[5] = "PE32";
$dimension_v1Option[6] = "PE40";
$dimension_v1Option[7] = "PE50";
$dimension_v1Option[8] = "KSR50";
$dimension_v1Option[9] = "KSR80";
$dimension_v1Option[10] = "KSR100";
$dimension_v2Option[1] = "Anzahl";
$dimension_v2Option[2] = "Dimenson";
$dimension_v2Option[3] = "Farben";
$starting_pointOption[1] = "Greenfield";
$starting_pointOption[2] = "POP";
$starting_pointOption[3] = "Building";
$starting_pointOption[4] = "Schacht-Verteiler";
$statusOption[10] = "Geplant";
$statusOption[20] = "Umsetzung";
$statusOption[30] = "Fertiggestellt";
$responsibleOption[1] = "(F)";
$responsibleOption[2] = "(P)";
foreach ($networks as $network) {
$Network[$network->id] = $network->name;
}
foreach ($pipworkeraddresses as $pipworkeraddress) {
$Pipeworker[$pipworkeraddress->id] = $pipworkeraddress->company;
}
?>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<!-- start page title -->
<style>
#map {
height: 600px;
width: 100%
}
</style>
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<li class="breadcrumb-item active">Rohrverzeichnisse</li>
</ol>
</div>
<h4 class="page-title">Rohrverzeichnisse</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="card">
<div class="card-body mb-3">
<div class="row">
<div class="col-12">
<div class="float-left">
<h4 class="header-title">Liste aller Rohrverzeichnisse</h4>
</div>
<div class="float-right">
<a class="btn btn-primary mb-2" href="<?= self::getUrl("FiberPlanPipe", "add") ?>"><i
class="fas fa-plus"></i> Neuen Rohrverzeichnis anlegen</a>
</div>
</div>
</div>
<table id="datatable" class="table table-striped table-hover table-sm font-13">
<thead>
<tr>
<th class="text-center">Bezeichnung</th>
<th class="text-center">Type/Bezeichnung</th>
<th class="text-center">Länge (m)</th>
<th>Netzgebiet(e)</th>
<th class="text-center">Anfangspunkt</th>
<th class="text-center">Endpunkt</th>
<th class="text-center">Zuständig</th>
<th class="text-center">Status</th>
<th class="edit-width"></th>
</tr>
<tr id="filterrow">
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($fiberplanpipes as $fiberplanpipe):
if ($fiberplanpipe->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 = '<span class="startpoint" data-toggle="modal" data-target="#pipemap" data-gpslat="' . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['gps_lat'] . '" data-gpslong="' . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['gps_long'] . '">' . $starting_pointOption[$fiberplanpipe->startpoint_type] . "/" . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['name'] . '</span>';
$endpoint = '<span class="endpoint" data-toggle="modal" data-target="#pipemap" data-gpslat="' . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['gps_lat'] . '" data-gpslong="' . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['gps_long'] . '">' . $starting_pointOption[$fiberplanpipe->entpoint_type] . "/" . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['name'] . '</span>';
$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];
}
?>
<tr>
<td><a href="<?= self::getUrl("FiberPlanPipe", "Detail", ["id" => $fiberplanpipe->id]) ?>"><?= $fiberplanpipe->description ?></a></td>
<td style="white-space: nowrap"><?= $typeOption[$fiberplanpipe->type] . " / " . $typeDescription ?></td>
<td class="text-center"><?= $fiberplanpipe->length ?></td>
<td><?= $networkName ?></td>
<td><?= $startpoint ?></td>
<td><?= $endpoint ?></td>
<td><?= $responsible ?></td>
<td><?= $statusOption[$fiberplanpipe->status] ?></td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?= self::getUrl("FiberPlanPipe", "edit", ["id" => $fiberplanpipe->id]) ?>"><i
class="far fa-edit" title="Bearbeiten"></i></a>
<a href="<?= self::getUrl("FiberPlanPipe", "delete", ["id" => $fiberplanpipe->id]) ?>"
onclick="if(!confirm('Rohrverzeichnis wirklich löschen?')) return false;"
class="text-danger"
title="Löschen"><i class="fas fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#pipemap">
Launch demo modal
</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="pipemap" tabindex="-1" role="dialog" aria-labelledby="pipemap"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="pipemapLabel">Rohrverzeichnis</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div id="map"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Schließen</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var startlat;
var startlong;
var endlat;
var endlong;
var startmarkertext;
var endmarkertext;
var marker;
var polylinec;
var polyline;
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19
}).addTo(map);
L.MakiMarkers.accessToken = '<?=TT_MAPBOX_TILE_API_TOKEN?>';
var hidesearch = [2, 8];
var columnfilter = [7];
var columnoptions = '<option class="text-left" value="">Alle</option><option class="text-left" value="Geplant">Geplant</option><option class="text-left" value="Umsetzung">Umsetzung</option><option class="text-left" value="Fertiggestellt">Fertiggestellt</option>';
$(document).ready(function () {
$('#pipemap').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
map.remove();
map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19
}).addTo(map);
startlat = button.closest('tr').find('.startpoint').data('gpslat');
startlong = button.closest('tr').find('.startpoint').data('gpslong');
endlat = button.closest('tr').find('.endpoint').data('gpslat');
endlong = button.closest('tr').find('.endpoint').data('gpslong');
startmarkertext = button.closest('tr').find('.startpoint').text();
endmarkertext = button.closest('tr').find('.endpoint').text();
var icon_name = "town";
var icon_color = "#ec98a2";
var icon = L.MakiMarkers.icon({icon: icon_name, color: icon_color, size: "l"});
marker = L.marker([startlat, startlong]).addTo(map);
marker.bindPopup("" + startmarkertext);
map.setView([button.data('gpslat'), button.data('gpslong')], 13)
marker = L.marker([endlat, endlong]).addTo(map);
// marker = L.marker([endlat, endlong], {icon: icon}).addTo(map);
marker.bindPopup("" + endmarkertext);
polylinec = [
[startlat, startlong],
[endlat, endlong]
];
polyline = L.polyline(polylinec, {color: 'red'}).addTo(map);
});
$('#pipemap').on('shown.bs.modal', function (event) {
map.invalidateSize();
});
});
</script>
<script type="text/javascript"
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -98,9 +98,9 @@
<?php if($me->is(["Admin","netowner","lineplanner","lineworker"]) && $me->can("Linework")): ?><li><a href="<?=self::getUrl("Linework")?>"><i class="fas fa-fw fa-ethernet text-info"></i> Leitungsbau</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","netoperator","lineworker"]) && $me->can("Patching")): ?><li class="has-sub-submenu"><a href="<?=self::getUrl("Patching")?>"><i class="fas fa-fw fa-plug text-info"></i> Patchungen</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","pipeplanner","lineplanner","pipeworker","netoperator","lineworker"]) && $me->can("Filestore")): ?><li><a href="<?=self::getUrl("Filestore")?>"><i class="fas fa-fw fa-file text-info"></i> Dateiablage</a></li><?php endif; ?>
<!-- //Vorbereitend für Faserplanung --><?php //if($me->is(["Admin","netowner","pipeplanner","pipeplanner"]) && $me->is("employee")): ?><!--<li><a href="--><?php //=self::getUrl("FiberPlanDispatcher")?><!--"><i class="fas fa-building-circle-arrow-right text-info"></i> Verteiler und Schächte</a></li>--><?php //endif; ?>
<!-- //Vorbereitend für Faserplanung --><?php //if($me->is(["Admin","netowner","lineplanner","lineworker"]) && $me->is("employee")): ?><!--<li><a href="--><?php //=self::getUrl("FiberPlanPipe")?><!--"><i class="fas fa-pipe text-info pl-1"></i> Rohrverzeichnis</a></li>--><?php //endif; ?>
<!-- //Vorbereitend für Faserplanung --><?php //if($me->is(["Admin","netowner","lineplanner","lineworker"]) && $me->is("employee")): ?><!--<li><a href="--><?php //=self::getUrl("FiberPlanCable")?><!--"><i class="fas fa-pipe text-info pl-1"></i> Kabelverzeichnis</a></li>--><?php //endif; ?>
<?php if($me->is(["Admin","netowner","pipeplanner","pipeplanner"]) && $me->is("employee")): ?><li><a href="<?=self::getUrl("FiberPlanDispatcher")?>"><i class="fas fa-building-circle-arrow-right text-info"></i> Verteiler und Schächte</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","lineplanner","lineworker"]) && $me->is("employee")): ?><li><a href="<?=self::getUrl("FiberPlanPipe")?>"><i class="fas fa-pipe text-info pl-1"></i> Rohrverzeichnis</a></li><?php endif; ?>
<!-- --><?php //if($me->is(["Admin","netowner","lineplanner","lineworker"]) && $me->is("employee")): ?><!--<li><a href="--><?php //=self::getUrl("FiberPlanCable")?><!--"><i class="fas fa-pipe text-info pl-1"></i> Kabelverzeichnis</a></li>--><?php //endif; ?>
</ul>
</li>
<?php endif; ?>

View File

@@ -0,0 +1,59 @@
<?php
class FiberPlanDispatcher extends mfBaseModel
{
private $editor;
private $network;
private $creator;
public function getProperty($name)
{
if ($this->$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;
}
}

View File

@@ -0,0 +1,182 @@
<?php
class FiberPlanDispatcherController extends mfBaseController
{
protected function init()
{
$this->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");
}
}

View File

@@ -0,0 +1,137 @@
<?php
class FiberPlanDispatcherModel
{
public $network_id = null;
public $object_type = null;
public $price = null;
public $gps_lat = null;
public $gps_long = null;
public $type = null;
public $comment = null;
public $description = null;
public $create_by = null;
public $edit_by = null;
public $create = null;
public $edit = null;
public static function find($data)
{
}
public static function create(array $data)
{
$model = new FiberPlanDispatcher();
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("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;
}
}

View File

@@ -0,0 +1,60 @@
<?php
class FiberPlanDispatchersleeve extends mfBaseModel
{
private $editor;
private $creator;
private $fiberPlanDispatcher;
public function getProperty($name)
{
if ($this->$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;
}
}

View File

@@ -0,0 +1,127 @@
<?php
class FiberPlanDispatchersleeveController extends mfBaseController
{
protected function init()
{
$this->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");
}
}

View File

@@ -0,0 +1,153 @@
<?php
class FiberPlanDispatchersleeveModel
{
private $fiberPlanDispatcher_id;
private $name;
public static function find($data)
{
}
public static function create(array $data)
{
$model = new FiberPlanDispatchersleeve();
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("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);
}
}

View File

@@ -0,0 +1,62 @@
<?php
class FiberPlanPipe extends mfBaseModel
{
private $editor;
private $creator;
private $network;
private $fiberPlanPipeManufacturer;
private $fiberPlanPipeTemplate;
public function getProperty($name)
{
if ($this->$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;
}
}

View File

@@ -0,0 +1,281 @@
<?php
class FiberPlanPipeController extends mfBaseController
{
protected function init()
{
$this->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);
}
}

View File

@@ -0,0 +1,376 @@
<?php
class FiberPlanPipeModel
{
private $network_id;
private $description;
private $gisid;
private $type;
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;
private $address_id;
private $comment;
public static $type_descrition_definition = array(1 => "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 = '<i title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>';
}
if ($counter == 1) {
$endpointType = "Startpunkt";
$endpointsymbol = '<span class="endpointsymbol"><i id="add-endpoint" class="fa-regular fa-circle-plus"></i></span>';
}
else if (count($endpoints)==2)
{
$endpointcount = $counter - 1;
$endpointType = "Standort " . $endpointcount;
$endpointsymbol='<span class="endpointsymbol">';
}
else {
$endpointcount = $counter - 1;
$endpointType = "Standort " . $endpointcount;
$endpointsymbol = '<span class="endpointsymbol"><i class="fa-regular fa-circle-minus remove-endpoint"></i></span>';
}
$html = '<div class="form-group row endpoint-maindiv">
<label class="col-lg-2 col-form-label endpoint-label" for="' . $randid . '_endpoint_network_id"><span class="label-text">' . $endpointType . ' * </span>' . $Endpointuparrow . $endpointsymbol . '</label>
<div class="col-lg-2"><select id="' . $randid . '_endpoint_network_id" required="required" name="endpoint_network_id[]" class="select2 form-control endpoint_network_id">';
foreach ($networks as $network) {
if ($network->id == $networkid) {
$html .= '<option selected="selected" value="' . $network->id . '">' . $network->name . '</option>';
} else {
$html .= '<option value="' . $network->id . '">' . $network->name . '</option>';
}
}
$html .= '</select></div>
<div class="col-lg-2 ">
<select id="' . $randid . '_endpoint_type" name="endpoint_type[]" required="required" class="select2 form-control endpoint_type" >';
foreach ($typeArray as $key => $type) {
if ($key == $endpointtype) {
$html .= '<option selected="selected" value="' . $key . '">' . $type . '</option>';
} else {
$html .= '<option value="' . $key . '">' . $type . '</option>';
}
}
$html .= '</select></div>
<div class="col-lg-2" id="' . $randid . '_end-point-building">
<select id=' . $randid . '_endpoint" required="required" name="endpoint[]" class="select2 form-control">';
$buildings = FiberPlanPipeModel::getBuildingInfo($networkid, $endpointtype, 0);
foreach ($buildings as $key => $building) {
if ($building['id'] == $endpointid) {
$html .= '<option selected="selected" value="' . $building['id'] . '">' . $building['name'] . '</option>';
} else {
$html .= '<option value="' . $building['id'] . '">' . $building['name'] . '</option>';
}
}
$html .= '</select><input type="hidden" name="endpointid[]" value="' . $Endpoint->id . '" ></div></div>';
echo $html;
$counter++;
}
}
}

View File

@@ -0,0 +1,64 @@
<?php
class FiberPlanPipeEndpoint extends mfBaseModel
{
private $editor;
private $creator;
private $fiberPlanPipe;
private $pop;
private $fiberPlanDispatcher;
private $building;
public function getProperty($name)
{
if ($this->$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;
}
}

View File

@@ -0,0 +1,145 @@
<?php
class FiberPlanPipeEndpointController extends mfBaseController
{
protected function init()
{
$this->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");
}
}

View File

@@ -0,0 +1,129 @@
<?php
class FiberPlanPipeEndpointModel
{
private $fiberPlanPipe_id;
private $pop_id;
private $fiberPlanDispatcher_id;
private $building_id;
private $sort;
public static function find($data)
{
}
public static function create(array $data)
{
$model = new FiberPlanPipeEndpoint();
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("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;
}
}

View File

@@ -0,0 +1,42 @@
<?php
class FiberPlanPipeManufacturer extends mfBaseModel
{
private $editor;
private $creator;
public function getProperty($name)
{
if ($this->$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;
}
}

View File

@@ -0,0 +1,126 @@
<?php
class FiberPlanPipeManufacturerModel
{
private $name;
private $colors;
public static function find($data)
{
}
public static function create(array $data)
{
$model = new FiberPlanPipeManufacturer();
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("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;
}
}

View File

@@ -0,0 +1,43 @@
<?php
class FiberPlanPipeTemplate extends mfBaseModel
{
private $editor;
private $creator;
private $fiberPlanPipeManufacturer;
public function getProperty($name)
{
if ($this->$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;
}
}

View File

@@ -0,0 +1,127 @@
<?php
class FiberPlanPipeTemplateModel
{
private $fiberplanpipemanufacturer_id;
private $pipe7x4;
private $pipe14x10;
public static function find($data)
{
}
public static function create(array $data)
{
$model = new FiberPlanPipeTemplate();
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("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;
}
}

View File

@@ -0,0 +1,50 @@
<?php
use Phinx\Migration\AbstractMigration;
final class FiberPlanPipe extends AbstractMigration
{
public function up(): void
{
if ($this->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") {
}
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Phinx\Migration\AbstractMigration;
final class FiberPlanPipeManufacturer extends AbstractMigration
{
public function up(): void
{
if ($this->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") {
}
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Phinx\Migration\AbstractMigration;
final class FiberPlanPipeTemplate extends AbstractMigration
{
public function up(): void
{
if ($this->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") {
}
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Phinx\Migration\AbstractMigration;
final class FiberPlanPipeEndpoint extends AbstractMigration
{
public function up(): void
{
if ($this->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") {
}
}
}