2016-02-03 22:22:18 +00:00
|
|
|
<?php define('__ROOT__', dirname(dirname(__FILE__)) );
|
|
|
|
require_once __ROOT__.'/manager/autoloader.php';
|
2016-02-13 17:47:20 +00:00
|
|
|
use \manager\ModuleRequest;
|
|
|
|
use \manager\ManagerError;
|
2016-02-14 12:55:06 +00:00
|
|
|
use \manager\Repo;
|
2016-02-03 22:22:18 +00:00
|
|
|
?>
|
|
|
|
|
2016-02-02 13:03:22 +00:00
|
|
|
<!-- [1] Gestion du sous-menu de gauche -->
|
|
|
|
|
2016-02-02 22:29:30 +00:00
|
|
|
<nav class='sub-menu-side'>
|
2016-02-05 09:26:10 +00:00
|
|
|
<span data-sublink='view'>
|
2016-07-08 15:04:41 +00:00
|
|
|
<span class='svg'><?php echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/view.svg' ); ?></span>
|
2016-02-03 07:45:42 +00:00
|
|
|
<span>Tout afficher</span>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<span data-sublink='create' >
|
2016-07-08 15:04:41 +00:00
|
|
|
<span class='svg'><?php echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/create.svg' ); ?></span>
|
2016-02-03 07:45:42 +00:00
|
|
|
<span>Creation</span>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<span data-sublink='remove' >
|
2016-07-08 15:04:41 +00:00
|
|
|
<span class='svg'><?php echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/remove.svg' ); ?></span>
|
2016-02-03 07:45:42 +00:00
|
|
|
<span>Suppression</span>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<span data-sublink='edit' >
|
2016-07-08 15:04:41 +00:00
|
|
|
<span class='svg'><?php echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/edit.svg' ); ?></span>
|
2016-02-03 07:45:42 +00:00
|
|
|
<span>Modification</span>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<span data-sublink='filter' >
|
2016-07-08 15:04:41 +00:00
|
|
|
<span class='svg'><?php echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/filter.svg' ); ?></span>
|
2016-02-03 07:45:42 +00:00
|
|
|
<span>Filtrer</span>
|
|
|
|
</span>
|
|
|
|
|
2016-02-02 13:03:22 +00:00
|
|
|
</nav>
|
|
|
|
|
2016-02-03 10:30:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-04 22:45:03 +00:00
|
|
|
<?php
|
2016-02-03 10:30:46 +00:00
|
|
|
|
2016-07-04 13:45:29 +00:00
|
|
|
$post = [];
|
2016-02-04 22:45:03 +00:00
|
|
|
foreach($_POST as $k=>$v)
|
|
|
|
array_push($post, $k);
|
2016-02-03 10:30:46 +00:00
|
|
|
|
2016-02-04 22:45:03 +00:00
|
|
|
$sublink = $post[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-02-14 19:37:41 +00:00
|
|
|
/* [1] VIEW -> Liste des utilisateurs
|
|
|
|
=========================================================*/
|
|
|
|
$request = new ModuleRequest('userDefault/getAll'); // On utilise la methode 'getAll' du module 'userDefault'
|
2016-07-03 12:20:42 +00:00
|
|
|
$answer = $request->dispatch(); // On recupere la reponse
|
2016-02-05 08:18:01 +00:00
|
|
|
|
2016-02-14 19:37:41 +00:00
|
|
|
echo "<section data-sublink='view' class='list'>";
|
|
|
|
// echo 'Liste des utilisateurs: <br>';
|
2016-07-02 16:35:34 +00:00
|
|
|
|
2016-02-14 19:37:41 +00:00
|
|
|
// si erreur, on affiche l'explicitation
|
2016-02-15 21:36:39 +00:00
|
|
|
if( $answer->error != ManagerError::Success ){
|
2016-07-02 16:35:34 +00:00
|
|
|
var_dump( ManagerError::explicit($answer->error) );
|
2016-02-15 21:36:39 +00:00
|
|
|
|
|
|
|
echo "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
|
2016-02-15 21:37:13 +00:00
|
|
|
}
|
2016-02-14 19:37:41 +00:00
|
|
|
|
|
|
|
// Si aucune erreur, on affiche les resultats
|
|
|
|
else{
|
2016-02-15 21:26:34 +00:00
|
|
|
|
|
|
|
// Barre de recherche
|
|
|
|
echo "<input type='text' class='searchbar' placeholder='Recherche'>";
|
|
|
|
|
|
|
|
// Liste des utilisateurs
|
2016-02-14 19:37:41 +00:00
|
|
|
foreach( $answer->get('users') as $user){
|
2016-07-07 15:59:31 +00:00
|
|
|
|
|
|
|
/* (1) On récupère les groupes de la machine */
|
|
|
|
$clustersReq = new ModuleRequest('userDefault/getClusters', [
|
|
|
|
'id_user' => $user['id_user']
|
|
|
|
]);
|
|
|
|
$clustersRes = $clustersReq->dispatch();
|
|
|
|
|
|
|
|
/* (2) Gestion si erreur */
|
|
|
|
if( $clustersRes->error == ManagerError::Success ) $clusters = $clustersRes->get('clusters');
|
|
|
|
else $clusters = [];
|
2016-02-14 19:37:41 +00:00
|
|
|
|
2016-02-16 19:27:57 +00:00
|
|
|
echo "<article class='inline-box' id='".$user['id_user']."'>";
|
2016-02-15 21:01:00 +00:00
|
|
|
|
2016-07-02 16:35:34 +00:00
|
|
|
// Prenom Nom
|
2016-02-14 20:58:49 +00:00
|
|
|
echo "<span class='title'>".$user['firstname']." ".$user['lastname']." <span>#".$user['username']."</span></span>";
|
2016-02-14 19:37:41 +00:00
|
|
|
|
2016-02-15 21:01:00 +00:00
|
|
|
|
|
|
|
|
2016-07-02 16:35:34 +00:00
|
|
|
// Icone vers la suppression
|
2016-02-15 21:01:00 +00:00
|
|
|
echo "<span class='link_remove' data-user='".$user['id_user']."'>";
|
2016-07-08 15:04:41 +00:00
|
|
|
echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/remove.svg' );
|
2016-02-15 21:01:00 +00:00
|
|
|
echo "</span>";
|
|
|
|
|
2016-02-18 11:12:54 +00:00
|
|
|
// Icone vers la modification
|
|
|
|
echo "<span class='link_edit' data-user='".$user['id_user']."'>";
|
2016-07-08 15:04:41 +00:00
|
|
|
echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/edit.svg' );
|
2016-02-18 11:12:54 +00:00
|
|
|
echo "</span>";
|
|
|
|
|
2016-02-15 21:01:00 +00:00
|
|
|
|
|
|
|
|
2016-02-14 19:37:41 +00:00
|
|
|
// Code RFID
|
|
|
|
echo "<span class='code'>";
|
2016-07-08 15:04:41 +00:00
|
|
|
echo file_get_contents( __ROOT__.'/src/static/container/card.svg' );
|
2016-07-02 16:35:34 +00:00
|
|
|
|
2016-02-14 19:37:41 +00:00
|
|
|
echo "<span>";
|
|
|
|
echo $user['code'];
|
|
|
|
echo "</span>";
|
|
|
|
echo"</span>";
|
|
|
|
|
|
|
|
// Adresse email
|
|
|
|
echo "<span class='mail'>";
|
2016-07-08 15:04:41 +00:00
|
|
|
echo file_get_contents( __ROOT__.'/src/static/container/mail.svg' );
|
2016-07-02 16:35:34 +00:00
|
|
|
|
2016-02-14 19:37:41 +00:00
|
|
|
echo "<a href='mailto:".$user['mail']."'><span>";
|
|
|
|
echo $user['mail'];
|
|
|
|
echo "</span></a>";
|
|
|
|
echo"</span>";
|
|
|
|
|
2016-07-08 16:14:06 +00:00
|
|
|
// Groupes de l'utilisateur
|
2016-02-14 19:37:41 +00:00
|
|
|
echo "<span class='groups'>";
|
2016-07-08 15:04:41 +00:00
|
|
|
echo file_get_contents( __ROOT__.'/src/static/container/group.svg' );
|
2016-07-02 16:35:34 +00:00
|
|
|
|
2016-02-14 19:37:41 +00:00
|
|
|
if( $clusters != false )
|
|
|
|
foreach($clusters as $cluster)
|
2016-07-08 17:33:58 +00:00
|
|
|
echo "<span>".$cluster['name']."<span class='rem-group' data-group='".$cluster['id_cluster']."' data-user='".$user['id_user']."'></span></span>";
|
2016-03-02 07:14:19 +00:00
|
|
|
echo "<span class='add-group' data-user='".$user['id_user']."'>+</span>";
|
2016-02-14 19:37:41 +00:00
|
|
|
echo"</span>";
|
|
|
|
|
|
|
|
|
|
|
|
echo "</article>";
|
2016-02-05 09:26:10 +00:00
|
|
|
}
|
2016-02-14 19:37:41 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '</section>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [2] Creation d'utilisateur
|
|
|
|
=========================================================*/
|
|
|
|
echo "<section data-sublink='create'>";
|
2016-02-05 09:26:10 +00:00
|
|
|
|
2016-02-15 09:22:47 +00:00
|
|
|
echo "<form class='valid'>";
|
2016-02-15 11:27:01 +00:00
|
|
|
echo "<input id='create_code' type='text' placeholder='CO-DE-RF-ID'><br>";
|
2016-02-14 19:37:41 +00:00
|
|
|
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>";
|
2016-02-14 20:22:07 +00:00
|
|
|
echo "<input id='create_password' type='password' placeholder='Password'><br>";
|
|
|
|
echo "<input id='create_status' type='text' placeholder='Status'><br>";
|
2016-02-14 19:37:41 +00:00
|
|
|
echo "<button id='create_submit'>Créer</button>";
|
|
|
|
echo "</form>";
|
2016-02-04 22:45:03 +00:00
|
|
|
|
2016-02-14 21:50:07 +00:00
|
|
|
echo '</section>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [3] Suppression d'utilisateur
|
|
|
|
=========================================================*/
|
|
|
|
echo "<section data-sublink='remove'>";
|
|
|
|
|
2016-02-15 11:27:01 +00:00
|
|
|
echo "<form class='invalid'>";
|
2016-02-17 11:09:23 +00:00
|
|
|
// Recherche d'utilisateur
|
2016-02-17 10:24:26 +00:00
|
|
|
echo "<input id='remove_search_keyword' type='text' class='search' placeholder='Recherche...'><br>";
|
2016-02-17 11:09:23 +00:00
|
|
|
echo "<input id='remove_search_id' type='hidden' value=''>";
|
|
|
|
// Indice du resultat
|
|
|
|
echo "<span class='remove_search_view'>utilisateur <span class='remove_search_num'>0</span> sur <span class='remove_search_sum'>0</span></span><br><br>";
|
2016-02-17 10:24:26 +00:00
|
|
|
echo "<button id='remove_search_submit' class='search'>Trouver</button><br>";
|
2016-02-17 11:09:23 +00:00
|
|
|
|
2016-07-02 16:35:34 +00:00
|
|
|
|
2016-02-17 10:24:26 +00:00
|
|
|
echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>";
|
2016-07-02 16:35:34 +00:00
|
|
|
|
2016-02-17 11:09:23 +00:00
|
|
|
// Suppression d'utilisateur
|
2016-02-14 21:50:07 +00:00
|
|
|
echo "<input id='remove_code' type='text' placeholder='Code'><br>";
|
2016-02-15 11:27:01 +00:00
|
|
|
echo "<input id='remove_username' type='text' placeholder='Username'><br>";
|
2016-02-16 21:59:01 +00:00
|
|
|
echo "<button id='remove_submit' disabled>Supprimer</button>";
|
2016-02-14 21:50:07 +00:00
|
|
|
echo "</form>";
|
|
|
|
|
2016-02-15 11:27:01 +00:00
|
|
|
echo '</section>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [4] Modification d'utilisateur
|
|
|
|
=========================================================*/
|
|
|
|
echo "<section data-sublink='edit'>";
|
|
|
|
|
|
|
|
echo "<form class='neutral'>";
|
2016-02-16 13:25:06 +00:00
|
|
|
echo "<input id='edit_search_keyword' type='text' class='search' placeholder='Recherche...'><br>";
|
2016-02-17 11:09:23 +00:00
|
|
|
echo "<input id='edit_search_id' type='hidden' value=''>";
|
|
|
|
// Indice du resultat
|
|
|
|
echo "<span class='edit_search_view'>utilisateur <span class='edit_search_num'>0</span> sur <span class='edit_search_sum'>0</span></span><br><br>";
|
2016-02-17 10:24:26 +00:00
|
|
|
echo "<button id='edit_search_submit' class='search'>Trouver</button><br>";
|
2016-07-02 16:35:34 +00:00
|
|
|
|
2016-02-17 10:24:26 +00:00
|
|
|
echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>";
|
2016-02-16 13:25:06 +00:00
|
|
|
|
2016-02-15 14:43:47 +00:00
|
|
|
echo "<input id='edit_code' type='text' placeholder='CO-DE-RF-ID'><br>";
|
|
|
|
echo "<input id='edit_username' type='text' placeholder='Username'><br>";
|
|
|
|
echo "<input id='edit_firstname' type='text' placeholder='Firstname'><br>";
|
|
|
|
echo "<input id='edit_lastname' type='text' placeholder='Lastname'><br>";
|
|
|
|
echo "<input id='edit_mail' type='text' placeholder='Mail'><br>";
|
|
|
|
echo "<input id='edit_password' type='password' placeholder='Password'><br>";
|
|
|
|
echo "<input id='edit_status' type='text' placeholder='Status'><br>";
|
2016-02-16 21:59:01 +00:00
|
|
|
echo "<button id='edit_submit' disabled>Modifier</button>";
|
2016-02-15 11:27:01 +00:00
|
|
|
echo "</form>";
|
|
|
|
|
2016-02-18 14:49:06 +00:00
|
|
|
echo '</section>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [4] Gestion de filtrage
|
|
|
|
=========================================================*/
|
|
|
|
echo "<section data-sublink='filter'>";
|
|
|
|
|
|
|
|
echo "<form class='neutral'>";
|
2016-07-02 16:35:34 +00:00
|
|
|
|
2016-02-18 14:49:06 +00:00
|
|
|
echo "</form>";
|
|
|
|
|
2016-07-02 16:35:34 +00:00
|
|
|
echo '</section>';
|