Updated TheTool Frontend Framework & Table
This commit is contained in:
@@ -250,7 +250,43 @@ class DeviceController extends mfBaseController
|
||||
$ont = $this->request->ont;
|
||||
$data = [];
|
||||
|
||||
|
||||
switch ($do) {
|
||||
case "getDevices":
|
||||
$devices = DeviceModel::getAll();
|
||||
|
||||
foreach ($devices as $device) {
|
||||
$locationText = "";
|
||||
$locationUrl = "";
|
||||
|
||||
if (trim($device->pop->name)) {
|
||||
$locationText = $device->pop->name;
|
||||
$locationUrl = self::getUrl("Pop", "Detail", ["id" => $device->pop->id]);
|
||||
} else if (trim($device->addr_street)) {
|
||||
$locationText = $device->addr_street . " " . $device->addr_number . ", " . $device->addr_zip . " " . $device->addr_city;
|
||||
$locationUrl = "http://maps.google.com/?q=" . $locationText;
|
||||
} else if (trim($device->gps_lat)) {
|
||||
$locationText = $device->gps_lat . " , " . $device->gps_long;
|
||||
$locationUrl = "http://maps.google.com/?q=" . $locationText;
|
||||
}
|
||||
|
||||
$data[] = [
|
||||
"name" => $device->name,
|
||||
"devicetype" => $device->devicetype->name,
|
||||
"devicemanufactor" => $device->devicetype->devicemanufactor->name,
|
||||
"locationText" => $locationText,
|
||||
"locationUrl" => $locationUrl,
|
||||
"ip" => $device->ip,
|
||||
"mac" => $device->mac,
|
||||
"serial" => $device->serial,
|
||||
"price" => $device->price != "0.0" ? $device->price : $device->devicetype->price,
|
||||
"power" => $device->power != "0.0" ? $device->power : $device->devicetype->power,
|
||||
"backup" => $device->last_config_backup ? (time() - $device->last_config_backup <= 172800 ? 'ok' : 'aged') : 'na',
|
||||
];
|
||||
}
|
||||
|
||||
die(json_encode($data));
|
||||
break;
|
||||
case "getconfig":
|
||||
$return = $this->getConfig($id, $format, $filename);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user