Faserplanung
* Schächte/Verteiler
This commit is contained in:
244
Layout/default/FiberPlanDispatcher/Form.php
Normal file
244
Layout/default/FiberPlanDispatcher/Form.php
Normal 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=""> </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"); ?>
|
||||||
122
Layout/default/FiberPlanDispatcher/Index.php
Normal file
122
Layout/default/FiberPlanDispatcher/Index.php
Normal 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"); ?>
|
||||||
59
application/FiberPlanDispatcher/FiberPlanDispatcher.php
Normal file
59
application/FiberPlanDispatcher/FiberPlanDispatcher.php
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
137
application/FiberPlanDispatcher/FiberPlanDispatcherModel.php
Normal file
137
application/FiberPlanDispatcher/FiberPlanDispatcherModel.php
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user