172 lines
4.7 KiB
PHP
Executable File
172 lines
4.7 KiB
PHP
Executable File
<?php define('__ROOT__', dirname(dirname(__FILE__)) );
|
|
require_once __ROOT__.'/manager/autoloader.php';
|
|
use \manager\ModuleRequest;
|
|
use \manager\ManagerError;
|
|
use \manager\ResourceDispatcher;
|
|
use \manager\Repo;
|
|
?>
|
|
|
|
<!-- [1] Gestion du sous-menu de gauche -->
|
|
|
|
<nav class='sub-menu-side'>
|
|
<span data-sublink='view'>
|
|
<span class='svg'><?php echo ResourceDispatcher::getResource( 'f/svg/view/st/sub-menu-side' ); ?></span>
|
|
<span>Tout afficher</span>
|
|
</span>
|
|
|
|
<span data-sublink='create' >
|
|
<span class='svg'><?php echo ResourceDispatcher::getResource( 'f/svg/create/st/sub-menu-side' ); ?></span>
|
|
<span>Creation</span>
|
|
</span>
|
|
|
|
<span data-sublink='remove' >
|
|
<span class='svg'><?php echo ResourceDispatcher::getResource( 'f/svg/remove/st/sub-menu-side' ); ?></span>
|
|
<span>Suppression</span>
|
|
</span>
|
|
|
|
<span data-sublink='edit' >
|
|
<span class='svg'><?php echo ResourceDispatcher::getResource( 'f/svg/edit/st/sub-menu-side' ); ?></span>
|
|
<span>Modification</span>
|
|
</span>
|
|
|
|
<span data-sublink='filter' >
|
|
<span class='svg'><?php echo ResourceDispatcher::getResource( 'f/svg/filter/st/sub-menu-side' ); ?></span>
|
|
<span>Filtrer</span>
|
|
</span>
|
|
|
|
<span data-sublink='search' >
|
|
<span class='svg'><?php echo ResourceDispatcher::getResource( 'f/svg/search/st/sub-menu-side' ); ?></span>
|
|
<span>Recherche</span>
|
|
</span>
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
$post = array();
|
|
foreach($_POST as $k=>$v)
|
|
array_push($post, $k);
|
|
|
|
$sublink = $post[0];
|
|
|
|
|
|
|
|
/* [1] VIEW -> Liste des utilisateurs
|
|
=========================================================*/
|
|
$request = new ModuleRequest('userDefault/getAll'); // On utilise la methode 'getAll' du module 'userDefault'
|
|
$answer = $request->dispatch(); // On recupere la reponse
|
|
|
|
echo "<section data-sublink='view' class='list'>";
|
|
// echo 'Liste des utilisateurs: <br>';
|
|
|
|
// si erreur, on affiche l'explicitation
|
|
if( $answer->error != ManagerError::Success )
|
|
var_dump( ManagerError::explicit($answer->error) );
|
|
|
|
// Si aucune erreur, on affiche les resultats
|
|
else{
|
|
foreach( $answer->get('users') as $user){
|
|
$clusters = new Repo('user/getClusters', array($user['id_user']));
|
|
$clusters = $clusters->answer();
|
|
|
|
echo "<article class='inline-box'>";
|
|
// Prenom Nom
|
|
echo "<span class='title'>".$user['firstname']." ".$user['lastname']." <span>#".$user['username']."</span></span>";
|
|
|
|
// Code RFID
|
|
echo "<span class='code'>";
|
|
echo ResourceDispatcher::getResource('f/svg/card/st/container');
|
|
|
|
echo "<span>";
|
|
echo $user['code'];
|
|
echo "</span>";
|
|
echo"</span>";
|
|
|
|
// Adresse email
|
|
echo "<span class='mail'>";
|
|
echo ResourceDispatcher::getResource('f/svg/mail/st/container');
|
|
|
|
echo "<a href='mailto:".$user['mail']."'><span>";
|
|
echo $user['mail'];
|
|
echo "</span></a>";
|
|
echo"</span>";
|
|
|
|
// Groupes de la machine
|
|
echo "<span class='groups'>";
|
|
echo ResourceDispatcher::getResource('f/svg/group/st/container');
|
|
|
|
if( $clusters != false )
|
|
foreach($clusters as $cluster)
|
|
echo "<span>".$cluster['name']."</span>";
|
|
echo"</span>";
|
|
|
|
// Icone vers la modification
|
|
echo "<span class='link_edit' data-user='".$user['id_user']."'>";
|
|
echo ResourceDispatcher::getResource('f/svg/edit/st/sub-menu-side');
|
|
echo "</span>";
|
|
|
|
// Icone vers la suppression
|
|
echo "<span class='link_remove' data-user='".$user['id_user']."'>";
|
|
echo ResourceDispatcher::getResource('f/svg/remove/st/sub-menu-side');
|
|
echo "</span>";
|
|
|
|
echo "</article>";
|
|
}
|
|
var_dump( $answer->get('users') );
|
|
|
|
}
|
|
|
|
echo '</section>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [2] Creation d'utilisateur
|
|
=========================================================*/
|
|
echo "<section data-sublink='create'>";
|
|
|
|
echo "<form>";
|
|
echo "<input id='create_code' type='text' placeholder='Code'><br>";
|
|
echo "<input id='create_username' type='text' placeholder='Username'><br>";
|
|
echo "<input id='create_firstname' type='text' placeholder='Firstname'><br>";
|
|
echo "<input id='create_lastname' type='text' placeholder='Lastname'><br>";
|
|
echo "<input id='create_mail' type='text' placeholder='Mail'><br>";
|
|
echo "<input id='create_password' type='password' placeholder='Password'><br>";
|
|
echo "<input id='create_status' type='text' placeholder='Status'><br>";
|
|
echo "<button id='create_submit'>Créer</button>";
|
|
echo "</form>";
|
|
|
|
echo '</section>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [3] Suppression d'utilisateur
|
|
=========================================================*/
|
|
echo "<section data-sublink='remove'>";
|
|
|
|
echo "<form>";
|
|
echo "<input id='remove_code' type='text' placeholder='Code'><br>";
|
|
echo "<button id='remove_submit'>Supprimer</button>";
|
|
echo "</form>";
|
|
|
|
echo '</section>';
|