Features Netzbau-> Dateiablage und Stammdaten->Pops hinzugefügt
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -44,3 +44,5 @@ Thumbs.db
|
||||
*.bak
|
||||
*.swp
|
||||
|
||||
/Layout/default/DeviceDetail/
|
||||
/Layout/default/DeviceDetail/
|
||||
|
||||
182
Layout/default/Device/Detail.php
Normal file
182
Layout/default/Device/Detail.php
Normal file
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
?>
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
|
||||
<style>
|
||||
.card-border {
|
||||
|
||||
border-left: 1px solid #428bca;
|
||||
border-left-width: 5px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<!-- 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("Device") ?>">Devices</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Devices Detail</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Device <?= $devices->data->name ?> <span class="ml-2">
|
||||
<a href="<?= self::getUrl("Device", "edit", ["id" => $devices->id]) ?>">
|
||||
<button class="btn btn-primary">Bearbeiten</button>
|
||||
</a>
|
||||
</span></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
<?php
|
||||
|
||||
if (!empty($devices->price)) {
|
||||
$price = $devices->price;
|
||||
} else {
|
||||
$price = $devices->devicetype->price;
|
||||
}
|
||||
?>
|
||||
<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>Device Name</th>
|
||||
<td><?= $devices->name ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>IP-Adresse</th>
|
||||
<td><?= $devices->ip ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Geräte Typ</th>
|
||||
<td><?= $devices->devicetype->name ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Geräte Hersteller</th>
|
||||
<td><?= $devices->devicetype->devicemanufactor->name ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Mac Adresse</th>
|
||||
<td><?= $devices->mac ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Seriennummer</th>
|
||||
<td><?= $devices->serial ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Preis</th>
|
||||
<td><?= $price ?> €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Bemerkung</th>
|
||||
<td><?= nl2br($devices->comment) ?> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-4 card-border">
|
||||
<div>
|
||||
<h4>Standort Informationen</h4>
|
||||
</div>
|
||||
<?php
|
||||
if (!empty(trim($devices->pop->name))) {
|
||||
?>
|
||||
<div>
|
||||
<table class="table table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Pop Name</th>
|
||||
<td><?= $devices->pop->name ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Adresse</th>
|
||||
<td>
|
||||
<a title="Google-Maps: <?= rtrim($devices->pop->gps_lat, '0') ?> , <?= $devices->pop->gps_long ?>"
|
||||
class="mapsLink"
|
||||
href="http://maps.google.com/?q=<?= $devices->pop->gps_lat ?> , <?= $devices->pop->gps_long ?>"
|
||||
target="_blank"><?= rtrim($devices->pop->gps_lat, '0') ?>
|
||||
, <?= rtrim($devices->pop->gps_long, 0) ?></a></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<h5 class="text-center">Keine Standort Informationen vorhanden</h5>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-3 card-border">
|
||||
<div>
|
||||
<h4>Config Backups</h4>
|
||||
</div>
|
||||
<?php
|
||||
if (!empty($configs)) {
|
||||
?>
|
||||
<div>
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Datum/Uhrzeit</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<h5 class="text-center">Keine Configs vorhanden</h5>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
133
Layout/default/Device/Form.php
Normal file
133
Layout/default/Device/Form.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
|
||||
<!-- 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("Device") ?>">Devices</a></li>
|
||||
<li class="breadcrumb-item active"><?= ($device->id) ? "bearbeiten" : "Neu" ?></li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Geräte</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2"><?= ($device->id) ? "Device bearbeiten" : "Neues Gerät" ?></h4>
|
||||
|
||||
<form class="form-horizontal" method="post"
|
||||
action="<?= self::getUrl("Device", "save") ?>">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<input type="hidden" name="id" value="<?= $device->id ?>"/>
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="name">Name *</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="name" id="name"
|
||||
value="<?= $device->name ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="devicetype_id">Gerätetyp *</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="devicetype_id" id="devicetype_id">
|
||||
<option></option>
|
||||
<?php foreach ($devicetypes as $devicetype): ?>
|
||||
<option value="<?= $devicetype->id ?>" <?= ($device->devicetype_id == $devicetype->id) ? "selected='selected'" : "" ?>><?= ($devicetype->devicemanufactor->name . " " . $devicetype->name) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="pop_id">Pop</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="pop_id" id="pop_id">
|
||||
<option></option>
|
||||
<?php foreach ($pops as $pop): ?>
|
||||
<option value="<?= $pop->id ?>" <?= ($device->pop_id == $pop->id) ? "selected='selected'" : "" ?>><?= ($pop->devicemanufactor->name . " " . $pop->name) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="ip">IP-Adresse *</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="ip" id="ip" placeholder="10.0.0.1"
|
||||
value="<?= $device->ip ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="mac">MAC-Adresse</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="mac" id="mac" placeholder=""
|
||||
value="<?= $device->mac ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="serial">Seriennummer</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="serial" id="serial" placeholder=""
|
||||
value="<?= $device->serial ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="comment">Bemerkung</label>
|
||||
<div class="col-lg-10">
|
||||
<textarea class="form-control" id="comment" name="comment"
|
||||
rows="3"><?= $device->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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$("#devicemanufactor_id").select2({
|
||||
allowClear: true,
|
||||
placeholder: ""
|
||||
});
|
||||
$("#addresstypes").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')
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
220
Layout/default/Device/Index.php
Normal file
220
Layout/default/Device/Index.php
Normal file
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
$pagination_baseurl = $this->getUrl($Mod, "Index");
|
||||
$pagination_baseurl_params = ["filter" => $filter];
|
||||
$pagination_entity_name = "Device";
|
||||
?>
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
|
||||
<style>
|
||||
#filterrow input {
|
||||
width: 100%;
|
||||
padding: 3px;
|
||||
box-sizing: border-box;
|
||||
display: table-header-group;
|
||||
height: unset;
|
||||
}
|
||||
|
||||
.dataTables_wrapper .dataTables_filter {
|
||||
float: left;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.dataTables_wrapper .dataTables_length {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.clear-fa {
|
||||
margin-left: 5px;
|
||||
font-size: 23px;
|
||||
vertical-align: middle;
|
||||
color: #cb2929;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.margina {
|
||||
margin-left: 30px !important;
|
||||
margin-top: -5px;
|
||||
}
|
||||
</style>
|
||||
<!-- 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">Devices</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Devices</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 Devices</h4>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<a class="btn btn-primary mb-2" href="<?= self::getUrl("Device", "add") ?>"><i
|
||||
class="fas fa-plus"></i> Neues Device 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">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Geräte Name</th>
|
||||
<th class="text-center">Geräte Typ</th>
|
||||
<th class="text-center">Hersteller</th>
|
||||
<th class="text-center">Pop</th>
|
||||
<th class="text-center">IP-Adresse</th>
|
||||
<th class="text-center">Mac-Adresse</th>
|
||||
<th class="text-center">Seriennummer</th>
|
||||
<th class="text-center">Preis</th>
|
||||
<th class="text-center">max. Leistung</th>
|
||||
<th class="w15"></th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
foreach ($devices as $device):
|
||||
if (!empty($device->price)) {
|
||||
$price = $device->price;
|
||||
} else {
|
||||
$price = $device->devicetype->price;
|
||||
}
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?= self::getUrl("Device", "detail", ["id" => $device->id]) ?>"><?= $device->name ?></a>
|
||||
</td>
|
||||
<td class="text-center"><?= $device->devicetype->name ?></td>
|
||||
<td class="text-center"><?= $device->devicetype->devicemanufactor->name ?></td>
|
||||
<td class="text-center"><?= $device->pop->name ?></td>
|
||||
|
||||
|
||||
<td class="text-center"><?= $device->ip ?></td>
|
||||
<td class="text-center"><?= $device->mac ?></td>
|
||||
<td class="text-center"><?= $device->serial ?></td>
|
||||
<td class="text-right"><?= $price ?> €</td>
|
||||
<td class="text-right"><?= $device->devicetype->power ?> Watt</td>
|
||||
|
||||
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em; width: 80px">
|
||||
<a href="<?= self::getUrl("Device", "edit", ["id" => $device->id]) ?>"><i
|
||||
class="far fa-edit" title="Bearbeiten"></i></a>
|
||||
<a href="<?= self::getUrl("Device", "delete", ["id" => $device->id]) ?>"
|
||||
onclick="if(!confirm('Device wirklich löschen?')) return false;" class="text-danger"
|
||||
title="Löschen"><i class="fas fa-trash "></i></a>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
|
||||
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
|
||||
<!---->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
let table;
|
||||
$('#filterrow th').each(function (i) {
|
||||
let title = $('#datatable thead th').eq($(this).index()).text();
|
||||
|
||||
if ($(this).index() == "9") {
|
||||
|
||||
} else {
|
||||
$(this).html('<input type="text" placeholder="' + title + '" class="form-control" data-index="' + i + '" value="" />');
|
||||
}
|
||||
});
|
||||
|
||||
table = $('#datatable').DataTable({
|
||||
buttons: [
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
text: 'XLSX Export',
|
||||
className: 'btn-success margina'
|
||||
|
||||
}
|
||||
],
|
||||
orderCellsTop: true,
|
||||
stateSave: true,
|
||||
"initComplete": function () {
|
||||
$('#datatable_filter').append('<i id="clear_cookie" class="fas fa-times clear-fa" title="Filter löschen" aria-hidden="true" ></i>');
|
||||
$('#clear_cookie').click(function () {
|
||||
$('input').val('');
|
||||
|
||||
table.search('').columns().search('').draw();
|
||||
});
|
||||
},
|
||||
"dom": 'flBrtip'
|
||||
|
||||
});
|
||||
|
||||
$('#filterrow').on('keyup', 'input', function () {
|
||||
|
||||
table
|
||||
.column($(this).data('index'))
|
||||
.search(this.value)
|
||||
.draw();
|
||||
|
||||
|
||||
});
|
||||
var state = table.state.loaded();
|
||||
if (state) {
|
||||
table.columns().eq(0).each(function (colIdx) {
|
||||
var colSearch = state.columns[colIdx].search;
|
||||
|
||||
if (colSearch.search) {
|
||||
|
||||
|
||||
$('#filterrow').find("[data-index='" + colIdx + "']").val(colSearch.search);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
table.draw();
|
||||
}
|
||||
$(document).ready(function () {
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
84
Layout/default/Devicemanufactor/Form.php
Normal file
84
Layout/default/Devicemanufactor/Form.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
|
||||
<!-- 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("Devicemanufactor") ?>">Gerätehersteller</a></li>
|
||||
<li class="breadcrumb-item active"><?= ($devicemanufactors->id) ? "bearbeiten" : "Neu" ?></li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title"><?= ($devicemanufactors->id) ? "Gerätehersteller bearbeiten" : "Neuer Gerätehersteller" ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2"><?= ($devicemanufactors->id) ? "Gerätehersteller bearbeiten" : "Neuer Gerätehersteller" ?></h4>
|
||||
|
||||
<form class="form-horizontal" method="post"
|
||||
action="<?= self::getUrl("Devicemanufactor", "save") ?>">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<input type="hidden" name="id" value="<?= $devicemanufactors->id ?>"/>
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="name">Name</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="name" id="name"
|
||||
value="<?= $devicemanufactors->name ?>">
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$("#parent_id").select2({
|
||||
allowClear: true,
|
||||
placeholder: ""
|
||||
});
|
||||
$("#addresstypes").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')
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
186
Layout/default/Devicemanufactor/Index.php
Normal file
186
Layout/default/Devicemanufactor/Index.php
Normal file
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
$pagination_baseurl = $this->getUrl($Mod, "Index");
|
||||
$pagination_baseurl_params = ["filter" => $filter];
|
||||
$pagination_entity_name = "Devicemanufactor";
|
||||
?>
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
|
||||
<style>
|
||||
#filterrow input {
|
||||
width: 100%;
|
||||
padding: 3px;
|
||||
box-sizing: border-box;
|
||||
display: table-header-group;
|
||||
height: unset;
|
||||
}
|
||||
|
||||
.dataTables_wrapper .dataTables_filter {
|
||||
float: left;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.dataTables_wrapper .dataTables_length {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.clear-fa {
|
||||
margin-left: 5px;
|
||||
font-size: 23px;
|
||||
vertical-align: middle;
|
||||
color: #cb2929;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.margina {
|
||||
margin-left: 30px !important;
|
||||
margin-top: -5px;
|
||||
}
|
||||
|
||||
.edit-weight {
|
||||
width: 50px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 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">Gerätehersteller</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Gerätehersteller</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 Gerätehersteller</h4>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<a class="btn btn-primary mb-2" href="<?= self::getUrl("Devicemanufactor", "add") ?>"><i
|
||||
class="fas fa-plus"></i> Neuen Gerätehersteller 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">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Name</th>
|
||||
<th class="text-center">Erstellt von</th>
|
||||
<th class="edit-weight"></th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($devicemanufactors as $devicemanufactor): ?>
|
||||
|
||||
<tr>
|
||||
<td><?= $devicemanufactor->name ?></td>
|
||||
<td><?= $devicemanufactor->creator->name ?>
|
||||
(<?= date("d.m.Y , H:i", $devicemanufactor->create) ?>)
|
||||
</td>
|
||||
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?= self::getUrl("Devicemanufactor", "edit", ["id" => $devicemanufactor->id]) ?>"><i
|
||||
class="far fa-edit" title="Bearbeiten"></i></a>
|
||||
<a href="<?= self::getUrl("Devicemanufactor", "delete", ["id" => $devicemanufactor->id]) ?>"
|
||||
onclick="if(!confirm('Gerätehersteller 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">
|
||||
let table;
|
||||
$('#filterrow th').each(function (i) {
|
||||
let title = $('#datatable thead th').eq($(this).index()).text();
|
||||
|
||||
if ($(this).index() == "2") {
|
||||
|
||||
} else {
|
||||
$(this).html('<input type="text" placeholder="' + title + '" class="form-control" data-index="' + i + '" value="" />');
|
||||
}
|
||||
});
|
||||
|
||||
table = $('#datatable').DataTable({
|
||||
buttons: [
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
text: 'XLSX Export',
|
||||
className: 'btn-success margina'
|
||||
|
||||
}
|
||||
],
|
||||
orderCellsTop: true,
|
||||
stateSave: true,
|
||||
"initComplete": function () {
|
||||
$('#datatable_filter').append('<i id="clear_cookie" class="fas fa-times clear-fa" title="Filter löschen" aria-hidden="true" ></i>');
|
||||
$('#clear_cookie').click(function () {
|
||||
$('input').val('');
|
||||
|
||||
table.search('').columns().search('').draw();
|
||||
});
|
||||
},
|
||||
"dom": 'flBrtip'
|
||||
|
||||
});
|
||||
|
||||
$('#filterrow').on('keyup', 'input', function () {
|
||||
|
||||
table
|
||||
.column($(this).data('index'))
|
||||
.search(this.value)
|
||||
.draw();
|
||||
|
||||
|
||||
});
|
||||
var state = table.state.loaded();
|
||||
if (state) {
|
||||
table.columns().eq(0).each(function (colIdx) {
|
||||
var colSearch = state.columns[colIdx].search;
|
||||
|
||||
if (colSearch.search) {
|
||||
|
||||
|
||||
$('#filterrow').find("[data-index='" + colIdx + "']").val(colSearch.search);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
table.draw();
|
||||
}
|
||||
$(document).ready(function () {
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
112
Layout/default/Devicetype/Form.php
Normal file
112
Layout/default/Devicetype/Form.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
|
||||
<!-- 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("Devicetype") ?>">Gerätetyp</a></li>
|
||||
<li class="breadcrumb-item active"><?= ($devicetypes->id) ? "bearbeiten" : "Neu" ?></li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title"><?= ($devicetypes->id) ? "Gerätetyp bearbeiten" : "Neuer Gerätetyp" ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2"><?= ($devicetypes->id) ? "Gerätetyp bearbeiten" : "Neuer Gerätetyp" ?></h4>
|
||||
|
||||
<form class="form-horizontal" method="post"
|
||||
action="<?= self::getUrl("Devicetype", "save") ?>">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<input type="hidden" name="id" value="<?= $devicetypes->id ?>"/>
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="name">Name *</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="name" id="name"
|
||||
value="<?= $devicetypes->name ?>" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="devicemanufactor_id">Hersteller *</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="devicemanufactor_id" id="devicemanufactor_id">
|
||||
<option></option>
|
||||
<?php foreach ($devicemanufactors as $devicemanufactor): ?>
|
||||
<option value="<?= $devicemanufactor->id ?>" <?= ($devicetypes->devicemanufactor_id == $devicemanufactor->id) ? "selected='selected'" : "" ?>><?= ($devicemanufactor->name) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="price">Preis</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="number" min="0" step=".01" class="form-control" name="price" id="price" placeholder="100,00"
|
||||
value="<?= $devicetypes->price ?>" >
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="power">max. Leistung</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="number" min="0" step=".1" class="form-control" name="power" id="power" placeholder="in Watt"
|
||||
value="<?= $devicetypes->power ?>">
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$("#devicemanufactor_id").select2({
|
||||
allowClear: true,
|
||||
placeholder: ""
|
||||
});
|
||||
$("#addresstypes").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')
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
202
Layout/default/Devicetype/Index.php
Normal file
202
Layout/default/Devicetype/Index.php
Normal file
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
$pagination_baseurl = $this->getUrl($Mod, "Index");
|
||||
$pagination_baseurl_params = ["filter" => $filter];
|
||||
$pagination_entity_name = "Devicetype";
|
||||
?>
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
|
||||
<style>
|
||||
#filterrow input {
|
||||
width: 100%;
|
||||
padding: 3px;
|
||||
box-sizing: border-box;
|
||||
display: table-header-group;
|
||||
height: unset;
|
||||
}
|
||||
|
||||
.dataTables_wrapper .dataTables_filter {
|
||||
float: left;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.dataTables_wrapper .dataTables_length {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.clear-fa {
|
||||
margin-left: 5px;
|
||||
font-size: 23px;
|
||||
vertical-align: middle;
|
||||
color: #cb2929;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.margina {
|
||||
margin-left: 30px !important;
|
||||
margin-top: -5px;
|
||||
}
|
||||
.edit-weight {
|
||||
width: 50px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 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">Gerätetyp</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Gerätetyp</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 Gerätetypen</h4>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<a class="btn btn-primary mb-2" href="<?= self::getUrl("Devicetype", "add") ?>"><i
|
||||
class="fas fa-plus"></i> Neuen Gerätetyp 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">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th class="text-center">Hersteller</th>
|
||||
<th class="text-right">Preis</th>
|
||||
<th class="text-right">max. Leistung</th>
|
||||
<th class="text-right">erstellt von</th>
|
||||
<th class="edit-weight"></th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th>Name</th>
|
||||
<th>Hersteller</th>
|
||||
<th>Preis</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($devicetypes as $devicetype): ?>
|
||||
|
||||
<tr>
|
||||
<td><?= $devicetype->name ?></td>
|
||||
<td class="text-center"><?= $devicetype->devicemanufactor->name ?></td>
|
||||
|
||||
<td class="text-right"><?= $devicetype->price ?> €</td>
|
||||
<td class="text-right"><?= $devicetype->power ?> Watt</td>
|
||||
<td class="text-right"><?= $devicetype->creator->name ?>
|
||||
(<?= date("d.m.Y , H:i", $devicetype->create) ?>)
|
||||
</td>
|
||||
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?= self::getUrl("Devicetype", "edit", ["id" => $devicetype->id]) ?>"><i
|
||||
class="far fa-edit" title="Bearbeiten"></i></a>
|
||||
<a href="<?= self::getUrl("Devicetype", "delete", ["id" => $devicetype->id]) ?>"
|
||||
onclick="if(!confirm('Gerätetyp wirklich löschen?')) return false;" class="text-danger"
|
||||
title="Löschen"><i class="fas fa-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
|
||||
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
|
||||
<!---->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
let table;
|
||||
$('#filterrow th').each(function (i) {
|
||||
let title = $('#datatable thead th').eq($(this).index()).text();
|
||||
|
||||
if ($(this).index() == "5") {
|
||||
|
||||
} else {
|
||||
$(this).html('<input type="text" placeholder="' + title + '" class="form-control" data-index="' + i + '" value="" />');
|
||||
}
|
||||
});
|
||||
|
||||
table = $('#datatable').DataTable({
|
||||
buttons: [
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
text: 'XLSX Export',
|
||||
className: 'btn-success margina'
|
||||
|
||||
}
|
||||
],
|
||||
orderCellsTop: true,
|
||||
stateSave: true,
|
||||
"initComplete": function () {
|
||||
$('#datatable_filter').append('<i id="clear_cookie" class="fas fa-times clear-fa" title="Filter löschen" aria-hidden="true" ></i>');
|
||||
$('#clear_cookie').click(function () {
|
||||
$('input').val('');
|
||||
|
||||
table.search('').columns().search('').draw();
|
||||
});
|
||||
},
|
||||
"dom": 'flBrtip'
|
||||
|
||||
});
|
||||
|
||||
$('#filterrow').on('keyup', 'input', function () {
|
||||
|
||||
table
|
||||
.column($(this).data('index'))
|
||||
.search(this.value)
|
||||
.draw();
|
||||
|
||||
|
||||
});
|
||||
var state = table.state.loaded();
|
||||
if (state) {
|
||||
table.columns().eq(0).each(function (colIdx) {
|
||||
var colSearch = state.columns[colIdx].search;
|
||||
|
||||
if (colSearch.search) {
|
||||
|
||||
|
||||
$('#filterrow').find("[data-index='" + colIdx + "']").val(colSearch.search);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
table.draw();
|
||||
}
|
||||
$(document).ready(function () {
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
182
Layout/default/Pop/Detail.php
Normal file
182
Layout/default/Pop/Detail.php
Normal file
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
?>
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
|
||||
<style>
|
||||
.card-border {
|
||||
|
||||
border-left: 1px solid #428bca;
|
||||
border-left-width: 5px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<!-- 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("Device") ?>">Devices</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Devices Detail</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Device <?= $devices->data->name ?> <span class="ml-2">
|
||||
<a href="<?= self::getUrl("Device", "edit", ["id" => $devices->id]) ?>">
|
||||
<button class="btn btn-primary">Bearbeiten</button>
|
||||
</a>
|
||||
</span></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
<?php
|
||||
|
||||
if (!empty($devices->price)) {
|
||||
$price = $devices->price;
|
||||
} else {
|
||||
$price = $devices->devicetype->price;
|
||||
}
|
||||
?>
|
||||
<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>Device Name</th>
|
||||
<td><?= $devices->name ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>IP-Adresse</th>
|
||||
<td><?= $devices->ip ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Geräte Typ</th>
|
||||
<td><?= $devices->devicetype->name ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Geräte Hersteller</th>
|
||||
<td><?= $devices->devicetype->devicemanufactor->name ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Mac Adresse</th>
|
||||
<td><?= $devices->mac ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Seriennummer</th>
|
||||
<td><?= $devices->serial ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Preis</th>
|
||||
<td><?= $price ?> €</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Bemerkung</th>
|
||||
<td><?= nl2br($devices->comment) ?> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-4 card-border">
|
||||
<div>
|
||||
<h4>Standort Informationen</h4>
|
||||
</div>
|
||||
<?php
|
||||
if (!empty(trim($devices->pop->name))) {
|
||||
?>
|
||||
<div>
|
||||
<table class="table table-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Pop Name</th>
|
||||
<td><?= $devices->pop->name ?> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Adresse</th>
|
||||
<td>
|
||||
<a title="Google-Maps: <?= rtrim($devices->pop->gps_lat, '0') ?> , <?= $devices->pop->gps_long ?>"
|
||||
class="mapsLink"
|
||||
href="http://maps.google.com/?q=<?= $devices->pop->gps_lat ?> , <?= $devices->pop->gps_long ?>"
|
||||
target="_blank"><?= rtrim($devices->pop->gps_lat, '0') ?>
|
||||
, <?= rtrim($devices->pop->gps_long, 0) ?></a></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<h5 class="text-center">Keine Standort Informationen vorhanden</h5>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-3 card-border">
|
||||
<div>
|
||||
<h4>Config Backups</h4>
|
||||
</div>
|
||||
<?php
|
||||
if (!empty($configs)) {
|
||||
?>
|
||||
<div>
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Datum/Uhrzeit</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<h5 class="text-center">Keine Configs vorhanden</h5>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
@@ -6,6 +6,37 @@ $pagination_entity_name = "Pops";
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
|
||||
|
||||
<style>
|
||||
#filterrow input {
|
||||
width: 100%;
|
||||
padding: 3px;
|
||||
box-sizing: border-box;
|
||||
display: table-header-group;
|
||||
height: unset;
|
||||
}
|
||||
|
||||
.dataTables_wrapper .dataTables_filter {
|
||||
float: left;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.dataTables_wrapper .dataTables_length {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.clear-fa {
|
||||
margin-left: 5px;
|
||||
font-size: 23px;
|
||||
vertical-align: middle;
|
||||
color: #cb2929;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.margina {
|
||||
margin-left: 30px !important;
|
||||
margin-top: -5px;
|
||||
}
|
||||
</style>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@@ -32,16 +63,17 @@ $pagination_entity_name = "Pops";
|
||||
<h4 class="header-title">Liste aller Pops</h4>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<a class="btn btn-primary mb-2" href="<?= self::getUrl("Pop", "add",['returnto' => "pop"]) ?>"><i
|
||||
<a class="btn btn-primary mb-2" href="<?= self::getUrl("Pop", "add", ['returnto' => "pop"]) ?>"><i
|
||||
class="fas fa-plus"></i> Neuen Pop anlegen</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
|
||||
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
|
||||
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
|
||||
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
|
||||
|
||||
<table class="table table-striped table-hover">
|
||||
<table id="datatable" class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Netgebiet</th>
|
||||
@@ -49,8 +81,19 @@ $pagination_entity_name = "Pops";
|
||||
<th>Vlan Public/Nat</th>
|
||||
<th>Koordinaten</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($pops as $pop): ?>
|
||||
|
||||
<tr>
|
||||
@@ -58,20 +101,28 @@ $pagination_entity_name = "Pops";
|
||||
<td><?= $pop->network->name ?></td>
|
||||
<td><?= $pop->location ?></td>
|
||||
<td class="text-center"><?= $pop->vlan_public ?> / <?= $pop->vlan_nat ?></td>
|
||||
<td class="text-center"><a title="Google-Maps: <?= rtrim($pop->gps_lat,'0') ?> , <?= $pop->gps_long ?>" class="mapsLink" href="http://maps.google.com/?q=<?= $pop->gps_lat ?> , <?= $pop->gps_long ?>" target="_blank"><?= rtrim($pop->gps_lat,'0') ?> , <?= rtrim($pop->gps_long,0) ?></a></td>
|
||||
<td class="text-center"><a
|
||||
title="Google-Maps: <?= rtrim($pop->gps_lat, '0') ?> , <?= $pop->gps_long ?>"
|
||||
class="mapsLink"
|
||||
href="http://maps.google.com/?q=<?= $pop->gps_lat ?> , <?= $pop->gps_long ?>"
|
||||
target="_blank"><?= rtrim($pop->gps_lat, '0') ?>
|
||||
, <?= rtrim($pop->gps_long, 0) ?></a></td>
|
||||
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?=self::getUrl("Pop", "edit", ["id" => $pop->id, 'returnto' => "pop"])?>"><i class="far fa-edit" title="Bearbeiten"></i></a>
|
||||
<a href="<?=self::getUrl("Pop", "index")?>" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
|
||||
<a href="<?= self::getUrl("Pop", "edit", ["id" => $pop->id, 'returnto' => "pop"]) ?>"><i
|
||||
class="far fa-edit" title="Bearbeiten"></i></a>
|
||||
<a href="<?= self::getUrl("Pop", "index") ?>" class="text-danger" title="Löschen"><i
|
||||
class="fas fa-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
|
||||
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
|
||||
<!---->
|
||||
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination-summary.php"); ?>
|
||||
<!-- --><?php //include(realpath(dirname(__FILE__) . "/../") . "/tpl/pagination.php"); ?>
|
||||
<!---->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -243,6 +294,68 @@ $pagination_entity_name = "Pops";
|
||||
<?php if(is_array($filter) && count($filter)): ?>
|
||||
//refreshMap();
|
||||
<?php endif; ?>
|
||||
let table;
|
||||
$('#filterrow th').each(function (i) {
|
||||
let title = $('#datatable thead th').eq($(this).index()).text();
|
||||
|
||||
if ($(this).index() == "5") {
|
||||
|
||||
} else {
|
||||
$(this).html('<input type="text" placeholder="' + title + '" class="form-control" data-index="' + i + '" value="" />');
|
||||
}
|
||||
});
|
||||
|
||||
table = $('#datatable').DataTable({
|
||||
buttons: [
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
text: 'XLSX Export',
|
||||
className: 'btn-success margina'
|
||||
|
||||
}
|
||||
],
|
||||
orderCellsTop: true,
|
||||
stateSave: true,
|
||||
"initComplete": function () {
|
||||
$('#datatable_filter').append('<i id="clear_cookie" class="fas fa-times clear-fa" title="Filter löschen" aria-hidden="true" ></i>');
|
||||
$('#clear_cookie').click(function () {
|
||||
$('input').val('');
|
||||
|
||||
table.search('').columns().search('').draw();
|
||||
});
|
||||
},
|
||||
"dom": 'flBrtip'
|
||||
|
||||
});
|
||||
|
||||
$('#filterrow').on('keyup', 'input', function () {
|
||||
|
||||
table
|
||||
.column($(this).data('index'))
|
||||
.search(this.value)
|
||||
.draw();
|
||||
|
||||
|
||||
});
|
||||
var state = table.state.loaded();
|
||||
if (state) {
|
||||
table.columns().eq(0).each(function (colIdx) {
|
||||
var colSearch = state.columns[colIdx].search;
|
||||
|
||||
if (colSearch.search) {
|
||||
|
||||
|
||||
$('#filterrow').find("[data-index='" + colIdx + "']").val(colSearch.search);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
table.draw();
|
||||
}
|
||||
$(document).ready(function () {
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<link href="<?=self::getResourcePath()?>assets/css/bootstrap-select.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?=self::getResourcePath()?>css/bootstrap-datepicker3.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?=self::getResourcePath()?>plugins/summernote/summernote-bs4.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?=self::getResourcePath()?>datatables/datatables.min.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<script type="text/javascript" src="<?=self::getResourcePath()?>js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="<?=self::getResourcePath()?>assets/libs/select2/select2.min.js"></script>
|
||||
@@ -30,6 +31,8 @@
|
||||
<script type="text/javascript" src="<?=self::getResourcePath()?>js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="<?=self::getResourcePath()?>assets/js/bootstrap-select.min.js"></script>
|
||||
<script type="text/javascript" src="<?=self::getResourcePath()?>js/bootstrap-autocomplete.min.js"></script>
|
||||
<script type="text/javascript" src="<?=self::getResourcePath()?>datatables/datatables.min.js"></script>
|
||||
|
||||
|
||||
<?php if(MFAPPNAME == "devthetool"): ?>
|
||||
<style type="text/css">
|
||||
|
||||
@@ -35,7 +35,10 @@
|
||||
<li><a href="<?=self::getUrl("Producttech")?>"><i class="fad fa-microchip text-info"></i> Technologien</a></li>
|
||||
<li><a href="<?=self::getUrl("User")?>"><i class="fad fa-users text-info"></i> Benutzer</a></li>
|
||||
<li><a href="<?=self::getUrl("Network")?>"><i class="fad fa-network-wired text-info"></i> Netzgebiete</a></li>
|
||||
<li><a href="<?=self::getUrl("Pop")?>"><i class="fad fa-house text-info"></i> Pops</a></li>
|
||||
<li class="has-sub-submenu"><a href="<?=self::getUrl("Pop")?>"><i class="fad fa-house text-info"></i> Pops</a></li>
|
||||
<li ><a href="<?=self::getUrl("Devicemanufactor")?>"><i class="fad fa-router text-info"></i> Geräte Hersteller</a></li>
|
||||
<li><a href="<?=self::getUrl("Devicetype")?>"><i class="fad fa-router text-info"></i> Geräte Typen</a></li>
|
||||
<li><a href="<?=self::getUrl("Device")?>"><i class="fad fa-router text-info"></i> Devices</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
41
application/Device/Device.php
Normal file
41
application/Device/Device.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
class Device extends mfBaseModel
|
||||
{
|
||||
private $editor;
|
||||
private $creator;
|
||||
private $devicetype;
|
||||
private $pop;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
149
application/Device/DeviceController.php
Normal file
149
application/Device/DeviceController.php
Normal file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
|
||||
class DeviceController 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("Device/Index");
|
||||
$devices = DeviceModel::getAll();
|
||||
$this->layout()->set("devices", $devices);
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected function detailAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Gerät nicht gefunden", "error");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
|
||||
$device = new Device($id);
|
||||
if ($device->id != $id) {
|
||||
$this->layout()->setFlash("Gerät nicht gefunden", "error");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
|
||||
$this->layout()->setTemplate("Device/Detail");
|
||||
$devices = DeviceModel::getOne($id);
|
||||
$this->layout()->set("devices", $devices);
|
||||
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
$this->layout()->setTemplate("Device/Form");
|
||||
$this->layout()->set("devicetypes", DevicetypeModel::getAll());
|
||||
$this->layout()->set("pops", PopModel::getAll());
|
||||
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Gerät nicht gefunden", "error");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
|
||||
$device = new Device($id);
|
||||
if ($device->id != $id) {
|
||||
$this->layout()->setFlash("Gerät nicht gefunden", "error");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
|
||||
$this->layout()->set("device", $device);
|
||||
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";
|
||||
$device = new Device($id);
|
||||
if (!$device->id) {
|
||||
$this->layout()->setFlash("Gerät nicht gefunden", "error");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['name'] = trim($r->name);
|
||||
$data['devicetype_id'] = $r->devicetype_id;
|
||||
|
||||
if (empty(trim($r->pop_id))) {
|
||||
$data['pop_id'] = NULL;
|
||||
} else {
|
||||
$data['pop_id'] = $r->pop_id;
|
||||
}
|
||||
|
||||
$data['ip'] = $r->ip;
|
||||
$data['mac'] = $r->mac;
|
||||
$data['serial'] = $r->serial;
|
||||
$data['comment'] = $r->comment;
|
||||
$ipv4_validation_regex = "/^(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/";
|
||||
|
||||
if (!$data['name']) {
|
||||
$this->layout()->setFlash("Name darf nicht leer sein", "error");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
|
||||
if (!$data['ip']) {
|
||||
$this->layout()->setFlash("IP-Adresse darf nicht leer sein", "error");
|
||||
$this->redirect("Device");
|
||||
} else if (!preg_match($ipv4_validation_regex, trim($data['ip']))) {
|
||||
$this->layout()->setFlash("IP-Adresse ist nicht gültig", "error");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
|
||||
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
|
||||
if ($mode == "edit") {
|
||||
$device->update($data);
|
||||
|
||||
} else {
|
||||
$device = DeviceModel::create($data);
|
||||
}
|
||||
// var_dump($device);
|
||||
// exit;
|
||||
$id = $device->save();
|
||||
|
||||
if (!$id) {
|
||||
$this->layout()->setFlash("Gerät konnte nicht angelegt werden", "error");
|
||||
$this->redirect("Device");
|
||||
}
|
||||
if ($mode == "edit") {
|
||||
$this->layout()->setFlash("Geräte erfolgreich geändert", "success");
|
||||
} else if ($mode = "add") {
|
||||
$this->layout()->setFlash("Geräte erfolgreich angelegt", "success");
|
||||
}
|
||||
$this->redirect("Device");
|
||||
}
|
||||
}
|
||||
128
application/Device/DeviceModel.php
Normal file
128
application/Device/DeviceModel.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
class DeviceModel
|
||||
{
|
||||
public $name = null;
|
||||
public $ip = null;
|
||||
public $mac = null;
|
||||
public $serial= null;
|
||||
public $comment= null;
|
||||
public $devicetype_id = null;
|
||||
public $pop_id = 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 Device();
|
||||
|
||||
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("Device", "*", "id=$id LIMIT 1");
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Device($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("Device", "*");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Device($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst() {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("Device", "*", "$where ORDER BY name, network_id");
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Device($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("Device", "*", "$where ORDER BY name, network_id");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Device($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;
|
||||
}
|
||||
}
|
||||
39
application/Devicemanufactor/Devicemanufactor.php
Normal file
39
application/Devicemanufactor/Devicemanufactor.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
class Devicemanufactor 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;
|
||||
}
|
||||
|
||||
}
|
||||
122
application/Devicemanufactor/DevicemanufactorController.php
Normal file
122
application/Devicemanufactor/DevicemanufactorController.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
class DevicemanufactorController 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("Devicemanufactor/Index");
|
||||
$devicemanufactors = DevicemanufactorModel::getAll();
|
||||
$this->layout()->set("devicemanufactors", $devicemanufactors);
|
||||
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
$this->layout()->setTemplate("Devicemanufactor/Form");
|
||||
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Gerätehersteller nicht gefunden", "error");
|
||||
$this->redirect("Devicemanufactor");
|
||||
}
|
||||
|
||||
$devicemanufactors = new Devicemanufactor($id);
|
||||
if ($devicemanufactors->id != $id) {
|
||||
$this->layout()->setFlash("Gerätehersteller nicht gefunden", "error");
|
||||
$this->redirect("Devicemanufactor");
|
||||
}
|
||||
|
||||
$this->layout()->set("devicemanufactors", $devicemanufactors);
|
||||
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";
|
||||
$devicemanufactor = new Devicemanufactor($id);
|
||||
if (!$devicemanufactor->id) {
|
||||
$this->layout()->setFlash("Gerätehersteller nicht gefunden", "error");
|
||||
$this->redirect("Devicemanufactor");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['name'] = trim($r->name);
|
||||
|
||||
|
||||
if (!$data['name']) {
|
||||
$this->layout()->setFlash("Name darf nicht leer sein", "error");
|
||||
$this->redirect("Devicemanufactor");
|
||||
}
|
||||
|
||||
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
|
||||
if ($mode == "edit") {
|
||||
$devicemanufactor->update($data);
|
||||
|
||||
} else {
|
||||
$devicemanufactor = DevicemanufactorModel::create($data);
|
||||
}
|
||||
// var_dump($filestore);
|
||||
// exit;
|
||||
$id = $devicemanufactor->save();
|
||||
|
||||
if (!$id) {
|
||||
$this->layout()->setFlash("Gerätehersteller konnte nicht angelegt werden", "error");
|
||||
$this->redirect("Devicemanufactor");
|
||||
}
|
||||
if ($fsh) {
|
||||
$fsh->save();
|
||||
}
|
||||
if ($mode == "edit") {
|
||||
$this->layout()->setFlash("Gerätehersteller erfolgreich geändert", "success");
|
||||
} else if ($mode = "add") {
|
||||
$this->layout()->setFlash("Gerätehersteller erfolgreich angelegt", "success");
|
||||
}
|
||||
$this->redirect("Devicemanufactor");
|
||||
}
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$devicemanufactor = new Devicemanufactor($id);
|
||||
if (!$devicemanufactor->id || $devicemanufactor->id != $id) {
|
||||
$this->layout()->setFlash("Gerätehersteller nicht gefunden.", "error");
|
||||
$this->redirect("Devicemanufactor");
|
||||
}
|
||||
|
||||
$devicemanufactor->delete();
|
||||
$this->redirect("Devicemanufactor");
|
||||
}
|
||||
|
||||
}
|
||||
122
application/Devicemanufactor/DevicemanufactorModel.php
Normal file
122
application/Devicemanufactor/DevicemanufactorModel.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
class DevicemanufactorModel {
|
||||
public $name = 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 Devicemanufactor();
|
||||
|
||||
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("Devicemanufactor", "*", "id=$id LIMIT 1");
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Devicemanufactor($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("Devicemanufactor", "*", "1=1 ORDER by name");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Devicemanufactor($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst() {
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("Devicemanufactor", "*", "$where ORDER BY name, network_id");
|
||||
if($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Devicemanufactor($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("Devicemanufactor", "*", "$where ORDER BY name, network_id");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Devicemanufactor($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;
|
||||
}
|
||||
|
||||
}
|
||||
41
application/Devicetype/Devicetype.php
Normal file
41
application/Devicetype/Devicetype.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
class Devicetype extends mfBaseModel
|
||||
{
|
||||
private $editor;
|
||||
private $creator;
|
||||
private $devicemanufactor;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
138
application/Devicetype/DevicetypeController.php
Normal file
138
application/Devicetype/DevicetypeController.php
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
class DevicetypeController 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("Devicetype/Index");
|
||||
$devicetypes = DevicetypeModel::getAll();
|
||||
$this->layout()->set("devicetypes", $devicetypes);
|
||||
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
$this->layout()->setTemplate("Devicetype/Form");
|
||||
$this->layout()->set("devicemanufactors", DevicemanufactorModel::getAll());
|
||||
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Gerätetyp nicht gefunden", "error");
|
||||
$this->redirect("Devicetype");
|
||||
}
|
||||
|
||||
$devicetypes = new Devicetype($id);
|
||||
if ($devicetypes->id != $id) {
|
||||
$this->layout()->setFlash("Gerätetyp nicht gefunden", "error");
|
||||
$this->redirect("Devicetype");
|
||||
}
|
||||
|
||||
$this->layout()->set("devicetypes", $devicetypes);
|
||||
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";
|
||||
$devicetype = new Devicetype($id);
|
||||
if (!$devicetype->id) {
|
||||
$this->layout()->setFlash("Gerätehersteller nicht gefunden", "error");
|
||||
$this->redirect("Devicetype");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
var_dump($r);
|
||||
echo $r->price;
|
||||
|
||||
if (!$r->price) {
|
||||
$price = "0.00";
|
||||
echo "empty";
|
||||
} else {
|
||||
$price = $r->price;
|
||||
}
|
||||
if (!$r->power) {
|
||||
$power = "0.00";
|
||||
} else {
|
||||
$power = $r->power;
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['name'] = trim($r->name);
|
||||
$data['devicemanufactor_id'] = $r->devicemanufactor_id;
|
||||
$data['price'] = $price;
|
||||
$data['power'] = $power;
|
||||
|
||||
if (!$data['name']) {
|
||||
$this->layout()->setFlash("Name darf nicht leer sein", "error");
|
||||
$this->redirect("Devicetype");
|
||||
}
|
||||
|
||||
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
|
||||
if ($mode == "edit") {
|
||||
$devicetype->update($data);
|
||||
|
||||
} else {
|
||||
$devicetype = DevicetypeModel::create($data);
|
||||
}
|
||||
// var_dump($filestore);
|
||||
// exit;
|
||||
$id = $devicetype->save();
|
||||
|
||||
if (!$id) {
|
||||
$this->layout()->setFlash("Gerätehersteller konnte nicht angelegt werden", "error");
|
||||
$this->redirect("Devicetype");
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
$this->layout()->setFlash("Gerätehersteller erfolgreich geändert", "success");
|
||||
} else if ($mode = "add") {
|
||||
$this->layout()->setFlash("Gerätehersteller erfolgreich angelegt", "success");
|
||||
}
|
||||
$this->redirect("Devicetype");
|
||||
}
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$devicetype = new Devicetype($id);
|
||||
if (!$devicetype->id || $devicetype->id != $id) {
|
||||
$this->layout()->setFlash("Gerätehersteller nicht gefunden.", "error");
|
||||
$this->redirect("Devicetype");
|
||||
}
|
||||
|
||||
$devicetype->delete();
|
||||
$this->redirect("Devicetype");
|
||||
}
|
||||
|
||||
}
|
||||
125
application/Devicetype/DevicetypeModel.php
Normal file
125
application/Devicetype/DevicetypeModel.php
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
class DevicetypeModel {
|
||||
public $name = null;
|
||||
public $power = null;
|
||||
public $price = null;
|
||||
public $devicemanufactor_id = 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 Devicetype();
|
||||
|
||||
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("Devicetype", "*");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Devicetype($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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,6 +26,27 @@ class PopController extends mfBaseController
|
||||
|
||||
}
|
||||
|
||||
protected function detailAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("pop nicht gefunden", "error");
|
||||
$this->redirect("Pop");
|
||||
}
|
||||
|
||||
$device = new Device($id);
|
||||
if ($device->id != $id) {
|
||||
$this->layout()->setFlash("Pop nicht gefunden", "error");
|
||||
$this->redirect("Pop");
|
||||
}
|
||||
|
||||
$this->layout()->setTemplate("Pop/Detail");
|
||||
$pops = PopModel::getOne($id);
|
||||
$this->layout()->set("pops", $pops);
|
||||
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
$this->layout()->setTemplate("Pop/Form");
|
||||
|
||||
@@ -71,7 +71,7 @@ class PopModel {
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("Pop", "*");
|
||||
$res = $db->select("Pop", "*","1=1 ORDER by name");
|
||||
if($db->num_rows($res)) {
|
||||
while($data = $db->fetch_object($res)) {
|
||||
$items[] = new Pop($data);
|
||||
|
||||
Reference in New Issue
Block a user