This commit is contained in:
xdrm-brackets 2016-07-12 17:40:40 +02:00
parent 0332a4b45a
commit 9bc0370855
6 changed files with 139 additions and 7 deletions

View File

@ -581,4 +581,19 @@
}
}
/* [4] Tableau à cocher
=========================================================*/
& table.check-table{
display: block;
position: relative;
width: 100%;
border: 1px solid red;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,103 @@
<?php
namespace manager\view\group;
use \manager\View;
use \manager\ModuleRequest;
use \manager\Authentification;
use \manager\ManagerError;
class userChoice{
public static function template($type=null){
switch($type){
case 'userlist': return "
<tr>
<td>@username</td>
<td>@firstname @lastname</td>
<td>@code</td>
<td>
<input type='checkbox' value='@id_user' @already_in>
</td>
</tr>
";
break;
default: return "
<table class='check-table'>
@userlist
</table>";
break;
}
}
public static function view($params){
// On vérifie les paramètres
if( !isset($params['id_cluster']) && !is_number($params['id_cluster']) )
return "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
$view = '';
/* [1] On récupère la liste des utilisateurs
=========================================================*/
$request = new ModuleRequest('userDefault/getAll'); // On utilise la methode 'getAll' du module 'userDefault'
$answer = $request->dispatch(); // On recupere la reponse
// si erreur, on affiche l'explicitation
if( $answer->error != ManagerError::Success )
return "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
$USERLIST = $answer->get('users');
/* [2] On récupère la liste des membres
=========================================================*/
$get_members = new ModuleRequest('clusterDefault/getMembers', [
'id_cluster' => $params['id_cluster']
]);
$members_response = $get_members->dispatch();
// On récupère la liste des UID uniquement
$members_id = [];
foreach($members_response->get('members') as $member)
$members_id[] = $member['id_member'];
foreach($USERLIST as $u=>$user)
$USERLIST[$u]['already_in'] = in_array($user['id_user'], $members_id) ? 'checked' : '';
$view_user = View::replaceMultiple(
self::template('userlist'),
$USERLIST, [
'icon_remove' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/remove.svg' ),
'icon_edit' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/edit.svg' ),
'icon_card' => file_get_contents( __ROOT__.'/src/static/container/card.svg' ),
'icon_mail' => file_get_contents( __ROOT__.'/src/static/container/mail.svg' ),
'icon_group' => file_get_contents( __ROOT__.'/src/static/container/group.svg' ),
]);
return View::replaceSingle(self::template(), [ 'userlist' => $view_user ]);
}
}
?>

View File

@ -31,7 +31,7 @@
<span data-sublink='filter' >
<span class='svg'><?php echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/filter.svg' ); ?></span>
<span>Filtrer</span>
<span>Composition</span>
</span>
</nav>
@ -175,8 +175,10 @@
=========================================================*/
echo "<section data-sublink='filter'>";
debug();
$userForGroup = new View('group.userChoice', [
'id_cluster' => 206 // groupe "b" de type MACHINE
'id_cluster' => 201 // groupe "b" de type MACHINE
]);
$userForGroup->view();

View File

@ -34,6 +34,8 @@ if( section.view.element != null ){
/* (0) On gère le zoom sur un utilisateur via URL */
if( pageManager.vars.length > 1 && !isNaN(pageManager.vars[1]) ){
document.location = '#'+pageManager.vars[1];
document.getElementById(pageManager.vars[1]).addClass('selected');
}
}
@ -140,7 +142,7 @@ if( section.view.element != null ){
}
}
};