datatables-std.css für Standard DT erstellt

datatables-std.js für Standard DT erstellt
zugewiesen an:
Device,Devicetype,Devicemanufactor,Pop,Filestore

Pop Detail Ansicht erstellt
Filestore auf DT umgebaut

Bugfixing:
* Bearbeiten aus verschiedenen Ansichten werden nun richtig zurückgeleitet (Devices/Pops)
* Sortierung Devicetype in Devices wurde nun per Arraysort durchgeführt
This commit is contained in:
Spitzer_Daniel
2023-02-20 22:15:36 +01:00
parent 2af021040f
commit 71d9675350
18 changed files with 427 additions and 538 deletions
@@ -60,7 +60,7 @@ class DevicetypeController extends mfBaseController
$mode = "edit";
$devicetype = new Devicetype($id);
if (!$devicetype->id) {
$this->layout()->setFlash("Gerätehersteller nicht gefunden", "error");
$this->layout()->setFlash("Gerätetyp nicht gefunden", "error");
$this->redirect("Devicetype");
}
} else {
@@ -109,14 +109,14 @@ class DevicetypeController extends mfBaseController
$id = $devicetype->save();
if (!$id) {
$this->layout()->setFlash("Gerätehersteller konnte nicht angelegt werden", "error");
$this->layout()->setFlash("Gerätetyp konnte nicht angelegt werden", "error");
$this->redirect("Devicetype");
}
if ($mode == "edit") {
$this->layout()->setFlash("Gerätehersteller erfolgreich geändert", "success");
$this->layout()->setFlash("Gerätetyp erfolgreich geändert", "success");
} else if ($mode = "add") {
$this->layout()->setFlash("Gerätehersteller erfolgreich angelegt", "success");
$this->layout()->setFlash("Gerätetyp erfolgreich angelegt", "success");
}
$this->redirect("Devicetype");
}
@@ -127,7 +127,7 @@ class DevicetypeController extends mfBaseController
$id = $this->request->id;
$devicetype = new Devicetype($id);
if (!$devicetype->id || $devicetype->id != $id) {
$this->layout()->setFlash("Gerätehersteller nicht gefunden.", "error");
$this->layout()->setFlash("Gerätetyp nicht gefunden.", "error");
$this->redirect("Devicetype");
}
+33 -25
View File
@@ -1,6 +1,7 @@
<?php
class DevicetypeModel {
class DevicetypeModel
{
public $name = null;
public $power = null;
public $price = null;
@@ -12,16 +13,18 @@ class DevicetypeModel {
public $create = null;
public $edit = null;
public static function find($data) {
public static function find($data)
{
}
public static function create(Array $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) {
foreach ($data as $field => $value) {
if (property_exists(get_called_class(), $field)) {
if (substr($field, 0, 5) == "vlan_" && !$value) {
$model->$field = null;
continue;
}
@@ -30,45 +33,47 @@ class DevicetypeModel {
}
$me = mfValuecache::singleton()->get("me");
if(!$me) {
if (!$me) {
$me = new User();
$me->loadMe();
mfValuecache::singleton()->set("me", $me);
}
if($model->create_by === null) {
if ($model->create_by === null) {
$model->create_by = $me->id;
}
if($model->edit_by === null) {
if ($model->edit_by === null) {
$model->edit_by = $me->id;
}
return $model;
}
public static function getOne($id) {
if(!is_numeric($id) || !$id) {
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)) {
if ($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new Devicetype($data);
}
return $item;
}
public static function getAll() {
public static function getAll()
{
$items = [];
$db = FronkDB::singleton();
$res = $db->select("Devicetype", "*");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$res = $db->select("Devicetype", "*", "1=1 ORDER BY name");
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = new Devicetype($data);
}
}
@@ -76,15 +81,16 @@ class DevicetypeModel {
}
public static function getFirst() {
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)) {
if ($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new Devicetype($data);
if($item->id) {
if ($item->id) {
return $item;
} else {
return null;
@@ -93,27 +99,29 @@ class DevicetypeModel {
return null;
}
public static function search($filter) {
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)) {
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = new Devicetype($data);
}
}
return $items;
}
private static function getSqlFilter($filter) {
private static function getSqlFilter($filter)
{
$where = "1=1 ";
//var_dump($filter);exit;
if(array_key_exists("network_id", $filter)) {
if (array_key_exists("network_id", $filter)) {
$networkid = $filter['network_id'];
if(is_numeric($networkid)) {
if (is_numeric($networkid)) {
$where .= " AND network_id=$networkid";
}
}