Merge branch 'devbyspi' of code.fronk.at:fronk/thetool into devbyspi
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/
|
||||
|
||||
@@ -1,150 +1,172 @@
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
|
||||
<?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("Network")?>">Netzgebiete</a></li>
|
||||
<li class="breadcrumb-item">POP</li>
|
||||
<li class="breadcrumb-item active"><?=($pop->id) ? "bearbeiten" : "Neu" ?></li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title"><?=($pop->id) ? "POP bearbeiten" : "Neuer POP" ?></h4>
|
||||
<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>
|
||||
<?php if (empty($_GET["returnto"])) {
|
||||
?>
|
||||
<li class="breadcrumb-item"><a href="<?= self::getUrl("Network") ?>">Netzgebiete</a></li>
|
||||
<li class="breadcrumb-item">POP</li>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
||||
<li class="breadcrumb-item"><a
|
||||
href="<?= self::getUrl(ucfirst($_GET["returnto"])) ?>"><?= strtoupper($_GET["returnto"]) ?>
|
||||
></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<li class="breadcrumb-item active"><?= ($pop->id) ? "bearbeiten" : "Neu" ?></li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title"><?= ($pop->id) ? "POP bearbeiten" : "Neuer POP" ?></h4>
|
||||
</div>
|
||||
</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"><?=($pop->id) ? "POP bearbeiten" : "Neuer POP"?></h4>
|
||||
|
||||
<form class="form-horizontal" method="post" action="<?=self::getUrl("Pop", "save")?>">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<input type="hidden" name="id" value="<?=$pop->id?>" />
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="network_id">Netzgebiet</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="network_id" id="owner_id">
|
||||
<option></option>
|
||||
<?php foreach($networks as $network): ?>
|
||||
<option value="<?=$network->id?>" <?=($pop->network_id == $network->id) ? "selected='selected'" : ""?>><?=($network->name)?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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="<?=$pop->name?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="gps_lat">GPS Breite</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="number" step="any" class="form-control" name="gps_lat" id="name" value="<?=$pop->gps_lat?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="gps_long">GPS Länge</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="number" step="any" class="form-control" name="gps_long" id="name" value="<?=$pop->gps_long?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="location">Standortinfo</label>
|
||||
<div class="col-lg-10">
|
||||
<textarea id="note" class="form-control" name="location" rows="5"><?=$pop->location?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h2 class="header-title mb-2">Access VLANs</h2>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="vlan_public">Public</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="number" class="form-control" name="vlan_public" id="vlan_public" value="<?=$pop->vlan_public?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="vlan_nat">NAT</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="number" class="form-control" name="vlan_nat" id="vlan_nat" value="<?=$pop->vlan_nat?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="vlan_ipv6">IPv6</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="number" class="form-control" name="vlan_ipv6" id="vlan_ipv6" value="<?=$pop->vlan_ipv6?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="note">Interne Notiz</label>
|
||||
<div class="col-lg-10">
|
||||
<textarea id="note" class="form-control" name="note" rows="5"><?=$pop->note?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<h4 class="header-title mb-2"><?= ($pop->id) ? "POP bearbeiten" : "Neuer POP" ?></h4>
|
||||
|
||||
<form class="form-horizontal" method="post"
|
||||
action="<?= self::getUrl("Pop", "save", ["returnto" => $_GET["returnto"]]) ?>">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<input type="hidden" name="id" value="<?= $pop->id ?>"/>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="network_id">Netzgebiet</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="network_id" id="owner_id">
|
||||
<option></option>
|
||||
<?php foreach ($networks as $network): ?>
|
||||
<option value="<?= $network->id ?>" <?= ($pop->network_id == $network->id) ? "selected='selected'" : "" ?>><?= ($network->name) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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="<?= $pop->name ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="gps_lat">GPS Breite</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="number" step="any" class="form-control" name="gps_lat" id="name"
|
||||
value="<?= $pop->gps_lat ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="gps_long">GPS Länge</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="number" step="any" class="form-control" name="gps_long" id="name"
|
||||
value="<?= $pop->gps_long ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="location">Standortinfo</label>
|
||||
<div class="col-lg-10">
|
||||
<textarea id="note" class="form-control" name="location"
|
||||
rows="5"><?= $pop->location ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h2 class="header-title mb-2">Access VLANs</h2>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="vlan_public">Public</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="number" class="form-control" name="vlan_public" id="vlan_public"
|
||||
value="<?= $pop->vlan_public ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="vlan_nat">NAT</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="number" class="form-control" name="vlan_nat" id="vlan_nat"
|
||||
value="<?= $pop->vlan_nat ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="vlan_ipv6">IPv6</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="number" class="form-control" name="vlan_ipv6" id="vlan_ipv6"
|
||||
value="<?= $pop->vlan_ipv6 ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="note">Interne Notiz</label>
|
||||
<div class="col-lg-10">
|
||||
<textarea id="note" class="form-control" name="note"
|
||||
rows="5"><?= $pop->note ?></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 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>
|
||||
</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>
|
||||
<script type="text/javascript">
|
||||
$("#parent_id").select2({
|
||||
allowClear: true,
|
||||
placeholder: ""
|
||||
});
|
||||
$("#addresstypes").select2();
|
||||
|
||||
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|
||||
// 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"); ?>
|
||||
@@ -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>
|
||||
@@ -31,6 +32,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">
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<a href="<?=self::getUrl("Dashboard")?>"><i class="fe-airplay"></i> Dashboard</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if($me->is("Admin")): ?>
|
||||
<li class="has-submenu">
|
||||
<a href="<?=self::getUrl("Dashboard")?>"><i class="fe-airplay"></i> Dashboard <div class="arrow-down"></div></a>
|
||||
@@ -19,7 +19,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if($me->is(["Admin", "netowner"])): ?>
|
||||
<li class="has-submenu">
|
||||
<a href="#">
|
||||
@@ -31,10 +31,14 @@
|
||||
<li><a href="<?=self::getUrl("Address")?>"><i class="fad fa-user text-info"></i> Personen & Firmen</a></li>
|
||||
<li><a href="<?=self::getUrl("Product")?>"><i class="far fa-rectangle-list text-info"></i> Produkte</a></li>
|
||||
<li><a href="<?=self::getUrl("Productgroup")?>"><i class="far fa-list-tree text-info"></i> Produktgruppen</a></li>
|
||||
|
||||
|
||||
<li><a href="<?=self::getUrl("Network")?>"><i class="fad fa-network-wired text-info"></i> Netzgebiete</a></li>
|
||||
<li class="has-sub-submenu"><a href="<?=self::getUrl("User")?>"><i class="fad fa-users text-info"></i> Benutzer</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 class="has-sub-submenu"><a href="<?=self::getUrl("Device")?>"><i class="fad fa-router text-info "></i> Devices</a></li>
|
||||
<li class="has-sub-submenu"><a href="<?=self::getUrl("User")?>"><i class="fad fa-users text-info"></i> Benutzer</a></li>
|
||||
<li class="has-sub-submenu font-weight-bold mt-1"><a>Grundstammdaten</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($me->is(["Admin", "netowner"])): ?>
|
||||
@@ -44,12 +48,12 @@
|
||||
<li><a href="<?=self::getUrl("Producttech")?>"><i class="fad fa-microchip text-info"></i> Technologien</a></li>
|
||||
<!--<li><a href="<?=self::getUrl("Contractconfig")?>"><i class="fad fa-gear text-info"></i> ContractConfig</a></li>-->
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if($me->is(["Admin","netowner","lineplanner","pipeplanner","pipeworker","lineworker"])): ?>
|
||||
<li class="has-submenu">
|
||||
<a href="#">
|
||||
@@ -60,10 +64,11 @@
|
||||
<?php if($me->is(["Admin","netowner","pipeplanner","pipeworker","lineplanner","lineworker"])): ?><li><a href="<?=self::getUrl("Pipework")?>"><i class="fad fa-wrench text-info"></i> Tiefbau</a></li><?php endif; ?>
|
||||
<?php if($me->is(["Admin","netowner","lineplanner","lineworker"])): ?><li><a href="<?=self::getUrl("Linework")?>"><i class="fas fa-ethernet text-info"></i> Leitungsbau</a></li><?php endif; ?>
|
||||
<?php if($me->is(["Admin", "netowner", "netoperator", "lineworker"])): ?><li><a href="<?=self::getUrl("Patching")?>"><i class="fas fa-plug text-info"></i> Patchungen</a></li><?php endif; ?>
|
||||
<?php if($me->is(["Admin", "netowner","pipeplanner","lineplanner","pipeworker", "netoperator", "lineworker"])): ?><li><a href="<?=self::getUrl("Filestore")?>"><i class="fas fa-file text-info"></i> Dateiablage</a></li><?php endif; ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if($me->is(["Admin"])): ?>
|
||||
<li class="has-submenu">
|
||||
<a href="#">
|
||||
@@ -75,7 +80,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if($me->is(["Admin"])): ?>
|
||||
<li class="has-submenu">
|
||||
<a href="#">
|
||||
@@ -86,7 +91,6 @@
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($me->is(["Admin","netowner","salespartner"])): ?>
|
||||
<li class="has-submenu">
|
||||
<a href="#">
|
||||
|
||||
@@ -1,144 +1,200 @@
|
||||
<?php
|
||||
|
||||
class PopController 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", "netowner", "pipeplanner"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
class PopController extends mfBaseController
|
||||
{
|
||||
private $returUrl = "Network";
|
||||
|
||||
protected function indexAction() {
|
||||
|
||||
}
|
||||
|
||||
protected function addAction() {
|
||||
$this->layout()->setTemplate("Pop/Form");
|
||||
$this->layout()->set("networks", NetworkModel::getAll());
|
||||
if($this->request->network_id) {
|
||||
$pop = new Pop();
|
||||
$pop->network_id = $this->request->network_id;
|
||||
$this->layout()->set("pop", $pop);
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->is(["Admin", "netowner", "pipeplanner"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function editAction() {
|
||||
$id = $this->request->id;
|
||||
if(!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("POP nicht gefunden", "error");
|
||||
$this->redirect("Network");
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
|
||||
$this->layout()->setTemplate("Pop/Index");
|
||||
$pops = PopModel::getAll();
|
||||
$this->layout()->set("pops", $pops);
|
||||
|
||||
}
|
||||
|
||||
$pop = new Pop($id);
|
||||
if($pop->id != $id) {
|
||||
$this->layout()->setFlash("POP nicht gefunden", "error");
|
||||
$this->redirect("Network");
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
$this->layout()->set("pop", $pop);
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
protected function saveAction() {
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
//var_dump($r);exit;
|
||||
if(is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$pop = new Pop($id);
|
||||
if(!$pop->id) {
|
||||
$this->layout()->setFlash("POP nicht gefunden", "error");
|
||||
$this->redirect("Network");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
$this->layout()->setTemplate("Pop/Form");
|
||||
$this->layout()->set("networks", NetworkModel::getAll());
|
||||
if ($this->request->network_id) {
|
||||
$pop = new Pop();
|
||||
$pop->network_id = $this->request->network_id;
|
||||
$this->layout()->set("pop", $pop);
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($r->addresstypes);exit;
|
||||
|
||||
if(!$r->network_id || !$r->name) {
|
||||
$this->layout()->setFlash("Bitte Name und Netzgebiet eintragen", "error");
|
||||
$this->layout()->set("pop", $pop);
|
||||
unset($r->network_id);
|
||||
return $this->add();
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("POP nicht gefunden", "error");
|
||||
$this->redirect("Network");
|
||||
}
|
||||
|
||||
$pop = new Pop($id);
|
||||
if ($pop->id != $id) {
|
||||
$this->layout()->setFlash("POP nicht gefunden", "error");
|
||||
$this->redirect("Network");
|
||||
}
|
||||
|
||||
$this->layout()->set("pop", $pop);
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['network_id'] = $r->network_id;
|
||||
$data['name'] = $r->name;
|
||||
$data['gps_lat'] = ($r->gps_lat) ? $r->gps_lat : null;
|
||||
$data['gps_long'] = ($r->gps_long) ? $r->gps_long : null;
|
||||
$data['location'] = $r->location;
|
||||
$data['vlan_public'] = ($r->vlan_public) ? $r->vlan_public : null;
|
||||
$data['vlan_nat'] = ($r->vlan_nat) ? $r->vlan_nat: null;
|
||||
$data['vlan_ipv6'] = ($r->vlan_ipv6) ? $r->vlan_ipv6: null;
|
||||
$data['note'] = $r->note;
|
||||
|
||||
$data['edit_by'] = 1;
|
||||
|
||||
if($mode == "add") {
|
||||
$data['create_by'] = 1;
|
||||
$pop = PopModel::create($data);
|
||||
} else {
|
||||
$pop->update($data);
|
||||
|
||||
protected function saveAction()
|
||||
{
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
//var_dump($r);exit;
|
||||
if (is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$pop = new Pop($id);
|
||||
if (!$pop->id) {
|
||||
$this->layout()->setFlash("POP nicht gefunden", "error");
|
||||
$this->redirect("Network");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
//var_dump($r->addresstypes);exit;
|
||||
$this->log->debug(print_r($r, true));
|
||||
if (!$r->network_id || !$r->name) {
|
||||
$this->layout()->setFlash("Bitte Name und Netzgebiet eintragen", "error");
|
||||
$this->layout()->set("pop", $pop);
|
||||
unset($r->network_id);
|
||||
return $this->add();
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['network_id'] = $r->network_id;
|
||||
$data['name'] = $r->name;
|
||||
$data['gps_lat'] = ($r->gps_lat) ? $r->gps_lat : null;
|
||||
$data['gps_long'] = ($r->gps_long) ? $r->gps_long : null;
|
||||
$data['location'] = $r->location;
|
||||
$data['vlan_public'] = ($r->vlan_public) ? $r->vlan_public : null;
|
||||
$data['vlan_nat'] = ($r->vlan_nat) ? $r->vlan_nat : null;
|
||||
$data['vlan_ipv6'] = ($r->vlan_ipv6) ? $r->vlan_ipv6 : null;
|
||||
$data['note'] = $r->note;
|
||||
|
||||
$data['edit_by'] = 1;
|
||||
|
||||
if ($mode == "add") {
|
||||
$data['create_by'] = 1;
|
||||
$pop = PopModel::create($data);
|
||||
} else {
|
||||
$pop->update($data);
|
||||
}
|
||||
|
||||
|
||||
$new_id = $pop->save();
|
||||
if (!$new_id) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern", "error");
|
||||
$this->layout()->set("network", $network);
|
||||
return $this->addAction();
|
||||
}
|
||||
if ($this->request->returnto) {
|
||||
$this->returUrl = ucfirst($this->request->returnto);
|
||||
}
|
||||
|
||||
$this->layout()->setFlash("Netzgebiet erfolgreich gespeichert.", "success");
|
||||
$this->redirect($this->returUrl, "Index", [], "view=pops&net=" . $pop->network_id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//var_dump($address);exit;
|
||||
|
||||
$new_id = $pop->save();
|
||||
if(!$new_id) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern", "error");
|
||||
$this->layout()->set("network", $network);
|
||||
return $this->addAction();
|
||||
|
||||
protected function apiAction()
|
||||
{
|
||||
$do = $this->request->do;
|
||||
$data = [];
|
||||
|
||||
switch ($do) {
|
||||
case "getPops":
|
||||
$return = $this->getPopsApi();
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
}
|
||||
|
||||
if (!is_array($return) || !count($return)) {
|
||||
$data = ["status" => "error"];
|
||||
$this->returnJson($data);
|
||||
}
|
||||
$data['status'] = "OK";
|
||||
$data['result'] = $return;
|
||||
$this->returnJson($data);
|
||||
}
|
||||
|
||||
$this->layout()->setFlash("Netzgebiet erfolgreich gespeichert.", "success");
|
||||
$this->redirect("Network", "Index", [], "view=pops&net=".$pop->network_id);
|
||||
}
|
||||
|
||||
protected function apiAction() {
|
||||
$do = $this->request->do;
|
||||
$data = [];
|
||||
|
||||
switch($do) {
|
||||
case "getPops":
|
||||
$return = $this->getPopsApi();
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
|
||||
private function getPopsApi()
|
||||
{
|
||||
$network_id = $this->request->network_id;
|
||||
if (!is_numeric($network_id) || $network_id < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$network = new Network($network_id);
|
||||
if (!$network->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$pops = [];
|
||||
foreach ($network->pops as $pop) {
|
||||
$pops[$pop->id] = $pop->name;
|
||||
}
|
||||
|
||||
return ["pops" => $pops];
|
||||
}
|
||||
|
||||
if(!is_array($return) || !count($return)) {
|
||||
$data = ["status" => "error"];
|
||||
$this->returnJson($data);
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
|
||||
$pop = new Pop($id);
|
||||
|
||||
if (!$pop->id || $pop->id != $id) {
|
||||
$this->layout()->setFlash("Datei nicht gefunden.", "error");
|
||||
$this->redirect("Pop");
|
||||
}
|
||||
|
||||
$pop->delete();
|
||||
$this->redirect("Pop");
|
||||
}
|
||||
$data['status'] = "OK";
|
||||
$data['result'] = $return;
|
||||
$this->returnJson($data);
|
||||
}
|
||||
|
||||
private function getPopsApi() {
|
||||
$network_id = $this->request->network_id;
|
||||
if(!is_numeric($network_id) || $network_id < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$network = new Network($network_id);
|
||||
if(!$network->id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$pops = [];
|
||||
foreach($network->pops as $pop) {
|
||||
$pops[$pop->id] = $pop->name;
|
||||
}
|
||||
|
||||
return ["pops" => $pops];
|
||||
}
|
||||
}
|
||||
@@ -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