--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie 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
+ *
+ * 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.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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 General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+
+
+package org.lilie.services.eliot.scolarite.publipostage.suivipareleve
+
+import org.lilie.services.eliot.export.DonneesPourExportCSV
+
+class SuiviElevePreparartionExportCSVService {
+
+ static transactional = true
+ /*
+ [ position de la colonne : [code_i18n, propriété dans les données] ]
+
+ */
+ public static final Map SMS = [
+ 0: ['scolarite.suivipareleve.date', 'date'],
+ 1: ['scolarite.suivipareleve.heure', 'heure'],
+ 2: ['scolarite.suivipareleve.nom', 'nom'],
+ 3: ['scolarite.suivipareleve.classe', 'classe'],
+ 4: ['eliot.libelle.responsable', 'responsable'],
+ 5: ['eliot.libelle.portable', 'portable'],
+ 6: ['scolarite.suivipareleve.nomSms', 'modele'],
+ 7: ['eliot.libelle.statut', 'statut']
+ ]
+
+ public static final Map COURIER = [
+ 0: ['scolarite.suivipareleve.date', 'date'],
+ 1: ['scolarite.suivipareleve.heure', 'heure'],
+ 2: ['scolarite.suivipareleve.nom', 'nom'],
+ 3: ['scolarite.suivipareleve.classe', 'classe'],
+ 4: ['scolarite.suivipareleve.support', 'responsable'],
+ 5: ['scolarite.suivipareleve.modele', 'modele']
+ ]
+
+
+ public DonneesPourExportCSV prepareExportSuiviEleve(List data,
+ List<Integer> colonneAInclure,
+ Map mapColonnes) {
+
+ if (!colonneAInclure) {
+ throw new IllegalArgumentException("La liste des colonnes à inclure est obligatoire")
+ }
+
+ if (!mapColonnes) {
+ throw new IllegalArgumentException("La liste des colonnes est obligatoire")
+ }
+
+ if (log.debugEnabled) {
+ log.debug("Liste des colonnes : ${mapColonnes.toMapString()}")
+ log.debug("Colonnes à inclure : ${colonneAInclure.toString()}")
+ }
+
+ DonneesPourExportCSV donnees = new DonneesPourExportCSV()
+
+ List<String> colonnes = colonneAInclure.collectAll {int index ->
+ mapColonnes[index][0]
+ }
+
+ List<List> lignes = []
+
+ data.each {
+ List ligne = colonneAInclure.collectAll {int index ->
+ it[mapColonnes[index][1]]
+ }
+ lignes << ligne
+ }
+
+ donnees.colonnes = colonnes
+ donnees.lignes = lignes
+
+ return donnees
+ }
+
+}