98 lines
2.8 KiB
PHP
Executable File
98 lines
2.8 KiB
PHP
Executable File
<?php define('__ROOT__', dirname(dirname(__FILE__)) );
|
|
require_once __ROOT__.'/manager/autoloader.php';
|
|
use \manager\ModuleRequest;
|
|
use \manager\ManagerError;
|
|
use \manager\Database;
|
|
use \manager\Repo;
|
|
?>
|
|
|
|
<!-- [1] Gestion du sous-menu de gauche -->
|
|
|
|
<nav class='sub-menu-side'>
|
|
<span data-sublink='view'>
|
|
<span class='svg'><?php echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/view.svg' ); ?></span>
|
|
<span>Tout afficher</span>
|
|
</span>
|
|
|
|
<span data-sublink='filter' >
|
|
<span class='svg'><?php echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/filter.svg' ); ?></span>
|
|
<span>Détails</span>
|
|
</span>
|
|
|
|
<span data-sublink='remove' >
|
|
<span class='svg'><?php echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/archive.svg' ); ?></span>
|
|
<span>Archiver</span>
|
|
</span>
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
$post = [];
|
|
foreach($_POST as $k=>$v)
|
|
array_push($post, $k);
|
|
|
|
$sublink = $post[0];
|
|
|
|
|
|
|
|
/* [1] VIEW -> Liste des utilisateurs
|
|
=========================================================*/
|
|
$getusers = new ModuleRequest('userDefault/getAll'); // On utilise la methode 'getAll' du module 'userDefault'
|
|
$nbusers = count( $getusers->dispatch()->get('users') ); // On recupere la reponse
|
|
|
|
$getmachines = new ModuleRequest('machineDefault/getAll'); // On utilise la methode 'getAll' du module 'machineDefault'
|
|
$nbmachines = count( $getmachines->dispatch()->get('machines') ); // On recupere la reponse
|
|
|
|
echo "<section data-sublink='view' class='list fstart'>";
|
|
|
|
// Barre de recherche
|
|
echo "<input type='text' class='searchbar' placeholder='Recherche'>";
|
|
|
|
|
|
/* (1) On récupère les données
|
|
---------------------------------------------------------*/
|
|
$selReq = Database::getPDO()->query("select m.*, count(distinct h.id_user) as users, max(h.timestamp) as last
|
|
from history as h, machine as m
|
|
where h.id_machine = m.id_machine
|
|
group by h.id_machine");
|
|
$selected = Database::delNumeric( $selReq->fetchAll() );
|
|
|
|
|
|
echo "<article class='inline-row' style='border: 0; box-shadow: none;background: transparent;'>";
|
|
echo "<span>Machine</span>";
|
|
echo "<span>Dernière utilisation</span>";
|
|
echo "<span>Conducteurs</span>";
|
|
echo "<span>Historique détaillé</span>";
|
|
echo "</article>";
|
|
|
|
foreach($selected as $m=>$mac){
|
|
|
|
echo "<article class='inline-row'>";
|
|
|
|
echo "<span class='title'><span>#".$mac['name']."</span></span>";
|
|
|
|
echo "<span>";
|
|
echo "<span>".date('d/m/Y H:i:s', $mac['last'])."</span>";
|
|
echo "<span style='color:#aaa;'>Il y a xx jours et yy heures</span>";
|
|
echo "</span>";
|
|
|
|
|
|
echo "<span>";
|
|
echo "<span>".$mac['users']." conducteur(s)</span>";
|
|
echo "<span>".$mac['users']."</span>";
|
|
echo "</span>";
|
|
|
|
echo "<span>";
|
|
echo "<button class='search'>Détails</button>";
|
|
echo "</span>";
|
|
|
|
echo "</article>";
|
|
}
|
|
|
|
|
|
echo '</section>';
|