header pour les membres des groupes 'groups/members'

This commit is contained in:
xdrm-brackets 2016-07-21 15:35:00 +02:00
parent 6e8e0ff786
commit 5eb766e030
2 changed files with 38 additions and 3 deletions

View File

@ -12,6 +12,20 @@
public static function template($type=null){
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 "
<div>
<span>@username</span>
@ -49,8 +63,8 @@
<input type='hidden' id='members-member-class' value='@class'>
<div>
<span><strong>@name</strong></span>
<span><strong>@clustertype</strong></span>
@header
<span><strong>Membre de <u>@name</u></strong></span>
</div>
@members
@ -70,6 +84,7 @@
/* (2) On initialise les vues */
$view = '';
$members_view = '';
$header = '';
@ -136,6 +151,8 @@
$USERLIST[$u]['already_in'] = in_array($user['id_user'], $members_id) ? 'checked' : '';
/* (2) On génère la vue */
$header = self::template('userheader');
$members_view = View::replaceMultiple(
self::template('userlist'),
$USERLIST
@ -167,6 +184,8 @@
$MACHINELIST[$m]['already_in'] = in_array($machine['id_machine'], $members_id) ? 'checked' : '';
/* (2) On génère la vue */
$header = self::template('machineheader');
$members_view = View::replaceMultiple(
self::template('machinelist'),
$MACHINELIST
@ -182,7 +201,8 @@
'class' => $params['class'],
'name' => $currentCluster['name'],
'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';
use \manager\ModuleRequest;
use \manager\ManagerError;
use \manager\Database;
use \manager\Repo;
?>
@ -52,4 +53,18 @@
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>';