@name "; break; case 'machine_cluster': return "
@name @icon_remove @icon_type @count machines @icon_group @machines +
"; break; default: return " @clusterlist"; break; } } public static function view($params){ $view = ''; /* [1] On récupère la liste des utilisateurs =========================================================*/ $request = new ModuleRequest('clusterDefault/getAll', [ 'class' => 1 ]); $answer = $request->dispatch(); // si erreur, on affiche l'explicitation if( $answer->error != ManagerError::Success ) return View::$htmlError; $CLUSTERLIST = $answer->get('clusters'); foreach($CLUSTERLIST as $c=>$cluster){ $machinesReq = new ModuleRequest('clusterDefault/getMembers', [ 'id_cluster' => $cluster['id_machine_cluster'], 'class' => 1 ]); $machinesRes = $machinesReq->dispatch(); /* (2) Gestion si erreur */ if( $machinesRes->error == ManagerError::Success ) $machines = $machinesRes->get('members'); else $machines = []; $CLUSTERLIST[$c]['count'] = count($machines); $CLUSTERLIST[$c]['machines'] = View::replaceMultiple( self::template('machine'), $machines, [ 'id_machine_cluster' => $cluster['id_machine_cluster'] ] ); } $view_cluster = View::replaceMultiple( self::template('machine_cluster'), $CLUSTERLIST, [ 'icon_remove' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/remove.svg' ), 'icon_edit' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/edit.svg' ), 'icon_type' => file_get_contents( __ROOT__.'/src/static/menu-side/device.svg' ), 'icon_group' => file_get_contents( __ROOT__.'/src/static/container/group.svg' ), ]); return View::replaceSingle(self::template(), [ 'clusterlist' => $view_cluster ]); } } ?>