SMMP/public_html/view/history.php

103 lines
2.9 KiB
PHP
Raw Normal View History

2016-10-18 14:03:03 +00:00
<?php define('__ROOT__', dirname(dirname(dirname(__FILE__))) );
require_once __ROOT__.'/autoloader.php';
use \api\core\ModuleRequest;
2016-10-18 17:09:47 +00:00
use \error\core\Error;
use \database\core\DatabaseDriver;
2016-10-18 14:03:03 +00:00
use \database\core\Repo;
2016-10-18 14:03:03 +00:00
use \orm\core\Table; use \orm\core\Rows;
?>
<!-- [1] Gestion du sous-menu de gauche -->
<nav class='sub-menu-side'>
2016-02-18 14:49:06 +00:00
<span data-sublink='view'>
2016-10-18 14:03:03 +00:00
<span class='svg'><?php echo file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/view.svg' ); ?></span>
<span>Tout afficher</span>
</span>
<span data-sublink='filter' >
2016-10-18 14:03:03 +00:00
<span class='svg'><?php echo file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/filter.svg' ); ?></span>
<span>Détails</span>
</span>
<span data-sublink='remove' >
2016-10-18 14:03:03 +00:00
<span class='svg'><?php echo file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/archive.svg' ); ?></span>
<span>Archiver</span>
</span>
</nav>
2016-02-18 14:49:06 +00:00
<?php
2016-07-04 13:45:29 +00:00
$post = [];
2016-02-18 14:49:06 +00:00
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'>";
2016-02-18 14:49:06 +00:00
// Barre de recherche
echo "<input type='text' class='searchbar' placeholder='Recherche'>";
/* (1) On récupère les données
---------------------------------------------------------*/
$mac = Table::get('machine')
->select('*');
$selected = Table::get('history')
->join('id_machine', $mac)
->select('timestamp', Rows::SEL_MAX)
->select('id_history', Rows::SEL_COUNT, Rows::SEL_DISTINCT)
->fetch();
2016-07-21 19:12:53 +00:00
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>";
2016-07-21 19:12:53 +00:00
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>";
2016-07-21 19:12:53 +00:00
echo "<span>";
2016-08-06 09:32:50 +00:00
echo "<span>".$mac['agg_id_history']." conducteur(s)</span>";
echo "<span>test</span>";
echo "</span>";
echo "<span>";
echo "<button class='search'>Détails</button>";
echo "</span>";
echo "</article>";
}
2016-02-18 14:49:06 +00:00
echo '</section>';