@name "; break; case 'machine': return "
@name #@name @icon_remove @icon_edit @icon_group @grouplist
"; break; default: return " @machinelist"; break; } } public static function view($params){ $view = ''; /* [1] On récupère la liste des machines =========================================================*/ $request = new ModuleRequest('machineDefault/getAll'); // On utilise la methode 'getAll' du module 'machineDefault' $answer = $request->dispatch(); // On recupere la reponse // si erreur, on affiche l'explicitation if( $answer->error != Error::Success ) return Viewer::$htmlError; $MACHINELIST = $answer->get('machines'); foreach($MACHINELIST as $u=>$machine){ $clustersReq = new ModuleRequest('machineDefault/getClusters', [ 'id_machine' => $machine['id_machine'] ]); $clustersRes = $clustersReq->dispatch(); /* (2) Gestion si erreur */ if( $clustersRes->error == Error::Success ) $clusters = $clustersRes->get('clusters'); else $clusters = []; $MACHINELIST[$u]['grouplist'] = Viewer::replaceMultiple( self::template('cluster'), $clusters, [ 'id_machine' => $machine['id_machine'] ] ); } $view_machine = Viewer::replaceMultiple( self::template('machine'), $MACHINELIST, [ 'icon_remove' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/remove.svg' ), 'icon_edit' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/edit.svg' ), 'icon_group' => file_get_contents( __PUBLIC__.'/src/static/container/group.svg' ), ]); return Viewer::replaceSingle(self::template(), [ 'machinelist' => $view_machine ]); } } ?>