add boardlist
This commit is contained in:
1 parent
a1cc076f13
commit
69dc3f534c
2 files changed
+94
No files matched your search
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
require_once $_SERVER['DOCUMENT_ROOT'].'/inc/bootstrap.php';
|
||||
if(!CUSer::is_admin()) {
|
||||
die('403 - Access denied');
|
||||
}
|
||||
require_once $_SERVER['DOCUMENT_ROOT'].'/inc/header.php';
|
||||
|
||||
?>
|
||||
|
||||
<div class="row maxheight">
|
||||
<div class="col-lg-12">
|
||||
<!-- Header BG Table -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4>Список устройств</h4>
|
||||
<div class="card-actions">
|
||||
<code>CIoT</code>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-borderless table-header-bg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center" style="width: 50px;">ID</th>
|
||||
<th>MAC</th>
|
||||
<th>ID чипа</th>
|
||||
<th>HW</th>
|
||||
<th>FW</th>
|
||||
<th>Пользователь</th>
|
||||
<th>Дата регистрации</th>
|
||||
<th>Последняя активность</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
CPagination::execute($_REQUEST['page'], CIoT::getCountDevices(), PAGINATION_LIMIT);
|
||||
$limit = CPagination::getLimit();
|
||||
?>
|
||||
<?php foreach(CIoT::getDevices($limit, 'ASC') as $device): ?>
|
||||
<tr>
|
||||
<td class="text-center"><a href="boardinfo.php?id=<?php echo $device['id']; ?>"><?php echo $device['id']; ?></a></td>
|
||||
<td><?php echo $device['mac']; ?></td>
|
||||
<td><?php echo $device['chipid']; ?></td>
|
||||
<td><?php echo $device['hw']; ?></td>
|
||||
<td><?php echo $device['fw']; ?></td>
|
||||
<td><?php echo $device['user']; ?></td>
|
||||
<td><?php echo date("d.m.Y H:i:s", $device['time']); ?></td>
|
||||
<td><?php echo date("d.m.Y H:i:s", $device['last_active']); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php CPagination::show('page'); ?>
|
||||
</div>
|
||||
<!-- .card-block -->
|
||||
</div>
|
||||
<!-- .card -->
|
||||
<!-- End Header BG Table -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require_once $_SERVER['DOCUMENT_ROOT'].'/inc/footer.php';
|
||||
?>
|
||||
@@ -232,6 +232,34 @@ class CIoT {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Получаем массив с данными об устройствах
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public static function getDevices($limit = 10, $sort = 'ASC') {
|
||||
$res = self::$DB->query('SELECT * FROM devices ORDER BY `id` '.$sort.' LIMIT '.$limit);
|
||||
if($res){
|
||||
return $res;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Получаем количество устройств
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function getCountDevices():int {
|
||||
$res = self::$DB->query('SELECT id FROM devices');
|
||||
if($res){
|
||||
return count($res);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Получаем массив с показаниями датчика для построения графика
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user