--- /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.absences.publipostage.suivipareleve
+
+public enum SuiviEleveColonnesEnum {
+
+ DATE_HEURE(0),
+ NOM(1),
+ CLASSE(2),
+ SUPPORT(3),
+ MODELE(4)
+
+ final Integer id
+
+ private SuiviEleveColonnesEnum(Integer id) {
+ this.id = id
+ }
+
+}
import org.lilie.services.eliot.sms.SmsStatut
import org.lilie.services.eliot.absences.AbsencesFonctionnalite
import org.lilie.services.eliot.CodeComparator
+import org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap
+import org.lilie.services.eliot.export.DonneesPourExportCSV
/**
* Suivi du publipostage
def recherche = {
verifieDroitFonctionnalite(AbsencesFonctionnalite.ABS_PUBLIPOSTAGE)
+ render recherche(params) as JSON
+ }
+
+ def exporteDonnees = {
+
+ verifieDroitFonctionnalite(AbsencesFonctionnalite.ABS_PUBLIPOSTAGE)
+
+ // créer un objet DonneesPourExportCSV
+ DonneesPourExportCSV donneesPourExportCSV = new DonneesPourExportCSV()
+ // parser les paramètres
+ Map mapParams = (Map) JSON.parse(params.params)
+ // recalculer le tableau
+ Map donneesDuTableau = recherche(params)
+ // vérifier les colonnes sélectionnées pour l'affichage
+ List<Integer> colonnesSelectionneesIds = mapParams.colonnes?.toList()
+ boolean colonneDateHeureSelectionnee = colonnesSelectionneesIds ?
+ colonnesSelectionneesIds.contains(SuiviEleveColonnesEnum.DATE_HEURE.id) : true
+ boolean colonneNomSelectionnee = colonnesSelectionneesIds ?
+ colonnesSelectionneesIds.contains(SuiviEleveColonnesEnum.NOM.id) : true
+ boolean colonneClasseSelectionnee = colonnesSelectionneesIds ?
+ colonnesSelectionneesIds.contains(SuiviEleveColonnesEnum.CLASSE.id) : true
+ boolean colonneSupportSelectionnee = colonnesSelectionneesIds ?
+ colonnesSelectionneesIds.contains(SuiviEleveColonnesEnum.SUPPORT.id) : true
+ boolean colonneModeleSelectionnee = colonnesSelectionneesIds ?
+ colonnesSelectionneesIds.contains(SuiviEleveColonnesEnum.MODELE.id) : true
+ // définir les colonnes en créant une liste de String contenant le nom de chaque colonne
+ if (colonneDateHeureSelectionnee){
+ donneesPourExportCSV.colonnes << message(code: 'eliot.notes.libelle.dateHeure', default: 'Date heure')
+ }
+ if (colonneNomSelectionnee){
+ donneesPourExportCSV.colonnes << message(code: 'eliot.notes.libelle.nom', default: 'Nom')
+ }
+ if (colonneClasseSelectionnee){
+ donneesPourExportCSV.colonnes << message(code: 'eliot.notes.libelle.classe', default: 'Classe')
+ }
+ if (colonneSupportSelectionnee){
+ donneesPourExportCSV.colonnes << message(code: 'eliot.notes.libelle.support', default: 'Support')
+ }
+ if (colonneModeleSelectionnee){
+ donneesPourExportCSV.colonnes << message(code: 'eliot.notes.libelle.modele', default: 'Modèle')
+ }
+ // formater les données du tableau tel que pour chaque ligne, on a une liste de valeurs, dans l'ordre des colonnes du tableau
+ donneesDuTableau.data.each{
+ List ligne = []
+ if (colonneDateHeureSelectionnee) ligne.add(it.date)
+ if (colonneNomSelectionnee) ligne.add(it.nom)
+ if (colonneClasseSelectionnee) ligne.add(it.classe)
+ if (colonneSupportSelectionnee) ligne.add(it.type)
+ if (colonneModeleSelectionnee) ligne.add(it.modele)
+ donneesPourExportCSV.lignes << ligne
+ }
+ // réaliser l'export
+ sendCsvFile(response, donneesPourExportCSV, "Suivi par élève")
+
+ }
+
+ private Map recherche(GrailsParameterMap params){
+
int start
Map sortInfo
Map mapParams = (Map) JSON.parse(params.params)
List<PublipostageSuivi> suivis = listeEnvoi.liste
- render construitResult(suivis, listeEnvoi) as JSON
+ return construitResult(suivis, listeEnvoi)
}
/**
--- /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>.
+ --}%
+
+
+<g:javascript>
+
+ <eliotjs:ns name="eliot.absences.publipostage.suivipareleve.ConfigServeur">
+
+ <eliotjs:ns name="url">
+ <eliotjs:varLink name="exporteDonnees" action="exporteDonnees" controller="suiviEleve"/>
+ </eliotjs:ns>
+
+ </eliotjs:ns>
+
+ // Variables communes à l'export des données
+ <eliotjs:ns name="eliot.exportdonnees.BoutonExportViewModele">
+
+ <eliotjs:ns name="libelle">
+ <eliotjs:varI18n name="exporter" code="export.libelle.exporter"/>
+ </eliotjs:ns>
+ <eliotjs:ns name="icon">
+ <eliotjs:varResource name="exporter" dir="images" file="generer.png"/>
+ </eliotjs:ns>
+
+ </eliotjs:ns>
+
+</g:javascript>
<g:render template="/loadingMask"></g:render>
<link rel="stylesheet"
- type="text/css"
- href="${resource(
- dir: 'js/lib/extensionsextjs/lovcombo',
- file: 'Ext.ux.form.LovCombo.css'
- )}"/>
+ type="text/css"
+ href="${resource(
+ dir: 'js/lib/extensionsextjs/lovcombo',
+ file: 'Ext.ux.form.LovCombo.css'
+ )}"/>
<link rel="stylesheet"
- type="text/css"
- href="${resource(
- dir: 'css/publipostage',
- file: 'GridWithCheckBox.css'
- )}"/>
+ type="text/css"
+ href="${resource(
+ dir: 'css/publipostage',
+ file: 'GridWithCheckBox.css'
+ )}"/>
+
+ <script type="text/javascript"
+ src="${url(uri: 'js/commons/src/exportdonnees/BoutonExportView.js')}">
+ </script>
+
+ <script type="text/javascript"
+ src="${url(uri: 'js/commons/src/exportdonnees/BoutonExportController.js')}">
+ </script>
<g:javascript library="src/views/publipostage/suivipareleve/Constantes"/>
<g:javascript library="src/views/publipostage/suivipareleve/ConfigServeur"/>
<eliotjs:ns name="data">
<eliotjs:varJson name="classes" value="${classes}"/>
<eliotjs:varJson name="modeles" value="${modeles}"/>
- <eliotjs:varJson name="smsModeles" value="${modelesSms}"/>
- <eliotjs:varJson name="statuts" value="${statuts}"/>
+ <eliotjs:varJson name="smsModeles" value="${modelesSms}"/>
+ <eliotjs:varJson name="statuts" value="${statuts}"/>
<eliotjs:varJson name="anneeScolaire" value="${anneeScolaire}"/>
<eliotjs:varNumeric name="nbLigneParPage" value="${ConfigurationHolder.config.eliot.absences.publipostage.historique.nombreLignesParPage}"/>
</eliotjs:ns>
</eliotjs:ns>
-
+
</g:javascript>
+ <!-- Template pour les définitions des constantes de modèle-->
+ <g:render template="/publipostage/suivipareleve/modele"/>
+
<g:javascript library="src/views/commons/Message"/>
<g:javascript library="src/views/commons/Utils"/>
<g:javascript library="src/views/commons/Constantes"/>
// supprime le loadMask après un temps maximal
eliot.absences.commons.Utils.supprimeLoadMask(
eliot.absences.commons.Constantes.maskTimeOut
- );
+ );
this.ns = eliot.absences.publipostage.suivipareleve;
this.ConfigServeur = this.ns.ConfigServeur;
this.Constantes = this.ns.Constantes;
+ // bouton Exporter
+ var boutonExporterView = new eliot.exportdonnees.BoutonExportView({width:76, style:'paddingLeft:10px;'});
+ var boutonExportController = new eliot.exportdonnees.BoutonExportController({
+ url:this.ConfigServeur.url.exporteDonnees
+ });
+ boutonExportController.observeBoutonExportView(boutonExporterView);
+ boutonExporterView.observeBoutonExportController(boutonExportController);
+
/************************************* IMPRESSION ***********************************/
var historiqueController = new this.ns.HistoriqueController();
var historiqueView = new this.ns.HistoriqueView({
rechercheStore: historiqueController.rechercheStore,
classesStore: historiqueController.classesStore,
- modelesStore: historiqueController.modelesStore
+ modelesStore: historiqueController.modelesStore,
+ boutonExporterView: boutonExporterView
});
historiqueController.bindView(historiqueView);
/*************************************************************************************/
+ // export
+ boutonExportController.setColonnesVisiblesFonction(
+ historiqueView.getViewColonnesVisbles.createDelegate(historiqueView)
+ );
+ boutonExportController.observeComposantActiveExport(historiqueController);
+ boutonExportController.observeComposantDesactiveExport(historiqueController);
+
/************************************** SMS ******************************************/
'idNorthPanel',
'idCenterPanel',
centerRegionItems
- );
+ );
// Supprime la progresse barre
eliot.absences.commons.Utils.supprimeLoadMask(250);
},
url:{
- recherche: undefined
+ recherche: undefined,
+ exporteDonnees: undefined
},
libelle: {
modelesStore: undefined
});
+ this.BoutonExportEventsId = eliot.exportdonnees.BoutonExportControllerConstantes.eventId;
+
+ this.addEvents(
+ this.BoutonExportEventsId.donneesPretesAExporter,
+ this.BoutonExportEventsId.aucuneDonneesAExporter
+ );
+
this.initRechercheStore();
this.initClassesStore();
this.initModelesStore();
*/
bindView: function(view) {
view.addListener(
- this.Constantes.eventId.rechercher,
- function(params) {
- this.actionRecherche(params);
- },
- this);
+ this.Constantes.eventId.rechercher,
+ function(params) {
+ this.actionRecherche(params);
+ },
+ this);
view.addListener(
- this.Constantes.eventId.actionPaginer,
- function(pageData) {
- this.params.start = pageData.start;
- this.rechercheStore.setBaseParam(
- 'params',
- Ext.encode(this.params)
- );
- },
- this);
+ this.Constantes.eventId.actionPaginer,
+ function(pageData) {
+ this.params.start = pageData.start;
+ this.rechercheStore.setBaseParam(
+ 'params',
+ Ext.encode(this.params)
+ );
+ },
+ this);
view.addListener(
- this.Constantes.eventId.actionClassementChange,
- this.executeClassementChange,
- this
- );
+ this.Constantes.eventId.actionClassementChange,
+ this.executeClassementChange,
+ this
+ );
},
/**
data: reponse.data,
nbData : reponse.nbData
});
+ if (this.rechercheStore.getTotalCount() > 0) {
+ this.fireEvent(
+ this.BoutonExportEventsId.donneesPretesAExporter,
+ this.params
+ );
+ } else {
+ this.fireEvent(
+ this.BoutonExportEventsId.aucuneDonneesAExporter
+ );
+ }
},
failure: function(reponse) {
config:{
rechercheStore:undefined,
classesStore:undefined,
- modelesStore:undefined
+ modelesStore:undefined,
+ boutonExporterView: undefined
},
filtreItems:[],
items:[],
this.modelesComboBox.selectAll();
this.rechercheButton = new Ext.Button({
- width:90,
+ width:76,
text:this.ConfigServeur.libelle.chercher,
icon:this.ConfigServeur.icon.chercher,
handler:function () {
labelAlign:'right',
items:this.dateFinComboBox
},
- this.rechercheButton
+ this.rechercheButton,
+ this.config.boutonExporterView.bouton
]
},
{
var cm = new Ext.grid.ColumnModel({
columns:[
+ //!! si changement ordre colonne, penser à mettre à jour les ids de SuiviEleveColonnesEnum
{
xtype:'datecolumn',
header:this.ConfigServeur.libelle.date,
scope:this
}
});
+ },
+
+ getViewColonnesVisbles:function () {
+ var columnModel = this.rechercheGrid.getColumnModel();
+ var colonnes = [];
+
+ Ext.each(columnModel.columns, function (colonne) {
+ if (colonne.hidden != true) {
+ colonnes.push(columnModel.getIndexById(colonne.id));
+ }
+ });
+
+ return colonnes;
}
})