this.addEvents(
/**
- * @event actionExporter declancher sur un click
- * permet de générer l'export des données en court
+ * @event actionExporter declencher sur un click
+ * permet de générer l'export des données en cours
*/
this.Constantes.eventId.actionExporter
);
</eliotjs:ns>
</eliotjs:ns>
- // Variables communs à l'export des données
+ // 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"/>
--- /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.notes.publipostage.suivipareleve
+
+public enum SuiviEleveColonnesEnum {
+
+ DATE_HEURE(0),
+ NOM(1),
+ CLASSE(2),
+ SUPPORT(3),
+ MODELE(4),
+ PERIODE(5)
+
+ final Integer id
+
+ private SuiviEleveColonnesEnum(Integer id) {
+ this.id = id
+ }
+
+}
import org.lilie.services.eliot.impression.TemplateDocument
import org.lilie.services.eliot.urllabel.breadcrumbs.BreadCrumbsItemInfo
import org.lilie.services.eliot.notes.NotesFonctionnalite
+import org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap
+import org.lilie.services.eliot.export.DonneesPourExportCSV
/**
* Suivi du publipostage
Map resultat = tryCatch {
verifieDroitFonctionnalite(NotesFonctionnalite.NOTES_PUBLIPOST)
- Map result = [:]
+ return recherche(params)
+ }
- SimpleDateFormat sdfAffichageDate = new SimpleDateFormat(
- "dd/MM/yyyy HH:mm",
- Locale.FRANCE
- )
+ render resultat as JSON
+ }
- Map mapParams = (Map) JSON.parse(params.params)
+ def exporteDonnees = {
- Date dateDebut = mapParams.dateDebut ? df.parse(mapParams.dateDebut) : null
- Date dateFin = mapParams.dateFin ? df.parse(mapParams.dateFin) : null
+ verifieDroitFonctionnalite(NotesFonctionnalite.NOTES_PUBLIPOST)
+ // 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
+ boolean colonnePeriodeSelectionnee = colonnesSelectionneesIds ?
+ colonnesSelectionneesIds.contains(SuiviEleveColonnesEnum.PERIODE.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')
+ }
+ if (colonnePeriodeSelectionnee){
+ donneesPourExportCSV.colonnes << message(code: 'eliot.notes.libelle.periode', default: 'Période')
+ }
+ // 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)
+ if (colonnePeriodeSelectionnee) ligne.add(it.periode)
+ donneesPourExportCSV.lignes << ligne
+ }
+ // réaliser l'export
+ sendCsvFile(response, donneesPourExportCSV, "Suivi par élève")
- List<Long> classeIds = mapParams.classes*.toLong()
+ }
- List<StructureEnseignement> classes = StructureEnseignement.getAll(classeIds)
+ private Map recherche(GrailsParameterMap params) {
- classes.each {verifieDroitAccesObjetDomaine(it)}
+ Map result = [:]
- //TOREFACT : il faut utiliser les id des TemplateDocument
- List<TemplateDocument> modeles = []
- mapParams.modeles.each {
- modeles << TemplateDocument.findByNomAndEtablissement(it,etablissementCourant())
- }
+ SimpleDateFormat sdfAffichageDate = new SimpleDateFormat(
+ "dd/MM/yyyy HH:mm",
+ Locale.FRANCE
+ )
- dateFin.setTime(dateFin.getTime() + 24 * 3600 * 1000)
+ Map mapParams = (Map) JSON.parse(params.params)
- int start = mapParams.start ?: 0
+ Date dateDebut = mapParams.dateDebut ? df.parse(mapParams.dateDebut) : null
+ Date dateFin = mapParams.dateFin ? df.parse(mapParams.dateFin) : null
- Map listeEnvoi = impressionSuiviEleveService.listeEnvoi(
- etablissementCourant(),
- dateDebut,
- dateFin,
- classes,
- modeles,
- start,
- mapParams.sortInfo
- )
- List<PublipostageSuivi> suivis = listeEnvoi.liste
-
- result.data = suivis.collect {
-
- String type = ''
-
- switch (it.media) {
- case 1:
- type = message(code: 'eliot.notes.media.courrier')
- break;
-
- case 2:
- type = message(code: 'eliot.notes.media.sms')
- break;
-
- case 3:
- type = message(code: 'eliot.notes.media.email')
- break;
- }
-
- [
- id: it.id,
- date: sdfAffichageDate.format(it.dateEnvoi),
- nom: it.personne?.nomAffichage(),
- classe: it.classe?.code,
- type: type,
- modele: it?.templateDocument.nom,
- periode: getNomPeriode(it)
- ]
+ List<Long> classeIds = mapParams.classes*.toLong()
+
+ List<StructureEnseignement> classes = StructureEnseignement.getAll(classeIds)
+
+ classes.each {verifieDroitAccesObjetDomaine(it)}
+
+ //TOREFACT : il faut utiliser les id des TemplateDocument
+ List<TemplateDocument> modeles = []
+ mapParams.modeles.each {
+ modeles << TemplateDocument.findByNomAndEtablissement(it,etablissementCourant())
+ }
+
+ dateFin.setTime(dateFin.getTime() + 24 * 3600 * 1000)
+
+ int start = mapParams.start ?: 0
+
+ Map listeEnvoi = impressionSuiviEleveService.listeEnvoi(
+ etablissementCourant(),
+ dateDebut,
+ dateFin,
+ classes,
+ modeles,
+ start,
+ mapParams.sortInfo
+ )
+ List<PublipostageSuivi> suivis = listeEnvoi.liste
+
+ result.data = suivis.collect {
+
+ String type = ''
+
+ switch (it.media) {
+ case 1:
+ type = message(code: 'eliot.notes.media.courrier')
+ break;
+
+ case 2:
+ type = message(code: 'eliot.notes.media.sms')
+ break;
+
+ case 3:
+ type = message(code: 'eliot.notes.media.email')
+ break;
}
- result.nbData = listeEnvoi.nbData
- return result
+ [
+ id: it.id,
+ date: sdfAffichageDate.format(it.dateEnvoi),
+ nom: it.personne?.nomAffichage(),
+ classe: it.classe?.code,
+ type: type,
+ modele: it?.templateDocument?.nom,
+ periode: getNomPeriode(it)
+ ]
}
- render resultat as JSON
+ result.nbData = listeEnvoi.nbData
+ return result
}
--- /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.notes.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>
<link rel="stylesheet" type="text/css" href="${resource(dir: 'js/lib/extjs/3.2.0/resources/css', file: 'Ext.ux.form.LovCombo.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"/>
</g:javascript>
+ <!-- Template pour les définitions des constantes de modèle-->
+ <g:render template="/publipostage/suivipareleve/modele"/>
+
<g:javascript library="src/views/Messages"/>
<g:javascript library="src/views/commun/Utils"/>
<g:javascript library="src/views/commun/Constantes"/>
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);
+
// historique
this.historiqueController = new this.ns.HistoriqueController();
this.historiqueView = new this.ns.HistoriqueView({
rechercheStore: this.historiqueController.rechercheStore,
classesStore: this.historiqueController.classesStore,
- modelesStore: this.historiqueController.modelesStore
+ modelesStore: this.historiqueController.modelesStore,
+ boutonExporterView:boutonExporterView
});
this.historiqueController.observeHistoriqueView(this.historiqueView);
+ // export
+ boutonExportController.setColonnesVisiblesFonction(
+ this.historiqueView.getViewColonnesVisbles.createDelegate(this.historiqueView)
+ );
+ boutonExportController.observeComposantActiveExport(this.historiqueController);
+ boutonExportController.observeComposantDesactiveExport(this.historiqueController);
+
var centerRegionItems = [
{
id: 'eliot.notes.Constantes.viewport.idMainPane',
'idNorthPanel',
'idCenterPanel',
centerRegionItems
- );
+ );
});
});
- // Construit l'instance singleton
+// Construit l'instance singleton
return new Clazz({
name: 'eliot-notes-publipostage-historique-app'
});
},
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();
*/
observeHistoriqueView: 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) {
this.addEvents(
- /**
- * Rechercher
- * @event rechercher
- * @param params
- */
+ /**
+ * Rechercher
+ * @event rechercher
+ * @param params
+ */
this.Constantes.eventId.rechercher,
- /**
- * @event actionPaginer déclenché quand le bouton 'Prochaine' ou
- * 'Précendent' est cliqué qui se trouve dans le bar de pagination
- * @param pageData qui paramètre 'start' et 'limit'
- */
+ /**
+ * @event actionPaginer déclenché quand le bouton 'Prochaine' ou
+ * 'Précendent' est cliqué qui se trouve dans le bar de pagination
+ * @param pageData qui paramètre 'start' et 'limit'
+ */
this.Constantes.eventId.actionPaginer,
- /**
- * @event actionClassementChange déclenché quand une colonne est classée
- * @param sortInfo qui contient {field + order}
- */
+ /**
+ * @event actionClassementChange déclenché quand une colonne est classée
+ * @param sortInfo qui contient {field + order}
+ */
this.Constantes.eventId.actionClassementChange
- );
+ );
Ext.apply(this, {
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 () {
if (dateFin < dateDebut) {
eliot.notes.Messages.showErreur(
this.ConfigServeur.messages.erreurDesDates
- );
+ );
return
}
var params = {
{
xtype: 'panel',
layout: 'column',
- width: 720,
+ width: 900,
height: 30,
items: [
{
labelAlign : 'right',
items: this.dateFinComboBox
},
- this.rechercheButton
+ this.rechercheButton,
+ this.config.boutonExporterView.bouton
]
},
{
});
var cm = new Ext.grid.ColumnModel({
+ //!! si changement ordre colonne, penser à mettre à jour les ids de SuiviEleveColonnesEnum
columns: [
- {
- header: this.ConfigServeur.libelle.dateHeure,
- dataIndex: 'date',
- width : 100,
- sortable: true
- },
{
header: this.ConfigServeur.libelle.nom,
dataIndex: 'nom',
sortable: true
},
+ {
+ header: this.ConfigServeur.libelle.dateHeure,
+ dataIndex: 'date',
+ width : 100,
+ sortable: true
+ },
{
header: this.ConfigServeur.libelle.classe,
dataIndex: 'classe',
this.lovCombo.store.insert(
0,
new this.lovCombo.store.recordType(
- {
- id: -1,
- libelle : libelleTous
- })
- );
+ {
+ id: -1,
+ libelle : libelleTous
+ })
+ );
}
this.lovCombo.selectAll();
},
this.fireEvent(
this.Constantes.eventId.actionPaginer,
pageData
- );
+ );
},
scope : this
}
this.fireEvent(
this.Constantes.eventId.actionClassementChange,
sortInfo
- );
+ );
}
},
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;
}
});
\ No newline at end of file