header pour les membres des groupes 'groups/members'

This commit is contained in:
xdrm-brackets 2016-07-21 15:35:00 +02:00
parent 3ef4a87ea6
commit 54d830cbac
2 changed files with 38 additions and 3 deletions

View File

@ -12,6 +12,20 @@
public static function template($type=null){ public static function template($type=null){
switch($type){ switch($type){
case 'userheader': return "
<span><strong>Identifiant</strong></span>
<span><strong>Nom</strong></span>
<span><strong>Code RFID</strong></span>
";
break;
case 'machineheader': return "
<span><strong>Nom</strong></span>
";
break;
case 'userlist': return " case 'userlist': return "
<div> <div>
<span>@username</span> <span>@username</span>
@ -49,8 +63,8 @@
<input type='hidden' id='members-member-class' value='@class'> <input type='hidden' id='members-member-class' value='@class'>
<div> <div>
<span><strong>@name</strong></span> @header
<span><strong>@clustertype</strong></span> <span><strong>Membre de <u>@name</u></strong></span>
</div> </div>
@members @members
@ -70,6 +84,7 @@
/* (2) On initialise les vues */ /* (2) On initialise les vues */
$view = ''; $view = '';
$members_view = ''; $members_view = '';
$header = '';
@ -136,6 +151,8 @@
$USERLIST[$u]['already_in'] = in_array($user['id_user'], $members_id) ? 'checked' : ''; $USERLIST[$u]['already_in'] = in_array($user['id_user'], $members_id) ? 'checked' : '';
/* (2) On génère la vue */ /* (2) On génère la vue */
$header = self::template('userheader');
$members_view = View::replaceMultiple( $members_view = View::replaceMultiple(
self::template('userlist'), self::template('userlist'),
$USERLIST $USERLIST
@ -167,6 +184,8 @@
$MACHINELIST[$m]['already_in'] = in_array($machine['id_machine'], $members_id) ? 'checked' : ''; $MACHINELIST[$m]['already_in'] = in_array($machine['id_machine'], $members_id) ? 'checked' : '';
/* (2) On génère la vue */ /* (2) On génère la vue */
$header = self::template('machineheader');
$members_view = View::replaceMultiple( $members_view = View::replaceMultiple(
self::template('machinelist'), self::template('machinelist'),
$MACHINELIST $MACHINELIST
@ -182,7 +201,8 @@
'class' => $params['class'], 'class' => $params['class'],
'name' => $currentCluster['name'], 'name' => $currentCluster['name'],
'clustertype' => ($params['class']==0) ? 'utilisateurs' : 'machines', 'clustertype' => ($params['class']==0) ? 'utilisateurs' : 'machines',
'members' => $members_view 'members' => $members_view,
'header' => $header
] ]
); );
} }

View File

@ -2,6 +2,7 @@
require_once __ROOT__.'/manager/autoloader.php'; require_once __ROOT__.'/manager/autoloader.php';
use \manager\ModuleRequest; use \manager\ModuleRequest;
use \manager\ManagerError; use \manager\ManagerError;
use \manager\Database;
use \manager\Repo; use \manager\Repo;
?> ?>
@ -52,4 +53,18 @@
echo "<input type='text' class='searchbar' placeholder='Recherche'>"; echo "<input type='text' class='searchbar' placeholder='Recherche'>";
/* (1) On récupère les données
---------------------------------------------------------*/
$selReq = Database::getPDO()->query("select count(distinct id_user) as users, max(timestamp) as last from history group by id_machine");
$selected = Database::delNumeric( $selReq->fetchAll() );
foreach($selected as $m=>$mac){
echo "<article class='inline-box'>"
}
echo '</section>'; echo '</section>';