52 lines
1.3 KiB
PHP
Executable File
52 lines
1.3 KiB
PHP
Executable File
<?php
|
|
|
|
namespace viewer\view\group;
|
|
use \api\core\ModuleRequest;
|
|
use \error\core\Error;
|
|
use \api\core\Authentification;
|
|
|
|
class group_choice{
|
|
|
|
public static function render(){
|
|
/* [1] Init Twig
|
|
=========================================================*/
|
|
$loader = new \Twig_Loader_Filesystem(__BUILD__.'/viewer/view');
|
|
$twig = new \Twig_Environment($loader, []);
|
|
|
|
|
|
/* [2] Store variables
|
|
=========================================================*/
|
|
$variables = [
|
|
'p_theme' => $_SESSION['WAREHOUSE']['theme']
|
|
];
|
|
|
|
/* [3] Store functions
|
|
=========================================================*/
|
|
$twig->addFunction(new \Twig_Function('f_clusters', function($class){
|
|
/* (1) On récupère les groupes */
|
|
$getClustersReq = new ModuleRequest('clusterDefault/getAll', ['class' => $class]);
|
|
$getClusters = $getClustersReq->dispatch();
|
|
|
|
/* (2) si erreur, on retourne rien par défaut */
|
|
if( $getClusters->error != Error::Success )
|
|
return [];
|
|
|
|
/* (3) On enregistre le résultat */
|
|
return $getClusters->get('clusters');
|
|
}));
|
|
|
|
|
|
/* [4] Build the whole stuff
|
|
=========================================================*/
|
|
return $twig->render('group/group_choice.twig', [
|
|
'p_icon' => $variables['p_icon'],
|
|
'p_theme' => $variables['p_theme']
|
|
]);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
?>
|