SMMP/public_html/view/extensions.php

209 lines
3.5 KiB
PHP
Executable File

<?php define('__ROOT__', dirname(dirname(dirname(__FILE__))) );
require_once __ROOT__.'/vendor/autoload.php';
use \api\core\Request;
use \database\core\Repo;
use \viewer\core\Viewer;
?>
<!-- [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/permission.svg' ); ?></span>
<span>Général</span>
</span>
<span data-sublink='manage' >
<span class='svg'><?php echo file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/view.svg' ); ?></span>
<span>Consulter le suivi</span>
</span>
<span data-sublink='start' >
<span class='svg'><?php echo file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/sync.svg' ); ?></span>
<span>Demarrer un suivi</span>
</span>
<span data-sublink='search' >
<span class='svg'><?php echo file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/search.svg' ); ?></span>
<span>Recherche</span>
</span>
</nav>
<?php
$post = [];
foreach($_POST as $k=>$v)
array_push($post, $k);
$sublink = $post[0];
/* [1] Affichage des groupes de machines
=========================================================*/
debug();
echo "<section data-sublink='view' class='list'>";
$extensionView = new Viewer('extension.view', []);
$extensionView->view();
echo '</section>';
/* PAGE DES STATISTIQUES
*
*/
// if( $sublink == 'analytics' ){
echo "<section data-sublink='manage'>";
/* (1) Modules de l'entrepot
---------------------------------------------------------*/
echo "<pre><u>Modules entrepot:</u>\n";
/* (1) Requete de récupération */
$req_mods = new Repo('warehouse/getModules', [$_SESSION['WAREHOUSE']['id']]);
/* (2) Gestion erreur */
if( $req_mods->answer() === false )
die('fetch error: '.$req_mods->error->get());
/* (3) Affichage de la liste */
foreach($req_mods->answer() as $module)
echo " * ".$module['name']."\n";
echo "\n\n\n";
/* (2) Modules par groupes de machines
---------------------------------------------------------*/
echo "<u>Modules par groupes de machines:</u> \n";
/* (1) Requête de récupération des groupes */
$req_mc = new Repo('machine_cluster/getAll', [$_SESSION['WAREHOUSE']['id']]);
/* (2) Gestion erreur */
if( !$req_mc->answer() )
die('fetch error: '.$req_mc->error->get());
/* (3) Parcours des groupes */
foreach($req_mc->answer() as $mc){
echo " ".$mc['name']."\n";
/* (4) Requête récupération des modules */
$req_mc_mods = new Request('clusterDefault/getModules', [
'id_cluster' => $mc['id_machine_cluster']
]);
$res = $req_mc_mods->dispatch();
/* (5) Gestion erreur */
if( $res->error->get() !== 0 )
die('fetch error: '.$res->error->get());
/* (6) Pour chaque module : affichage */
foreach($res->get('modules') as $mod){
$id = $mod['id_module'];
$name = $mod['name'];
echo " * $name ($id)\n";
}
}
echo "</pre>";
echo '</section>';
// }
/* CONSULTATION DU SUIVI
*
*/
// if( $sublink == 'view' ){
echo "<section data-sublink='view'>";
echo 'Consultation du suivi';
echo '</section>';
// }
/* DEMARRER UN SUIVI
*
*/
// if( $sublink == 'start' ){
echo "<section data-sublink='start'>";
echo 'Demarrer un suivi';
echo '</section>';
// }
/* RECHERCHE
*
*/
// if( $sublink == 'search' ){
echo "<section data-sublink='search'>";
echo 'Recherche';
echo '</section>';
// }
?>