@username "; break; case 'user_cluster': return "
@name @icon_remove @icon_edit @icon_type @count utilisateurs @icon_group @users +
"; 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' => 0 ]); $answer = $request->dispatch(); // si erreur, on affiche l'explicitation if( $answer->error != Error::Success ) return Viewer::$htmlError; $CLUSTERLIST = $answer->get('clusters'); foreach($CLUSTERLIST as $c=>$cluster){ $usersReq = new ModuleRequest('clusterDefault/getMembers', [ 'id_cluster' => $cluster['id_user_cluster'], 'class' => 0 ]); $usersRes = $usersReq->dispatch(); /* (2) Gestion si erreur */ if( $usersRes->error == Error::Success ) $users = $usersRes->get('members'); else $users = []; $CLUSTERLIST[$c]['count'] = count($users); $CLUSTERLIST[$c]['users'] = Viewer::replaceMultiple( self::template('user'), $users, [ 'id_cluster' => $cluster['id_user_cluster'] ] ); } $view_cluster = Viewer::replaceMultiple( self::template('user_cluster'), $CLUSTERLIST, [ '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_type' => file_get_contents( __PUBLIC__.'/src/static/menu-side/users.svg' ), 'icon_group' => file_get_contents( __PUBLIC__.'/src/static/container/group.svg' ), ]); return Viewer::replaceSingle(self::template(), [ 'clusterlist' => $view_cluster ]); } } ?>