Files
thetool/Layout/default/FiberPlanCable/Detail.php
Daniel Spitzer 1554d6cf72 Faserplanung Vorbereitung für Kabelverschaltung
* Menüpunkt Kabelverschaltung hinzugefügt
 * Initialfiles für Kabelverschaltung
2024-06-30 12:01:56 +02:00

805 lines
33 KiB
PHP

<?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 = [];
$fibers[1]['name'] = "1x4";
$fibers[1]['fibers'] = "4";
$fibers[2]['name'] = "1x12";
$fibers[2]['fibers'] = "12";
$fibers[3]['name'] = "1x24";
$fibers[3]['fibers'] = "24";
$fibers[4]['name'] = "2x12";
$fibers[4]['fibers'] = "24";
$fibers[5]['name'] = "4x12";
$fibers[5]['fibers'] = "48";
$fibers[6]['name'] = "8x12";
$fibers[6]['fibers'] = "96";
$fibers[7]['name'] = "6x24";
$fibers[7]['fibers'] = "144";
$fibers[8]['name'] = "12x12";
$fibers[8]['fibers'] = "144";
$fibers[9]['name'] = "8x24";
$fibers[9]['fibers'] = "192";
$fibers[10]['name'] = "12x24";
$fibers[10]['fibers'] = "288";
$state[10] = 'Geplant';
$state[20] = 'Umsetzung';
$state[30] = 'Fertiggestellt';
foreach ($lineworkeraddresses as $lineworkeraddress):
$Lineworker[$lineworkeraddress->id] = $lineworkeraddress->company;
endforeach;
if ($fiberplancables->address_id) {
$responsible = $Lineworker[$fiberplancables->address_id];
} else {
$responsible = "Person";
}
?>
<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;
}
.inner-table td {
border: none !important;
padding: 5px 5px 5px 0px !important;
}
.inner-table th {
border: none !important;
padding: 5px 10px 5px 0px !important;
}
.pipe-striped {
height: 100%;
background-color: #000;
width: 35%;
margin-left: auto;
margin-right: auto;
}
.overflowme {
overflow-x: auto;
white-space: nowrap;
margin-bottom: 20px;
}
</style>
<?php
function generateendpointbody($destinations, $destinationinfo, $oldsummcounter = 0)
{
$plug[1] = "LC/APC";
$plug[2] = "SC/APC";
$plug[3] = "E2000/APC";
$oldrack = "";
$counter = 1;
$startport = 0;
$endport = 0;
$sumcounter = 0;
$pop_id = $destinations['pop_id'];
$body = "";
foreach ($destinations as $destination) {
$endport = $sumcounter + $destination->endport - $destination->startport + 1;
$startport = $sumcounter + 1;
if ($destinationinfo == "pop"):
if ($oldrack != $destination->poprack_id) {
if ($counter != 1) {
echo '</tbody>';
}
$body .= ' <tbody class="font-13" style="border-top: 1px solid #000;margin-top:5px;">
<tr>
<td class="pl-2 pr-2 font-weight-bold" colspan="3">
<div class="fiber-rack-div">' . $destination->poprack->name . '</div>
</td>
</tr>';
}
$body .= '<tr>
<td class="text-left sp-border-rl" colspan="3">
<div class="fiber-module-div">HE(' . $destination->poprackmodule->start_he . ') ' . $destination->poprackmodule->name . ' (' . $destination->startport . '-' . $destination->endport . ') ' . $plug[$destination->poprackmodule->plug] . ' <span class="fiber-color">(' . $startport . '-' . $endport . ')</span>
</div>
</td>
</tr>';
$counter++;
$oldrack = $destination->poprack_id;
$sumcounter = $sumcounter + $destination->endport - $destination->startport + 1;
endif;
if ($destinationinfo == "building"):
$body .= '<tr>
<td class="text-left sp-border-rl" colspan="3">
<div class="fiber-module-div">' . $destination->fiberPlanDispatchersleeve->name . ' <span class="fiber-color">(' . $destination->startport . '-' . $destination->endport . ')</span>
</div>
</td>
</tr>';
$sumcounter = $sumcounter + $destination->endport - $destination->startport + 1;
endif;
if ($destinationinfo == "sleeve"):
if ($destination->dropout) {
$body .= '<tr>
<th colspan="3"
class="text-center font-15">
<div class="pt-2 pl-2 pr-2">Dropout</div>
</th>
</tr>';
$body .= '<tr>
<td class="text-left sp-border-rl" colspan="3">
<div class="fiber-module-div">' . $destination->fiberPlanDispatchersleeve->name . ' <span class="fiber-color">(' . $destination->startport . '-' . $destination->endport . ')</span>
</div>
</td>
</tr>';
$body .= '<tr>
<td colspan="3"></td>
</tr>';
$dropcounter = $destination->endport - $destination->startport + 1;
$dropout .= '<div style="height:70px;width: 3px;background-color: #000; margin-left: auto; margin-right: auto;"></div>
<div style="margin-left: auto; margin-right: auto;">' . $dropcounter . ' Fasern</div>';
} else {
$body .= '<tr>
<td class="text-left sp-border-rl" colspan="3">
<div class="fiber-module-div">' . $destination->fiberPlanDispatchersleeve->name . ' <span class="fiber-color">(' . $destination->startport . '-' . $destination->endport . ')</span>
</div>
</td>
</tr>';
$sumcounter = $sumcounter + $destination->endport - $destination->startport + 1;
}
endif;
}
if ($sumcounter==0){
$sumcounter = $oldsummcounter;
}
return array($body, $sumcounter, $dropout);
}
function generatedestinationmidpoint($markers, $midpoints, $cableendpoints, $fiberPlanCablePipes, $pipesubs)
{
$oldendpoint = "";
$midpointcounter = count($midpoints);
$pipecolorsmanu = FiberPlanPipeManufacturerModel::getAll();
$pipecolors = json_decode($pipecolorsmanu[0]->colors, true);
$counter = 0;
$width = 0;
$oldsummcounter = 0;
foreach ($midpoints as $midpoint):
$pipecol = $pipesubs[$counter]['pipecolor'];
$midcounter = 0;
foreach ($midpoint as $endpoint):
$pipecolor = $pipecolors[$endpoint->fiberPlanCablePipe->fiberPlanPipe_sub];
if ($endpoint->pop_id) {
$enpointid = $endpoint->pop_id;
} elseif ($endpoint->fiberPlanDispatcher_id) {
$enpointid = $endpoint->fiberPlanDispatcher_id;
} elseif ($endpoint->building_id) {
$enpointid = $endpoint->building_id;
}
if ($oldendpoint != $enpointid && $width == 0) {
echo '<div class="overflowme">';
}
if (($counter != 0 || $midcounter != 0) && $oldendpoint != $enpointid):
echo ' <table id="olt-port-table" class="float-left" style="width: 80px">
<thead>
<tr>
<td style="height: 60px;"></td>
</tr>
</thead>
<tbody id="olt-ports">
<tr>
<td data-oltport="0"
class="font-13">' . $summcounter . '</td>
</tr>
<tr>
<td data-oltport="0" class="sp-port-lines" style="width: 70px; background-color: ' . $pipecol . ' ;height: 7px;">' . $pipesubs[$counter]['pipsstriped'] . '</td>
</tr>
<tr>
<td data-oltport="0" class="font-13"></td>
</tr>
</tbody>
</table>';
$width = $width + 80;
// $summcounter = 0;
endif;
$endpointbody = "";
if ($endpoint->pop_id) {
$url = mfBaseController::getUrl("Pop", "detail", ["id" => $endpoint->pop->id]);
$endpointname = '<a href="' . $url . '" target="_blank">' . $endpoint->pop->name . '</a>';
$endpointtype = "Pop";
$gps_lat = $endpoint->pop->gps_lat;
$gps_long = $endpoint->pop->gps_long;
$enpointid = $endpoint->pop_id;
if ($cableendpoints[$endpoint->id]) {
list($endpointbody, $summcounter, $dropout) = generateendpointbody($cableendpoints[$endpoint->id], 'pop', $oldsummcounter);
}
$width = $width + 300;
} elseif ($endpoint->fiberPlanDispatcher_id) {
$endpointname = $endpoint->fiberPlanDispatcher->description;
if ($endpoint->fiberPlanDispatcher->object_type == 3) $endpointtype = "Greenfield";
else if ($endpoint->fiberPlanDispatcher->object_type == 1) $endpointtype = "Verteiler";
else if ($endpoint->fiberPlanDispatcher->object_type == 2) $endpointtype = "Schacht";
else $endpointtype = "Schacht/Verteiler";
$gps_lat = $endpoint->fiberPlanDispatcher->gps_lat;
$gps_long = $endpoint->fiberPlanDispatcher->gps_long;
$enpointid = $endpoint->fiberPlanDispatcher_id;
list($endpointbody, $summcounter, $dropout) = generateendpointbody($cableendpoints[$endpoint->id], 'sleeve', $oldsummcounter);
$width = $width + 150;
} elseif ($endpoint->building_id) {
$endpointname = $endpoint->building->street;
$endpointtype = 'Building';
$gps_lat = $endpoint->building->gps_lat;
$gps_long = $endpoint->building->gps_long;
$enpointid = $endpoint->fiberPlanDispatcher_id;
list($endpointbody, $summcounter, $dropout) = generateendpointbody($cableendpoints[$endpoint->id], 'building', $oldsummcounter);
$width = $width + 150;
}
if ($oldendpoint != $enpointid):
$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>';
}
if ($gps_lat) {
$markers[] = array(
"gps_lat" => $gps_lat,
"gps_long" => $gps_long,
"name" => $endpointname,
"color" => $pipecol,
"type" => $endpointtype,
);
}
echo '<div class="float-left"><table class="sp-table-border "
style="min-height: 150px;display:block">
<thead >
<tr>
<th colspan="3"
class="text-center font-15">
<div class="pt-2 pl-2 pr-2" style="min-width: min-width: 170px;">' . $endpointtype . '</div>
</th>
</tr>
<tr>
<th colspan="3"
class="text-center font-15">
<div class="pl-2 pr-2" style="min-width: min-width: 170px;">' . $endpointname . '</div>
</th>
</tr>
<tr>
<th colspan="3" class="text-center font-13">
<div class="pl-2 pr-2 pb-2">' . $coordinates . '</div>
</th>
</tr>
<tbody>';
echo $endpointbody;
echo '</tbody>
</table>';
echo $dropout;
echo '</div>';
endif;
$midcounter++;
$oldendpoint = $enpointid;
if ($width > 1500) {
echo '</div>';
echo '<div class="overflowme">';
$width = 0;
}
$oldsummcounter = $summcounter;
endforeach;
$counter++;
endforeach;
return $markers;
}
$counter = 0;
foreach ($fiberPlanCablePipes as $fiberPlanCablePipe) {
//var_dump($fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4);
$pipsstriped = "";
if ($fiberPlanCablePipe->fiberPlanPipe_sub <= $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4 && $fiberPlanCablePipe->fiberPlanPipe_sub <= 12) {
$pipesub = "7x4";
$pipeheight = "7px";
$pipeheightinfoheight = "12px";
$pipeheightinfomarge = "4px";
$pipecolor = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 1]->color;
$pipecolordesc = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 1]->colordescription;
} elseif ($fiberPlanCablePipe->fiberPlanPipe_sub <= $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4 && $fiberPlanCablePipe->fiberPlanPipe_sub > 12) {
$pipesub = "7x4";
$pipeheight = "7px";
$pipecolor = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 13]->color;
$pipecolordesc = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 13]->colordescstriped;
$pipeheightinfoheight = "12px";
$pipeheightinfomarge = "4px";
$pipsstriped = '<div class="pipe-striped"></div>';
} else if ($fiberPlanCablePipe->fiberPlanPipe_sub - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4 <= $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe14x10 && $fiberPlanCablePipe->fiberPlanPipe_sub - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4 <= 12) {
$pipesub = "14x10";
$pipeheight = "10px";
$pipecolor = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 1 - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4]->color;
$pipecolordesc = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 1 - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4]->colordescription;
$pipeheightinfoheight = "15px";
$pipeheightinfomarge = "3px";
} else if ($fiberPlanCablePipe->fiberPlanPipe_sub - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4 <= $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe14x10 && $fiberPlanCablePipe->fiberPlanPipe_sub - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4 > 12) {
$pipesub = "14x10";
$pipeheight = "10px";
$pipecolor = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 13 - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4]->color;
$pipecolordesc = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 13 - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4]->colordescstriped;
$pipeheightinfoheight = "15px";
$pipeheightinfomarge = "3px";
$pipsstriped = '<div class="pipe-striped"></div>';
}
/* var_dump($fiberPlanCablePipe->fiberPlanpipe->fiberPlanPipeTemplate);
echo $fiberPlanCablePipe->fiberPlanPipe_sub;
echo ".<br>";
echo $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4;
echo "<br>";
echo $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe14x10;
echo "<br>";
echo $fiberPlanCablePipe->fiberPlanPipe_sub - $fiberPlanCablePipe->fiberPlanpipe->fiberPlanPipeTemplate->pipe7x4;*/
$pipesubs[$counter]['pipesub'] = $pipesub;
$pipesubs[$counter]['pipeheight'] = $pipeheight;
$pipesubs[$counter]['pipecolor'] = $pipecolor;
$pipesubs[$counter]['pipecolordesc'] = $pipecolordesc;
$pipesubs[$counter]['pipeheightinfoheight'] = $pipeheightinfoheight;
$pipesubs[$counter]['pipeheightinfomarge'] = $pipeheightinfomarge;
$pipesubs[$counter]['pipsstriped'] = $pipsstriped;
$counter++;
}
foreach ($fiberPlanCableEndpoints as $fiberPlanCableEndpoint) {
$markers = generatedestinationmidpoint($markers, $fiberPlanCableEndpoints, $fiberPlanCableEndpoints, $fiberPlanCablePipes, $pipesubs);
}
?>
<!-- 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("FiberPlanCable") ?>">Kabelverzeichnis</a>
</li>
<li class="breadcrumb-item active">Kabelverzeichnis Detail</li>
</ol>
</div>
<h4 class="page-title">Kabel: <span
class="font-weight-normal ml-1"><?= $fiberplancables->description ?></span>
<span class="ml-2">
<a href="<?= self::getUrl("FiberPlanCable", "edit", ["id" => $fiberplancables->id, 'returnto' => "fiberplancable-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-5 card-border">
<div>
<h4>Allgemeine Informationen </h4>
</div>
<div>
<table class="table table-sm">
<tbody>
<tr>
<th class="w-30">Bezeichnung</th>
<td><?= $fiberplancables->description ?> </td>
</tr>
<tr>
<th>Fasern / Länge (m)</th>
<td><?= $fibers[$fiberplancables->fibers]['name'] . " (" . $fibers[$fiberplancables->fibers]['fibers'] . ")" ?>
/ <?= $fiberplancables->lenght ?> Meter
</td>
</tr>
<tr>
<th>Netzgebiet</th>
<td><?= $fiberplancables->network->name ?> </td>
</tr>
<tr>
<th>Verwendete(s) Rohr(e)</th>
<td>
<table class="inner-table">
<?php
$counter = 0;
foreach ($fiberPlanCablePipes as $fiberPlanCablePipe):?>
<tr>
<th><?= '<a href="' . self::getUrl("FiberPlanPipe", "detail", ["id" => $fiberPlanCablePipe->fiberPlanPipe->id]) . '" target="_blanc">' . $fiberPlanCablePipe->fiberPlanPipe->description . '</a>' ?></th>
<td><?= '<div style="height: ' . $pipesubs[$counter]['pipeheightinfoheight'] . ';margin-top: ' . $pipesubs[$counter]['pipeheightinfomarge'] . '; background-color: ' . $pipesubs[$counter]['pipecolor'] . '; width: 50px; display: inline-block; vertical-align: top; border-radius: 10px;border: 1px solid;">' . $pipesubs[$counter]['pipsstriped'] . '</div>' ?>
<?= $pipesubs[$counter]['pipesub'] ?>
(<?= $pipesubs[$counter]['pipecolordesc'] ?>)
</td>
</tr>
<?php
$counter++;
endforeach; ?>
</table>
</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[$fiberplancables->state] ?> </td>
</tr>
<tr>
<th>Zuständig</th>
<td><?= $responsible ?> </td>
</tr>
<tr>
<th>Kontakt</th>
<td><?= $fiberplancables->responsible_text ?> </td>
</tr>
<tr>
<th>Bemerkung</th>
<td><?= nl2br($fiberplancables->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>
<?php
if ($fiberPlanPipesEndpoints) {
$markers = generatedestinationmidpoint($markers, $fiberPlanPipesEndpoints, $fiberPlanCableEndpoints, $fiberPlanCablePipes, $pipesubs);
}
?>
</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="row justify-content-center">
<div class="col-lg-1"></div>
<div class="col-lg-9 "><h4>Legende:</h4></div>
</div>
<div class="row justify-content-center">
<div class="col-lg-1"></div>
<div class="col-lg-4"><img src="<?= self::getResourcePath() ?>img/markers/marker-pop.png ">
<label class="font-16"> ... Pop</label></div>
<div class="col-lg-4"><img src="<?= self::getResourcePath() ?>img/markers/marker-home.png ">
<label class="font-16"> ... Building</label></div>
</div>
<div class="row justify-content-center">
<div class="col-lg-1"></div>
<div class="col-lg-4 justify-content-center"><img
src="<?= self::getResourcePath() ?>img/markers/marker-dispatcher.png "> <label
class="font-16"> ... Schacht/Verteiler</label></div>
<div class="col-lg-4"><img
src="<?= self::getResourcePath() ?>img/markers/marker-greenfield.png "> <label
class="font-16"> ... Greenfield</label></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Schließen</button>
</div>
</div>
</div>
</div>
<?php
?>
<script type="text/javascript">
var marker = [];
var polylinec;
var polyline;
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://mapsneu.wien.gv.at/basemap/{id}/normal/google3857/{z}/{y}/{x}.{imgtype}', {
maxZoom: 19,
id: "bmaporthofoto30cm",
imgtype: "jpeg"
}).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'] ?>, '<?= $marker['color'] ?>', '<?= $marker['type'] ?>']
<?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(locations);
$('#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://mapsneu.wien.gv.at/basemap/{id}/normal/google3857/{z}/{y}/{x}.{imgtype}', {
maxZoom: 19,
id: "geolandbasemap",
imgtype: "png"
}).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++) {
if (locations[i][4] == "Greenfield") {
icon_name = "garden";
icon_color = "#abbaf0";
} else if (locations[i][4] == "Pop") {
icon_name = "village";
icon_color = "#acf0ab";
} else if (locations[i][4] == "Building") {
icon_name = "home";
icon_color = "#f0abab";
} else {
icon_name = "home";
icon_color = "#e9f0ab";
}
icon = L.MakiMarkers.icon({icon: icon_name, color: icon_color, size: "l"});
marker.push(L.marker([locations[i][1], locations[i][2]], {icon: icon}).addTo(map).bindPopup(locations[i][0]));
if (oldlong) {
polylinec = [
[oldlat, oldlong],
[locations[i][1], locations[i][2]]
];
polyline = L.polyline(polylinec, {color: locations[i][3]}).addTo(map);
//polyline.bindTooltip(locations[i][4], {permanent: true});
polyline = null;
}
oldlong = locations[i][2];
oldlat = locations[i][1];
}
if (locations.length > 1) {
fitmap = 1;
}
});
$('#pipemap').on('shown.bs.modal', function (event) {
map.invalidateSize();
var group = new L.featureGroup(marker);
map.fitBounds(group.getBounds());
});
});
</script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>