@cluster_name "; break; case 'user': return "
@user_firstname @user_lastname #@user_username @icon_remove @icon_edit @icon_card @user_code @icon_mail @user_mail @icon_group @grouplist +
"; break; default: return " @userlist"; break; } } public static function userlist($params){ $view = ''; /* [1] On récupère la liste des utilisateurs =========================================================*/ $request = new ModuleRequest('userDefault/getAll'); // On utilise la methode 'getAll' du module 'userDefault' $answer = $request->dispatch(); // On recupere la reponse // si erreur, on affiche l'explicitation if( $answer->error != ManagerError::Success ) return "Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste."; $view_user = ''; foreach($answer->get('users') as $user){ $view_cluster = ''; /* [2] On ajoute les données de ses groupes =========================================================*/ /* (1) On récupère les groupes de la machine */ $clustersReq = new ModuleRequest('userDefault/getClusters', [ 'id_user' => $user['id_user'] ]); $clustersRes = $clustersReq->dispatch(); /* (2) Gestion si erreur */ if( $clustersRes->error == ManagerError::Success ) $clusters = $clustersRes->get('clusters'); else $clusters = []; /* (3) On crée la vue */ foreach($clusters as $cluster){ $view_cluster .= View::replace(self::templateUserlist('cluster'),[ 'cluster_id' => $cluster['id_cluster'], 'user_id' => $user['id_user'] ]); } /* [3] On ajoute les données utilisateurs =========================================================*/ $view_user .= View::replace(self::templateUserlist('user'), [ 'user_id' => $user['id_user'], 'user_username' => $user['username'], 'user_firstname' => $user['firstname'], 'user_lastname' => $user['lastname'], 'user_code' => $user['code'], 'user_mail' => $user['mail'], '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_card' => file_get_contents( __ROOT__.'/src/static/container/card.svg' ), 'icon_mail' => file_get_contents( __ROOT__.'/src/static/container/mail.svg' ), 'icon_group' => file_get_contents( __ROOT__.'/src/static/container/group.svg' ), 'grouplist' => $view_cluster ]); $view .= $view_user; } return View::replace(self::templateUserlist(), [ 'userlist' => $view_user ]); } } ?>