--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<%@page import="com.sun.org.apache.xalan.internal.xsltc.compiler.sym"%>
+<%
+ /**
+*Copyright © Igor Barma, Alexandre Desoubeaux, Christian Martel, Eric Brun, Mathieu Amblard, Gwenael Gevet, Pierre Guillot, 2012
+ * Copyright Alexandre Desoubeaux, Christian Martel, Cedric Lecarpentier, Alexandre Lefevre, Marc Salvat 2014-2016
+ * Copyright Alexandre Desoubeaux, Christian Martel, Cedric Lecarpentier, Marc Salvat, Marc Suarez, Harifetra Ramamonjy 2017
+*
+*This file is part of the work and learning management system Pentila Nero.
+*
+*Pentila Nero is free software. You can redistribute it and/or modify since
+*you respect the terms of either (at least one of the both license) :
+*- under the terms of the GNU Affero General Public License as
+*published by the Free Software Foundation, either version 3 of the
+*License, or (at your option) any later version.
+*- the CeCILL-C as published by CeCILL-C; either version 1 of the
+*License, or any later version
+*- the GNU Lesser General Public License as published by the
+*Free Software Foundation, either version 3 of the license,
+*or (at your option) any later version.
+*
+*There are special exceptions to the terms and conditions of the
+*licenses as they are applied to this software. View the full text of
+*the exception in file LICENSE-PROJECT.txt in the directory of this software
+*distribution.
+*
+*Pentila Nero is distributed in the hope that it will be useful,
+*but WITHOUT ANY WARRANTY; without even the implied warranty of
+*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+*Licenses for more details.
+*
+*You should have received a copy of the GNU Affero General Public License
+*and the CeCILL-C and the GNU Lesser General Public License along with
+*Pentila Nero. If not, see :
+*<http://www.gnu.org/licenses/> and
+*<http://www.cecill.info/licences.fr.html>.
+*/
+%>
+<%@page import="com.liferay.portal.kernel.workflow.WorkflowConstants"%>
+<%@page import="java.util.Collections"%>
+<%@page import="java.util.Collection"%>
+<%@page import="com.liferay.portal.kernel.dao.orm.QueryUtil"%>
+<%@page import="com.pentila.entSavoie.comparator.util.UserStatutComparator"%>
+<%@page import="com.liferay.portal.kernel.util.ParamUtil"%>
+<%@page import="com.liferay.portal.model.Organization"%>
+<%@page import="com.liferay.portal.service.OrganizationLocalServiceUtil"%>
+<%@page import="com.liferay.portal.service.ExtUserLocalServiceUtil"%>
+<%@ page import="com.liferay.portal.kernel.servlet.HttpHeaders" %>
+<%@page import="com.liferay.portal.model.Role"%>
+<%@page import="com.liferay.portal.service.RoleLocalServiceUtil"%>
+<%@page import="com.liferay.portal.util.comparator.UserLastNameComparator"%>
+<%@page import="java.util.ArrayList"%>
+<%@page import="com.liferay.portal.model.User"%>
+<%@page import="java.util.List"%>
+<%@ include file="/init.jsp" %>
+
+<%
+ //Recupère l'ensemble des listes de l'utilisateur
+ final long idAtelier = ParamUtil.getLong(renderRequest, "idAtelier");
+ final String typeGrp = ParamUtil.getString(renderRequest, "type");
+
+ int start = ParamUtil.getInteger(renderRequest, "start");
+ final int limit = ParamUtil.getInteger(renderRequest, "limit");
+
+ final String dir = ParamUtil.getString(renderRequest, "dir");
+ boolean asc = dir.equals("ASC") || dir.equals("");
+ final String sort = ParamUtil.getString(renderRequest, "sort");
+
+ int stop = start+limit;
+
+ renderResponse.setContentType("text/xml");
+ response.setContentType("text/xml");
+ response.setHeader(HttpHeaders.CACHE_CONTROL, "no-cache");
+
+ OrderByComparator odb = new UserLastNameComparator(asc);
+
+ List<User> users = null;
+ List<Organization> existingOrgs = new ArrayList<Organization>();
+
+ int nbRecords = 0;
+ boolean addUserGrp = true;
+
+ // FIlter
+ final LinkedHashMap<String, Object> userParams = new LinkedHashMap<String, Object>();
+ if (typeGrp.equals("org")) {
+ userParams.put("usersOrgs", idAtelier);
+
+ }
+ else {
+ userParams.put("usersGroups", idAtelier);
+ }
+
+
+ if(sort.equals("statut")){
+ long time = System.nanoTime();
+ //Pour eviter les exceptions (Please make a copy of this read-only list before modifying it.)
+ List<User> lAllUsers2 = users = ExtUserLocalServiceUtil.search(
+ user.getCompanyId(),
+ null,
+ null,
+ null,
+ null,
+ null,
+ WorkflowConstants.STATUS_APPROVED,
+ userParams,
+ true,
+ QueryUtil.ALL_POS,
+ QueryUtil.ALL_POS,
+ (OrderByComparator) null);
+ List<User> lAllUsers = new ArrayList<User>(lAllUsers2);
+ Collections.sort(lAllUsers, new UserStatutComparator(asc));
+ if(stop>lAllUsers.size()){
+ stop = lAllUsers.size();
+ }
+ users = lAllUsers.subList(start, stop);
+ System.out.println((System.nanoTime() - time));
+ } else {
+ users = ExtUserLocalServiceUtil.search(
+ user.getCompanyId(),
+ null,
+ null,
+ null,
+ null,
+ null,
+ WorkflowConstants.STATUS_APPROVED,
+ userParams,
+ true,
+ start,
+ stop,
+ odb);
+ }
+ nbRecords += ExtUserLocalServiceUtil.searchCount(user.getCompanyId(), "", WorkflowConstants.STATUS_APPROVED, userParams);
+%>
+
+
+<%@page import="com.liferay.contacts.util.ProxyFiche"%>
+
+<%@page import="java.util.LinkedHashMap"%>
+<%@page import="com.liferay.portal.kernel.util.OrderByComparator"%>
+<%@page import="com.liferay.portal.service.ExtUserLocalServiceUtil"%>
+<%@page import="com.pentila.entSavoie.ENTDisplayUtil"%><members>
+<total><%= nbRecords %></total>
+<% if (addUserGrp) {
+ for (Organization o : existingOrgs) {
+ %>
+ <member>
+ <id><%= o.getOrganizationId() %></id>
+ <nom><![CDATA[<%= ENTDisplayUtil.formatSCONETName(user, o.getName(), true) %>]]></nom>
+ <statut><![CDATA[<%= messages.getString("groupe") %>]]></statut>
+ </member>
+
+<% }
+ }
+%>
+<% for (User u : users) {
+ ProxyFiche pf = new ProxyFiche(user, u);
+
+ %>
+ <member>
+ <id><%= pf.getId() %></id>
+ <nom><![CDATA[<%= pf.getPrenom() + " " + pf.getNom() %>]]></nom>
+ <statut><%= pf.getStatut() %></statut>
+ </member>
+
+<% } %>
+</members>