266 lines
7.5 KiB
PHP
Executable File
266 lines
7.5 KiB
PHP
Executable File
<?php define('__ROOT__', dirname(dirname(__FILE__)) );
|
|
require_once __ROOT__.'/manager/autoloader.php';
|
|
use \manager\View;
|
|
use \manager\ModuleRequest;
|
|
use \manager\ManagerError;
|
|
use \manager\Repo;
|
|
?>
|
|
|
|
<!-- [1] Gestion du sous-menu de gauche -->
|
|
|
|
<nav class='sub-menu-side'>
|
|
<span data-sublink='view'>
|
|
<span class='svg'><?php echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/view.svg' ); ?></span>
|
|
<span>Tout afficher</span>
|
|
</span>
|
|
|
|
<span data-sublink='create' >
|
|
<span class='svg'><?php echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/create.svg' ); ?></span>
|
|
<span>Creation</span>
|
|
</span>
|
|
|
|
<span data-sublink='remove' >
|
|
<span class='svg'><?php echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/remove.svg' ); ?></span>
|
|
<span>Suppression</span>
|
|
</span>
|
|
|
|
<span data-sublink='edit' >
|
|
<span class='svg'><?php echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/edit.svg' ); ?></span>
|
|
<span>Modification</span>
|
|
</span>
|
|
|
|
<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>
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
$post = [];
|
|
foreach($_POST as $k=>$v)
|
|
array_push($post, $k);
|
|
|
|
$sublink = $post[0];
|
|
|
|
|
|
|
|
/* [1] VIEW -> Liste des groupes
|
|
=========================================================*/
|
|
$request = new ModuleRequest('clusterDefault/getAll'); // On utilise la methode 'getAll' du module 'groupDefault'
|
|
$answer = $request->dispatch(); // On recupere la reponse
|
|
|
|
echo "<section data-sublink='view' class='list'>";
|
|
|
|
debug();
|
|
$clusterView = new View('group.view', []);
|
|
$clusterView->view();
|
|
|
|
// // si erreur, on affiche l'explicitation
|
|
// if( $answer->error != ManagerError::Success ){
|
|
// // var_dump( ManagerError::explicit($answer->error) );
|
|
//
|
|
// echo "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
|
|
// }
|
|
//
|
|
// // Si aucune erreur, on affiche les resultats
|
|
// else{
|
|
// debug();
|
|
//
|
|
// // Barre de recherche
|
|
// echo "<input type='text' class='searchbar' placeholder='Recherche'>";
|
|
//
|
|
// foreach($answer->get('clusters') as $cluster){
|
|
//
|
|
// // Liste des membres
|
|
// $get_membersReq = new ModuleRequest('clusterDefault/getMembers', ['id_cluster' => $cluster['id_cluster']] );
|
|
// $get_membersRes = $get_membersReq->dispatch();
|
|
//
|
|
// // Si erreur, valeur par d
|
|
// if( $get_membersRes->error != ManagerError::Success )
|
|
// $members = [];
|
|
// else
|
|
// $members = $get_membersRes->get('members');
|
|
//
|
|
//
|
|
//
|
|
// echo "<article class='inline-box' id='".$cluster['id_cluster']."'>";
|
|
//
|
|
// // Prenom Nom
|
|
// echo "<span class='title'>".$cluster['name']."</span></span>";
|
|
//
|
|
//
|
|
//
|
|
// // Icone vers la suppression
|
|
// echo "<span class='link_remove' data-cluster='".$cluster['id_cluster']."'>";
|
|
// echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/remove.svg' );
|
|
// echo "</span>";
|
|
//
|
|
// // Icone vers la modification
|
|
// echo "<span class='link_edit' data-cluster='".$cluster['id_cluster']."'>";
|
|
// echo file_get_contents( __ROOT__.'/src/static/sub-menu-side/edit.svg' );
|
|
// echo "</span>";
|
|
//
|
|
//
|
|
//
|
|
// // Code RFID
|
|
// echo "<span class='code'>";
|
|
// echo file_get_contents( __ROOT__.'/src/static/container/card.svg' );
|
|
//
|
|
// echo "<span>";
|
|
// echo "groupe d". ($cluster['class']==0 ? '\'utilisateurs' : 'e machines');
|
|
// echo "</span>";
|
|
// echo"</span>";
|
|
//
|
|
// // Adresse email
|
|
// echo "<span class='mail'>";
|
|
// echo file_get_contents( __ROOT__.'/src/static/container/mail.svg' );
|
|
//
|
|
// echo "<span>";
|
|
// echo count($members).' membre(s)';
|
|
// echo "</span>";
|
|
// echo"</span>";
|
|
//
|
|
// // Groupes de la machine
|
|
// echo "<span class='groups'>";
|
|
// echo file_get_contents( __ROOT__.'/src/static/container/group.svg' );
|
|
//
|
|
// foreach($members as $member)
|
|
// if( $member['name'] != $cluster['name'] ) // Si c'est le groupe personnel, on ne l'affiche pas
|
|
// echo "<span>".$member['name']."<span class='rem-member' data-member='".$member['id_member']."' data-cluster='".$cluster['id_cluster']."'></span></span>";
|
|
//
|
|
// echo "<span class='add-member' data-cluster='".$cluster['id_cluster']."'>+</span>";
|
|
// echo"</span>";
|
|
//
|
|
//
|
|
// echo "</article>";
|
|
// }
|
|
//
|
|
// }
|
|
|
|
echo '</section>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [2] Creation d'utilisateur
|
|
=========================================================*/
|
|
echo "<section data-sublink='create'>";
|
|
|
|
echo "<form class='valid'>";
|
|
echo "<input id='create_name' type='text' placeholder='Nom'><br>";
|
|
|
|
echo "<select id='create_class'>
|
|
<option value='-' selected disabled>Type de groupe</option>
|
|
<option value='0'>utilisateurs</option>
|
|
<option value='1'>machines</option>
|
|
</select>";
|
|
|
|
echo "<button id='create_submit'>Créer</button>";
|
|
echo "</form>";
|
|
|
|
echo '</section>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [3] Suppression d'utilisateur
|
|
=========================================================*/
|
|
echo "<section data-sublink='remove'>";
|
|
|
|
echo "<form class='invalid'>";
|
|
// Recherche d'utilisateur
|
|
echo "<input id='remove_search_keyword' type='text' class='search' placeholder='Recherche...'><br>";
|
|
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>";
|
|
echo "<button id='remove_search_submit' class='search'>Trouver</button><br>";
|
|
|
|
|
|
echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>";
|
|
|
|
// Suppression d'utilisateur
|
|
echo "<input id='remove_code' type='text' placeholder='Code'><br>";
|
|
echo "<input id='remove_username' type='text' placeholder='Username'><br>";
|
|
echo "<button id='remove_submit' disabled>Supprimer</button>";
|
|
echo "</form>";
|
|
|
|
echo '</section>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [4] Modification d'utilisateur
|
|
=========================================================*/
|
|
echo "<section data-sublink='edit'>";
|
|
|
|
echo "<form class='neutral'>";
|
|
echo "<input id='edit_search_keyword' type='text' class='search' placeholder='Recherche...'><br>";
|
|
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>";
|
|
echo "<button id='edit_search_submit' class='search'>Trouver</button><br>";
|
|
|
|
echo "<br><br><hr class='OR' data-label='PUIS' /><br><br>";
|
|
|
|
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>";
|
|
echo "<button id='edit_submit' disabled>Modifier</button>";
|
|
echo "</form>";
|
|
|
|
echo '</section>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [4] Gestion de filtrage
|
|
=========================================================*/
|
|
echo "<section data-sublink='filter'>";
|
|
|
|
echo "<form class='neutral'>";
|
|
|
|
echo "</form>";
|
|
|
|
echo '</section>';
|