Devices:
• Übersicht Pop/Adressen/Koordinaten Verlinkungen Pop: • Fontsize in Übersicht auf 13px geändert für bessere Übersicht • Neue Features: o Poprackverwaltung v1 CRUD o Poprackmodulverwaltung V1 CRUD
This commit is contained in:
77
application/Poprackmodule/PoprackmoduleModel.php
Normal file
77
application/Poprackmodule/PoprackmoduleModel.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
class PoprackmoduleModel
|
||||
{
|
||||
|
||||
public $poprack_id = null;
|
||||
public $type = null;
|
||||
public $device_id = null;
|
||||
public $name = null;
|
||||
public $start_he = null;
|
||||
public $end_he = null;
|
||||
public $width = null;
|
||||
public $ports = null;
|
||||
public $plug = null;
|
||||
public $position = null;
|
||||
public $create_by = null;
|
||||
public $edit_by = null;
|
||||
public $create = null;
|
||||
public $edit = null;
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$model = new Poprackmodule();
|
||||
|
||||
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 getpoprackmodule($poprack_id)
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
$sql = "SELECT `id`, `name`, `start_he`,`end_he` FROM `Poprackmodule` WHERE `poprack_id`='" . $poprack_id . "' AND type ='0' ORDER by name";
|
||||
|
||||
$res = $db->query($sql);
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_array($res)) {
|
||||
$items[] = $data;
|
||||
}
|
||||
|
||||
$response['data'] = $items;
|
||||
$response['success'] = true;
|
||||
|
||||
|
||||
} else {
|
||||
$response['success'] = false;
|
||||
}
|
||||
echo json_encode($response);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user