209 lines
5.1 KiB
PHP
Executable File
209 lines
5.1 KiB
PHP
Executable File
<?php define('__ROOT__', dirname(dirname(dirname(__FILE__))) );
|
|
require_once __ROOT__.'/autoloader.php';
|
|
use \viewer\core\Viewer;
|
|
use \api\core\Request;
|
|
use \database\core\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( __PUBLIC__.'/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( __PUBLIC__.'/src/static/sub-menu-side/create.svg' ); ?></span>
|
|
<span>Creation</span>
|
|
</span>
|
|
|
|
<span data-sublink='remove' >
|
|
<span class='svg'><?php echo file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/remove.svg' ); ?></span>
|
|
<span>Suppression</span>
|
|
</span>
|
|
|
|
<span data-sublink='edit' >
|
|
<span class='svg'><?php echo file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/edit.svg' ); ?></span>
|
|
<span>Modification</span>
|
|
</span>
|
|
|
|
<span data-sublink='members' >
|
|
<span class='svg'><?php echo file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/filter.svg' ); ?></span>
|
|
<span>Composition</span>
|
|
</span>
|
|
|
|
<span data-sublink='permissions' >
|
|
<span class='svg'><?php echo file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/permission.svg' ); ?></span>
|
|
<span>Permissions</span>
|
|
</span>
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
$post = [];
|
|
foreach($_POST as $k=>$v)
|
|
array_push($post, $k);
|
|
|
|
$sublink = $post[0];
|
|
|
|
|
|
|
|
/* [1] VIEW -> Liste des groupes
|
|
=========================================================*/
|
|
$request = new Request('clusterDefault/getAll'); // On utilise la methode 'getAll' du module 'groupDefault'
|
|
$answer = $request->dispatch(); // On recupere la reponse
|
|
|
|
echo "<section data-sublink='view' class='list'>";
|
|
|
|
$clusterView = new Viewer('group.view', []);
|
|
$clusterView->view();
|
|
|
|
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 de groupe
|
|
=========================================================*/
|
|
echo "<section data-sublink='remove'>";
|
|
|
|
echo "<form class='invalid'>";
|
|
// Recherche de groupe
|
|
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'>groupe <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 de groupe
|
|
echo "<input id='remove_name' type='text' placeholder='Nom' disabled><br>";
|
|
echo "<input id='remove_class' type='text' placeholder='Type de groupe' disabled><br>";
|
|
echo "<button id='remove_submit' disabled>Supprimer</button>";
|
|
echo "</form>";
|
|
|
|
echo '</section>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [4] Modification de groupe
|
|
=========================================================*/
|
|
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'>groupe <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_name' type='text' placeholder='Nom'><br>";
|
|
echo "<input id='edit_class' type='text' placeholder='Type de groupe' disabled><br>";
|
|
echo "<button id='edit_submit' disabled>Modifier</button>";
|
|
echo "</form>";
|
|
|
|
echo '</section>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [4] Gestion de filtrage
|
|
=========================================================*/
|
|
echo "<section data-sublink='members'>";
|
|
|
|
/* (1) Si on a un ID_CLUSTER, on affiche la composition
|
|
---------------------------------------------------------*/
|
|
if( isset($post[1]) && preg_match('/^(u|m)(\d+)$/', $post[1], $m) ){
|
|
|
|
$membersChoice = new Viewer('group.members_choice', [
|
|
'id_cluster' => (int) $m[2],
|
|
'class' => (int) ($m[1]=='u') ? 0 : 1
|
|
]);
|
|
$membersChoice->view();
|
|
|
|
}else{
|
|
|
|
$groupChoice = new Viewer('group.group_choice', []);
|
|
$groupChoice->view();
|
|
|
|
}
|
|
|
|
echo '</section>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* [5] Gestion des permissions
|
|
=========================================================*/
|
|
echo "<section data-sublink='permissions'>";
|
|
|
|
$groupChoice = new Viewer('group.permission', []);
|
|
$groupChoice->view();
|
|
|
|
echo '</section>';
|