public static final String APPELS_OUBLIES = '8'
public static final String TABLEAU_DE_BORD = '9'
public static final String STAT_MENSUELLE = '10'
+ public static final String SAISIE_SANCTION = '11'
+ public static final String SAISIE_PUNITION = '12'
}
STATS_MENSUELLE_COL, STATS_MENSUELLE_COL, STATS_MENSUELLE_COL, STATS_MENSUELLE_COL, STATS_MENSUELLE_COL,
STATS_MENSUELLE_COL, STATS_MENSUELLE_COL, STATS_MENSUELLE_COL]
+ public static final List<Integer> LARGEURS_SAISIE_PUNITION = [47, 120, 50, 100, 90, 75]
+ public static final List<Integer> LARGEURS_SAISIE_SANCTION = [47, 120, 50, 100, 90, 75]
+
public static List<Integer> findAllLargeurColonnes(String typeDonnees) {
resultat = ImpressionLargeursColonnesConstantes.LARGEURS_STAT_MENSUELLE
break
+ case TypeDonneesExport.SAISIE_PUNITION:
+ resultat = ImpressionLargeursColonnesConstantes.LARGEURS_SAISIE_PUNITION
+ break
+
+ case TypeDonneesExport.SAISIE_SANCTION:
+ resultat = ImpressionLargeursColonnesConstantes.LARGEURS_SAISIE_SANCTION
+ break
+
default:
throw new IllegalStateException("Tentative d'imprimer un modèle inconnu : ${typeDonnees}")
import org.lilie.services.eliot.temps.DateUtil
import org.lilie.services.eliot.constantes.ConstDate
+import grails.converters.JSON
/**
* Représente les données necessaire à la présentation des données d'un fichiers csv au moment de l'impression
// Liste des nom de colonne du fichier csv
List<String> colonnes = []
+ public void parseCriteresDates(Map jsonParams) {
+
+ if (jsonParams.criteres) {
+
+ Map dates = (Map) JSON.parse(jsonParams.criteres)
+
+ debut = dates.dateDebut
+ fin = dates.dateFin
+
+ } else {
+
+ debut = jsonParams.dateDebut
+ fin = jsonParams.dateFin
+
+ }
+ }
+
public void parseDates(Map jsonParams) {
debut = DateUtil.parseDateJavascript(jsonParams.dateDebut).format(ConstDate.DATE_JJMMAAA)
fin = DateUtil.parseDateJavascript(jsonParams.dateFin).format(ConstDate.DATE_JJMMAAA)
--- /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.saisie.discipline
+
+import org.lilie.services.eliot.absences.AbsencesFonctionnalite
+import org.lilie.services.eliot.absences.AbstractAbsencesController
+import org.lilie.services.eliot.absences.ImpressionHelper
+import org.lilie.services.eliot.absences.impression.moteur.ImpressionCsvAbsencesService
+
+/**
+ *
+ * @author othe
+ */
+class ImpressionDisciplineController extends AbstractAbsencesController {
+
+ ImpressionCsvAbsencesService impressionCsvAbsencesService
+
+ def impressionPunitions = {
+
+ verifieDroitFonctionnalite(AbsencesFonctionnalite.ABS_SAISIE_INC_PUN_SAN)
+
+ ByteArrayOutputStream pdf = impressionCsvAbsencesService.impressionPunitions(getSecuriteSession(),
+ params,
+ etablissementCourant())
+
+ Map mapParams = ImpressionHelper.parseParamImpression(params)
+
+ String fileName = mapParams.titre ?: 'punitions'
+
+ sendFile(
+ response,
+ pdf,
+ fileName,
+ ".pdf",
+ "application/pdf"
+ )
+
+ }
+
+ def impressionSanctions = {
+
+ verifieDroitFonctionnalite(AbsencesFonctionnalite.ABS_SAISIE_INC_PUN_SAN)
+
+ ByteArrayOutputStream pdf = impressionCsvAbsencesService.impressionSanctions(getSecuriteSession(),
+ params,
+ etablissementCourant())
+
+ Map mapParams = ImpressionHelper.parseParamImpression(params)
+
+ String fileName = mapParams.titre ?: 'sanctions'
+
+ sendFile(
+ response,
+ pdf,
+ fileName,
+ ".pdf",
+ "application/pdf"
+ )
+
+ }
+
+
+}
addFilterData(modele)
+ // modèle d'impression
+ modele.impressionInfo = getImpressionInfo(
+ 'impressionPunitions',
+ 'eliot.impression.resultats.punition'
+ )
+
render(
view: '/saisie/punition/consultation/index',
model: modele
)
}
+ private Map getImpressionInfo(String action, String titreI18N) {
+ return [
+ action: action,
+ controller: 'impressionDiscipline',
+ titreDocument: message(code: titreI18N)
+ ]
+ }
+
private void addFilterData(Map modele) {
PreferencesEtablissementAbsences preferences =
getPreferencesEtablissementCourant()
addFilterData(modele)
+ // modèle d'impression
+ modele.impressionInfo = getImpressionInfo(
+ 'impressionSanctions',
+ 'eliot.impression.resultats.sanction'
+ )
+
render(
view: '/saisie/sanction/consultation/index',
model: modele
)
}
+ private Map getImpressionInfo(String action, String titreI18N) {
+ return [
+ action: action,
+ controller: 'impressionDiscipline',
+ titreDocument: message(code: titreI18N)
+ ]
+ }
+
private void addFilterData(Map modele) {
PreferencesEtablissementAbsences preferences =
getPreferencesEtablissementCourant()
breadCrumbsInfo << new BreadCrumbsItemInfo(
codeLabel: 'absences.breadCrumbs.saisie.sanctions',
action: ConstController.ACTION_NAME_INDEX,
- url: createLink(action: ConstController.ACTION_NAME_INDEX,controller: "saisieSanction")
+ url: createLink(action: ConstController.ACTION_NAME_INDEX, controller: "saisieSanction")
)
breadCrumbsInfo << new BreadCrumbsItemInfo(
codeLabel: 'absences.breadCrumbs.saisie.modifier'
* <http://www.cecill.info/licences.fr.html>.
*/
-
-
-
-
-
-
package org.lilie.services.eliot.absences.saisie.discipline.sanction
/**
eliot.impression.resultats.internat=Absences à l'internat
eliot.impression.resultats.appelsOublies=Appels oubliés
eliot.impression.resultats.tableauDeBord=Tableau de bord
+eliot.impression.resultats.punition=Punitions
+eliot.impression.resultats.sanction=Sanctions
eliot.impression.resultats.statistiquesMensuelles=Statistiques mensuelles
absences.libelle.ordre=Ordre
import org.lilie.services.eliot.scolarite.personne.LocalPersonneService
import org.lilie.services.eliot.absences.PreferencesEtablissementAbsences
import org.lilie.services.eliot.absences.export.ExportParserService
+import grails.converters.JSON
+import org.lilie.services.eliot.scolarite.Personne
+import org.lilie.services.eliot.absences.TypePunition
+import org.lilie.services.eliot.absences.saisie.discipline.punition.AbsencesPunitionService
+import org.lilie.services.eliot.absences.saisie.discipline.sanction.AbsencesSanctionService
+import org.lilie.services.eliot.absences.TypeSanction
/**
* Impression des résultats
LocalStructureEnseignementService localStructureEnseignementService
LocalPersonneService localPersonneService
ExportParserService exportParserService
+ AbsencesPunitionService absencesPunitionService
+ AbsencesSanctionService absencesSanctionService
private static final String ID_TOUS = '-1'
+ public ByteArrayOutputStream impressionSanctions(SecuriteSession securiteSession, Map params, Etablissement etablissement) {
+
+ Map criteres = parseCriteresSanctions(params.params)
+
+ Map sanctionData = absencesSanctionService.findAllSanctionParPersonne(
+ securiteSession,
+ etablissement,
+ securiteSession.personne,
+ 'date',
+ false,
+ null,
+ null,
+ criteres
+ )
+
+ List colonnes = JSON.parse(params.params).colonnes
+
+ DonneesPourExportCSV donneesPourExportCSV =
+ absencesPreparationExportCSVService.prepareSanctions(sanctionData, colonnes)
+
+ return imprimePdf(params, etablissement, donneesPourExportCSV, colonnes, TypeDonneesExport.SAISIE_SANCTION)
+
+ }
+
+
+ public ByteArrayOutputStream impressionPunitions(SecuriteSession securiteSession, Map params, Etablissement etablissement) {
+
+ Map criteres = parseCriteresPunitions(params.params)
+
+ Map punitionData = absencesPunitionService.findPunitions(
+ securiteSession,
+ securiteSession.personne,
+ etablissement,
+ 'date',
+ false,
+ null,
+ null,
+ criteres
+ )
+
+ List colonnes = JSON.parse(params.params).colonnes
+
+ DonneesPourExportCSV donneesPourExportCSV =
+ absencesPreparationExportCSVService.preparePunitions(punitionData, colonnes)
+
+ return imprimePdf(params, etablissement, donneesPourExportCSV, colonnes, TypeDonneesExport.SAISIE_PUNITION)
+ }
+
+
public ByteArrayOutputStream imprimeTempsReel(SecuriteSession securiteSession,
Map params,
Etablissement etablissement,
return datasTempsReel
}
+ private Map parseCriteresSanctions(def jsonCriteres) {
+
+ Map result = [:]
+ if (jsonCriteres != null) {
+ Map criteres = (Map) JSON.parse(jsonCriteres)
+
+ if (criteres.dateDebut != null) {
+ result.dateDebut = parseDate(criteres.dateDebut)
+ }
+
+ if (criteres.dateFin != null) {
+ result.dateFin = parseDate(criteres.dateFin)
+ }
+
+ if (criteres.classes != null) {
+ result.classes = StructureEnseignement.getAll(criteres.classes)
+ }
+
+ if (criteres.eleves != null) {
+ result.eleves = Personne.getAll(criteres.eleves)
+ }
+
+ if (criteres.responsables != null) {
+ result.responsables = Personne.getAll(criteres.responsables)
+ }
+
+ if (criteres.types != null) {
+ result.typesSanction = TypeSanction.getAll(criteres.types)
+ }
+
+ if ((criteres.statuts) && (criteres.statuts.size() == 1)) {
+ result.effectue = criteres.statuts[0] == "1"
+ }
+
+ }
+
+ return result
+ }
+
+
+ private Map parseCriteresPunitions(def jsonCriteres) {
+
+ Map result = [:]
+ if (jsonCriteres != null) {
+ Map criteres = (Map) JSON.parse(jsonCriteres)
+
+ if (criteres.dateDebut != null) {
+ result.dateDebut = parseDate(criteres.dateDebut)
+ }
+
+ if (criteres.dateFin != null) {
+ result.dateFin = parseDate(criteres.dateFin)
+ }
+
+ if (criteres.classes != null) {
+ result.classes = StructureEnseignement.getAll(criteres.classes)
+ }
+
+ if (criteres.eleves != null) {
+ result.eleves = Personne.getAll(criteres.eleves)
+ }
+
+ if (criteres.responsables != null) {
+ result.responsables = Personne.getAll(criteres.responsables)
+ }
+
+ if (criteres.types != null) {
+ result.typesPunition = TypePunition.getAll(criteres.types)
+ }
+
+ if ((criteres.statuts) && (criteres.statuts.size() == 1)) {
+ result.effectue = criteres.statuts[0] == "1"
+ }
+
+ }
+
+ return result
+ }
+
+
+ private Date parseDate(String date) {
+ SimpleDateFormat formatDate = new SimpleDateFormat(ConstDate.DATE_JJMMAAA, Locale.FRANCE)
+ return formatDate.parse(date)
+ }
+
+ private ByteArrayOutputStream imprimePdf(Map params,
+ Etablissement etablissement,
+ DonneesPourExportCSV donneesPourExportCSV,
+ List colonnes,
+ String typeDonnees) {
+
+ Map paramsImpression = (Map) JSON.parse(params.params)
+
+ donneesPourExportCSV.colonnes =
+ donneesPourExportCSV.colonnes.collect {message(it)}
+
+ List listeLargeursColonnes = ImpressionLargeursColonnesConstantes.findAllLargeurColonnes(typeDonnees)
+
+ ImpressionPresentationCsv impressionPresentationCsv = new ImpressionPresentationCsv(
+ titre: paramsImpression.titre,
+ etablissement: etablissement.nomAffichage,
+ largeurs: listeLargeursColonnes,
+ colonnes: donneesPourExportCSV.colonnes,
+ colonnesvisibles: colonnes
+ )
+
+ impressionPresentationCsv.parseCriteresDates(paramsImpression)
+
+ return impressionCsvService.printPdf(impressionPresentationCsv, donneesPourExportCSV)
+ }
+
private String message(String code, Object[] args = [], Locale locale = null) {
def ctx = ApplicationHolder.getApplication().getMainContext()
MessageSource messageSource = (MessageSource) ctx.getBean("messageSource")
<g:render template="/loadingMask"></g:render>
<script type="text/javascript"
- src="${url(uri: 'js/commons/src/exportdonnees/BoutonExportView.js')}">
+ src="${url(uri: 'js/commons/src/exportdonnees/BoutonExportView.js')}">
</script>
<script type="text/javascript"
- src="${url(uri: 'js/commons/src/exportdonnees/BoutonExportController.js')}">
+ src="${url(uri: 'js/commons/src/exportdonnees/BoutonExportController.js')}">
</script>
%{--Constantes javaScript--}%
<g:javascript library="src/views/commons/CUDToolbarView"/>
<g:javascript library="src/views/commons/GridConsultationView"/>
- <g:render template="/commons/ficheeleve/ficheEleve" plugin="eliot-app-plugin"/>
+ <g:render template="/commons/ficheeleve/ficheEleve"
+ plugin="eliot-app-plugin"/>
+
+ <g:render template="/commons/impressionresultats/impressionResultats"
+ plugin="eliot-app-plugin"/>
<!-- Template pour les définitions des constantes de modèle-->
<g:render template="/saisie/punition/consultation/modele"/>
<g:render template="/saisie/commons/filter/composant"/>
<g:javascript library="src/views/commons/Message"/>
- <g:javascript library="src/views/saisie/punition/consultation/PunitionController"/>
+ <g:javascript
+ library="src/views/saisie/punition/consultation/PunitionController"/>
<g:javascript library="src/views/saisie/punition/consultation/Application"/>
</head>
+
<body>
<div id="messages" class="portal-messages"/>
%{--Div de la barre de progression--}%
<g:render template="/loadingMask"></g:render>
-
+
<script type="text/javascript"
- src="${url(uri: 'js/commons/src/exportdonnees/BoutonExportView.js')}">
+ src="${url(uri: 'js/commons/src/exportdonnees/BoutonExportView.js')}">
</script>
<script type="text/javascript"
- src="${url(uri: 'js/commons/src/exportdonnees/BoutonExportController.js')}">
+ src="${url(uri: 'js/commons/src/exportdonnees/BoutonExportController.js')}">
</script>
%{--Constantes javaScript--}%
<g:javascript library="src/views/commons/CUDToolbarView"/>
<g:javascript library="src/views/commons/GridConsultationView"/>
- <g:render template="/commons/ficheeleve/ficheEleve" plugin="eliot-app-plugin"/>
+ <g:render template="/commons/ficheeleve/ficheEleve"
+ plugin="eliot-app-plugin"/>
+
+ <g:render template="/commons/impressionresultats/impressionResultats"
+ plugin="eliot-app-plugin"/>
%{--<!-- Template pour les définitions des constantes de modèle-->--}%
<g:render template="/saisie/sanction/consultation/modele"/>
<g:render template="/saisie/commons/filter/composant"/>
<g:javascript library="src/views/commons/Message"/>
- <g:javascript library="src/views/saisie/sanction/consultation/SanctionController"/>
+ <g:javascript
+ library="src/views/saisie/sanction/consultation/SanctionController"/>
<g:javascript library="src/views/saisie/sanction/consultation/Application"/>
</head>
+
<body>
%{-- Message --}%
<div id="messages" class="portal-messages"/>
this.gridConsultation.getView().scroller.dom.scrollLeft = scrollLeft;
}
-
-
});
Ext.ns('eliot.absences.saisie.punitions');
-eliot.absences.saisie.punitions.Application = function() {
+eliot.absences.saisie.punitions.Application = function () {
var Clazz = Ext.extend(Ext.util.Observable, {
- constructor: function() {
+ constructor:function () {
// supprime le loadMask après un temps maximal
eliot.absences.commons.Utils.supprimeLoadMask(
eliot.absences.commons.Constantes.maskTimeOut
- );
+ );
this.NameSpace = eliot.absences.saisie.punitions;
this.Constantes = this.NameSpace.Constantes;
/****************************** Bouton exporter **********************************/
var boutonExporterView = new eliot.exportdonnees.BoutonExportView({});
var boutonExportController = new eliot.exportdonnees.BoutonExportController({
- url : this.NameSpace.Modele.url.exportePunitions
+ url:this.NameSpace.Modele.url.exportePunitions
});
boutonExportController.observeBoutonExportView(boutonExporterView);
boutonExporterView.observeBoutonExportController(boutonExportController);
+
+ var filter = this.creeFilter();
+
+ // Création du controller principal de la vue
+ var punitionController = new this.NameSpace.PunitionController(filter);
+
+
// ToolBar qui contient les 3 boutons suivants:
// - Créer un nouvelle punition
// - Modifier la punition
// -Supprimer la punition
var cudToolbarView = new eliot.absences.commons.CUDToolbarView({
- activeCUD : this.NameSpace.Modele.data.activeCUD,
- boutonsAAJouter : new Array(boutonExporterView.bouton)
+ activeCUD:this.NameSpace.Modele.data.activeCUD,
+ boutonsAAJouter:new Array(boutonExporterView.bouton)
});
- var filter = this.creeFilter();
-
- // Création du controller principal de la vue
- var punitionController = new this.NameSpace.PunitionController(filter);
-
// Création de la grille qui contient la toolBar de CUD
var punitionView = new eliot.absences.commons.GridConsultationView({
- store : punitionController.store,
- toolBar :cudToolbarView.cudToolbar,
- columns : punitionController.getColonnesGrilleConsultationPunitions(),
- nombreLignesParPage : this.NameSpace.Modele.data.nombreLignesParPage
+ store:punitionController.store,
+ toolBar:cudToolbarView.cudToolbar,
+ columns:punitionController.getColonnesGrilleConsultationPunitions(),
+ nombreLignesParPage:this.NameSpace.Modele.data.nombreLignesParPage
+ });
+
+ /************************ Bouton Impression **************************/
+ var boutonImprimer = eliot.impression.resultats.Application.getBoutonImpression({
+ composantModifieEtatBouton:punitionController,
+ callbackGetParametres1:punitionController.getParametresRecherche.createDelegate(punitionController),
+ callbackGetParametres2:punitionView.getParamsViewColonnesVisbles.createDelegate(punitionView)
});
+ cudToolbarView.cudToolbar.add(boutonImprimer);
boutonExportController.setColonnesVisiblesFonction(
punitionView.getViewColonnesVisbles.createDelegate(punitionView)
var centerRegionItems = [
{
- layout : 'border',
- frame : false,
- border : false,
- items : [
+ layout:'border',
+ frame:false,
+ border:false,
+ items:[
{
- region : 'north',
- autoHeight : true,
- border: false,
- frame : false,
- items : filter.getItems()
+ region:'north',
+ autoHeight:true,
+ border:false,
+ frame:false,
+ items:filter.getItems()
},
{
- region : 'center',
- id: this.NameSpace.Constantes.regionId.center,
+ region:'center',
+ id:this.NameSpace.Constantes.regionId.center,
xtype:'panel',
- layout : 'fit',
- border: false,
- autoScroll: true,
- autoShow : true,
- items: punitionView.gridConsultation
+ layout:'fit',
+ border:false,
+ autoScroll:true,
+ autoShow:true,
+ items:punitionView.gridConsultation
}
]
}
// Rendu du viewport
Ext.onReady(
- function() {
+ function () {
eliot.layout.doLayout(
this.NameSpace.Constantes.regionId.viewPort,
this.NameSpace.Constantes.regionId.northPanel,
this.NameSpace.Constantes.regionId.centerPanel,
centerRegionItems
- );
+ );
},
this);
eliot.absences.commons.Utils.supprimeLoadMask(250);
},
- creeFilter: function() {
+ creeFilter:function () {
var filter =
new eliot.absences.saisie.commons.filter.Composant({
- container: this.Constantes.regionId.centerPanel,
+ container:this.Constantes.regionId.centerPanel,
- plusDeCriteres: {
- nbColumn: 3,
- fields: [
+ plusDeCriteres:{
+ nbColumn:3,
+ fields:[
'Classe', 'Eleve', '',
'Responsable', 'Type', 'Statut'
]
Ext.ns('eliot.absences.saisie.punitions');
eliot.absences.saisie.punitions.PunitionController = Ext.extend(Ext.util.Observable, {
- constructor: function(filter) {
+ constructor:function (filter) {
this.Constantes = eliot.absences.saisie.punitions.Constantes;
this.Modele = eliot.absences.saisie.punitions.Modele;
var toolBarEventsId = eliot.absences.commons.
this.idPunitionSelectionne = undefined;
this.addEvents(
- /**
- * @event changeEtatBtnModifier déclenché afin de changer
- * l'état de bouton modifier
- * @params active flag qui indique si le bouton doit être activé
- */
+ /**
+ * @event changeEtatBtnModifier déclenché afin de changer
+ * l'état de bouton modifier
+ * @params active flag qui indique si le bouton doit être activé
+ */
toolBarEventsId.changeEtatBtnModifier,
- /**
- * @event changeEtatBtnSupprimer déclenché afin de changer
- * l'état de bouton supprimer
- * @params active flag qui indique si le bouton doit être activé
- */
+ /**
+ * @event changeEtatBtnSupprimer déclenché afin de changer
+ * l'état de bouton supprimer
+ * @params active flag qui indique si le bouton doit être activé
+ */
toolBarEventsId.changeEtatBtnSupprimer,
- /**
- * @event donneesPretesAExporter déclanché afin de changer l'état de bouton exporter
- */
+ /**
+ * @event donneesPretesAExporter déclanché afin de changer l'état de bouton exporter
+ */
this.BoutonExportEventsId.donneesPretesAExporter,
- /**
- * @event donneesPretesAExporter déclanché afin de changer l'état de bouton exporter
- */
- this.BoutonExportEventsId.aucuneDonneesAExporter
- );
+ /**
+ * @event donneesPretesAExporter déclanché afin de changer l'état de bouton exporter
+ */
+ this.BoutonExportEventsId.aucuneDonneesAExporter,
+
+ eliot.impression.resultats.Constantes.eventId.changeEtatBoutonImprimer
+ );
// Paramètre de classement de la consultation
this.sortInfo = {
- field: 'date',
- direction: 'DESC'
+ field:'date',
+ direction:'DESC'
};
// Objet qui contient les de la consultation
this.params = {
- start: 0,
- limit: this.Modele.data.nombreLignesParPage,
- sortInfo: Ext.encode(this.sortInfo),
- criteres: Ext.encode(filter.getCriteres())
+ start:0,
+ limit:this.Modele.data.nombreLignesParPage,
+ sortInfo:Ext.encode(this.sortInfo),
+ criteres:Ext.encode(filter.getCriteres())
};
// Description du store de la consultation des punitions
this.store = new Ext.data.Store({
- url : this.Modele.url.getPunitions,
- autoLoad : true,
- autoDestroy: false,
- autoSave: false,
- baseParams : this.params,
-
- reader: new Ext.data.JsonReader({
- fields: [
+ url:this.Modele.url.getPunitions,
+ autoLoad:true,
+ autoDestroy:false,
+ autoSave:false,
+ baseParams:this.params,
+
+ reader:new Ext.data.JsonReader({
+ fields:[
{
name:'id'
},
{
- name: this.Modele.dataIndex.date,
+ name:this.Modele.dataIndex.date,
type:'date',
- convert: function(value) {
+ convert:function (value) {
return Date.parseDate(value, "d/m/Y");
}
},
{
- name: this.Modele.dataIndex.eleveId
+ name:this.Modele.dataIndex.eleveId
},
{
- name: this.Modele.dataIndex.nomAffichage
+ name:this.Modele.dataIndex.nomAffichage
},
{
- name: this.Modele.dataIndex.classe
+ name:this.Modele.dataIndex.classe
},
{
- name: this.Modele.dataIndex.type
+ name:this.Modele.dataIndex.type
},
{
- name: this.Modele.dataIndex.censeur
+ name:this.Modele.dataIndex.censeur
},
{
- name: this.Modele.dataIndex.statut
+ name:this.Modele.dataIndex.statut
}
],
root:'data',
totalProperty:'nbData',
- id: 'id'
+ id:'id'
})
});
this.observeFilter(filter);
},
- observeFilter: function(filter) {
+ observeFilter:function (filter) {
this.filter = filter;
filter.addListener(eliot.absences.saisie.commons.filter.Constantes.eventId.cherche,
- function(criteres) {
+ function (criteres) {
this.store.baseParams.criteres = Ext.encode(criteres);
this.store.load();
}, this);
},
- observeStore : function() {
+ observeStore:function () {
this.store.addListener({
- load : {
- fn : function() {
+ load:{
+ fn:function () {
if (this.store.getTotalCount() > 0) {
this.fireEvent(this.BoutonExportEventsId.donneesPretesAExporter, this.filter.getCriteres());
+ this.fireEvent(
+ eliot.impression.resultats.Constantes.eventId.changeEtatBoutonImprimer,
+ false
+ );
} else {
this.fireEvent(this.BoutonExportEventsId.aucuneDonneesAExporter);
+ this.fireEvent(
+ eliot.impression.resultats.Constantes.eventId.changeEtatBoutonImprimer,
+ true
+ );
}
},
- scope : this
+ scope:this
}
})
},
// Observe les actions de la toolbar (Création/Modification/Suppression)
- observeCUDToolBarView : function(CUDToolBarView) {
+ observeCUDToolBarView:function (CUDToolBarView) {
var toolBarEventsId = eliot.absences.commons.CUDToolbarViewConstantes.
eventId;
CUDToolBarView.addListener(
toolBarEventsId.actionCreer,
this.actionCreerPunition,
this
- );
+ );
CUDToolBarView.addListener(
toolBarEventsId.actionModifier,
this.actionModifierPunition,
this
- );
+ );
CUDToolBarView.addListener(
toolBarEventsId.actionSupprimer,
this.actionSupprimerPunition,
this
- );
+ );
},
// Observe la grille afin de mettre les variables à jours
- observePunitionView : function(punitionView) {
+ observePunitionView:function (punitionView) {
var grilleConsultationEventId = eliot.absences.commons.
GrilleConsultationViewConstantes.eventId;
grilleConsultationEventId.actionSelection,
this.actionSelectionPunition,
this
- );
+ );
punitionView.addListener(
grilleConsultationEventId.actionDbClick,
this.actionDbClickPunition,
this
- );
+ );
punitionView.addListener(
grilleConsultationEventId.actionClassementChange,
this.executeClassementChange,
this
- );
+ );
},
/**
* les nouvelles infos de classement
* @param newSortInfo
*/
- executeClassementChange : function(newSortInfo) {
+ executeClassementChange:function (newSortInfo) {
this.sortInfo = newSortInfo;
//Important : la modification de la valeur de 'sortInfo' est faite 2 fois
// différement, en pagination le setBaseParam a l'air de ne pas fonctionner
this.store.setBaseParam('sortInfo', Ext.encode(this.sortInfo));
var lastOptions = this.store.lastOptions;
Ext.apply(lastOptions.params, {
- sortInfo: Ext.encode(this.sortInfo)
+ sortInfo:Ext.encode(this.sortInfo)
});
this.store.reload(lastOptions)
* Met à jour les boutons de la toolBar
* @param recordSelectionne le record seléctionné
*/
- actionSelectionPunition : function(recordSelectionne) {
+ actionSelectionPunition:function (recordSelectionne) {
var toolBarEventsId = eliot.absences.commons.CUDToolbarViewConstantes.eventId;
this.idPunitionSelectionne = recordSelectionne.id;
/**
* Appeler lors d'un double-click sur une punition
* Met à jour la punition sélectionné
- * Appelle la page de modification
+ * Appelle la page de modification
* @param recordSelectionne
*/
- actionDbClickPunition : function(recordSelectionne) {
+ actionDbClickPunition:function (recordSelectionne) {
this.idPunitionSelectionne = recordSelectionne.id;
this.actionModifierPunition();
},
/**
* Appeler pour la création d'une nouvelle punition
*/
- actionCreerPunition : function() {
+ actionCreerPunition:function () {
this.getPageCreation();
},
/**
* Appeler pour la modification d'une punition
*/
- actionModifierPunition : function () {
+ actionModifierPunition:function () {
this.getPageModification()
},
/**
* Action de suppression de la punition sélectionné
*/
- actionSupprimerPunition : function() {
+ actionSupprimerPunition:function () {
var recordSelectionne = this.store.getById(this.idPunitionSelectionne);
var date = recordSelectionne.json.date;
var message = this.Modele.message.suppressionConfirmation + ' ' + date + ' ?';
message,
this.executeSupprimerPunition.createDelegate(this),
this.annuleSuppressionPunition.createDelegate(this)
- )
+ )
},
/**
* Exécute la suppression de la punition sélectionné
*/
- executeSupprimerPunition : function() {
+ executeSupprimerPunition:function () {
Ext.Ajax.request({
- scope : this,
- url: this.Modele.url.supprimePunition,
- params : {
- id : this.idPunitionSelectionne
+ scope:this,
+ url:this.Modele.url.supprimePunition,
+ params:{
+ id:this.idPunitionSelectionne
},
- success : function(response, request) {
+ success:function (response, request) {
var resultats = Ext.decode(response.responseText);
if (resultats.success) {
// Affichage du message de réussite
eliot.absences.Message.showConfirmation(
resultats.message
- );
+ );
// Désactive le bouton exporter si aucune punition
this.changeEtatBoutonExport();
}
},
- failure : function(response, request) {
+ failure:function (response, request) {
eliot.absences.Message.showErreur(
this.Modele.message.erreurInconnue
- );
+ );
}
});
},
- changeEtatBoutonExport : function() {
+ changeEtatBoutonExport:function () {
if (this.store.getCount() <= 0) {
this.fireEvent(
this.BoutonExportEventsId.aucuneDonneesAExporter
- );
+ );
}
},
* - Désactivation du bouton modifier
*
*/
- changeEtatToolBarApresSuppression : function() {
+ changeEtatToolBarApresSuppression:function () {
var toolBarEventsId = eliot.absences.commons.CUDToolbarViewConstantes.
eventId;
this.fireEvent(
toolBarEventsId.changeEtatBtnModifier,
false
- );
+ );
this.fireEvent(
toolBarEventsId.changeEtatBtnSupprimer,
false
- )
+ )
},
/**
* Annule la suppression de la punition seléctionnée
*/
- annuleSuppressionPunition : function() {
+ annuleSuppressionPunition:function () {
eliot.absences.Message.resetMessages();
},
/**
* Charge la page de création d'une nouvelle punition
*/
- getPageCreation : function() {
+ getPageCreation:function () {
var href = this.Modele.url.afficheCreation;
eliot.commun.PostHelper.post({
- url: href,
- params: {
- criteres: Ext.encode(this.filter.getCriteres())
+ url:href,
+ params:{
+ criteres:Ext.encode(this.filter.getCriteres())
}
});
},
/**
* Charge la page de modification de la punition seléctionnée
*/
- getPageModification : function() {
+ getPageModification:function () {
var href = this.Modele.url.
afficheModification +
'?id=' + this.idPunitionSelectionne;
eliot.commun.PostHelper.post({
- url: href,
- params: {
- criteres: Ext.encode(this.filter.getCriteres())
+ url:href,
+ params:{
+ criteres:Ext.encode(this.filter.getCriteres())
}
});
},
- rendererNomEleve: function(eleveNom, obj, record) {
+ rendererNomEleve:function (eleveNom, obj, record) {
var eleveId = record.get('eleveId');
return '<a href="#" onclick="eliot.ficheeleve.Application.' +
'afficheFicheEleve(' + eleveId + ',' + true + ');">' + eleveNom + '</a>';
},
- getColonnesGrilleConsultationPunitions : function() {
+ getColonnesGrilleConsultationPunitions:function () {
var columns = [
{
- header: this.Modele.header.date,
- dataIndex: this.Modele.dataIndex.date,
- renderer: Ext.util.Format.dateRenderer('d/m/Y'),
+ header:this.Modele.header.date,
+ dataIndex:this.Modele.dataIndex.date,
+ renderer:Ext.util.Format.dateRenderer('d/m/Y'),
width:100
},
{
- header: this.Modele.header.nomAffichage,
- dataIndex: this.Modele.dataIndex.nomAffichage,
- renderer: this.rendererNomEleve,
+ header:this.Modele.header.nomAffichage,
+ dataIndex:this.Modele.dataIndex.nomAffichage,
+ renderer:this.rendererNomEleve,
width:200
},
{
- header: this.Modele.header.classe,
- dataIndex: this.Modele.dataIndex.classe,
+ header:this.Modele.header.classe,
+ dataIndex:this.Modele.dataIndex.classe,
width:90
},
{
- header: this.Modele.header.type,
- dataIndex: this.Modele.dataIndex.type,
+ header:this.Modele.header.type,
+ dataIndex:this.Modele.dataIndex.type,
width:150
},
{
- header: this.Modele.header.censeur,
- dataIndex: this.Modele.dataIndex.censeur,
+ header:this.Modele.header.censeur,
+ dataIndex:this.Modele.dataIndex.censeur,
width:150
},
{
- header: this.Modele.header.statut,
- dataIndex: this.Modele.dataIndex.statut,
+ header:this.Modele.header.statut,
+ dataIndex:this.Modele.dataIndex.statut,
width:150
}
];
return columns;
+ },
+
+ getParametresRecherche:function () {
+ return this.params;
}
});
sanctionView.getViewColonnesVisbles.createDelegate(sanctionView)
);
+ /************************ Bouton Impression **************************/
+ var boutonImprimer = eliot.impression.resultats.Application.getBoutonImpression({
+ composantModifieEtatBouton:sanctionController,
+ callbackGetParametres1:sanctionController.getParametresRecherche.createDelegate(sanctionController),
+ callbackGetParametres2:sanctionView.getParamsViewColonnesVisbles.createDelegate(sanctionView)
+ });
+ cudToolbarView.cudToolbar.add(boutonImprimer);
+
// On branche l'observation du controller seulement si
// l'utilisateur a le droit aux actions de
// création/modification/suppression des incidents
Ext.ns('eliot.absences.saisie.sanctions');
eliot.absences.saisie.sanctions.SanctionController = Ext.extend(Ext.util.Observable, {
- constructor: function(filter) {
+ constructor:function (filter) {
this.Constantes = eliot.absences.saisie.sanctions.Constantes;
this.Modele = eliot.absences.saisie.sanctions.Modele;
var toolBarEventsId = eliot.absences.commons.CUDToolbarViewConstantes.eventId;
this.idSanctionSelectionne = undefined;
this.addEvents(
- /**
- * @event changeEtatBtnModifier déclenché afin de changer
- * l'état de bouton modifier
- * @params active flag qui indique si le bouton doit être activé
- */
+ /**
+ * @event changeEtatBtnModifier déclenché afin de changer
+ * l'état de bouton modifier
+ * @params active flag qui indique si le bouton doit être activé
+ */
toolBarEventsId.changeEtatBtnModifier,
- /**
- * @event changeEtatBtnSupprimer déclenché afin de changer
- * l'état de bouton supprimer
- * @params active flag qui indique si le bouton doit être activé
- */
+ /**
+ * @event changeEtatBtnSupprimer déclenché afin de changer
+ * l'état de bouton supprimer
+ * @params active flag qui indique si le bouton doit être activé
+ */
toolBarEventsId.changeEtatBtnSupprimer,
- /**
- * @event donneesPretesAExporter déclanché afin de changer l'état de bouton exporter
- */
+ /**
+ * @event donneesPretesAExporter déclanché afin de changer l'état de bouton exporter
+ */
this.BoutonExportEventsId.donneesPretesAExporter,
- /**
- * @event donneesPretesAExporter déclanché afin de changer l'état de bouton exporter
- */
- this.BoutonExportEventsId.aucuneDonneesAExporter
- );
+ /**
+ * @event donneesPretesAExporter déclanché afin de changer l'état de bouton exporter
+ */
+ this.BoutonExportEventsId.aucuneDonneesAExporter,
+
+ eliot.impression.resultats.Constantes.eventId.changeEtatBoutonImprimer
+ );
// Paramètre de classement de la consultation
this.sortInfo = {
- field: 'date',
- direction: 'DESC'
+ field:'date',
+ direction:'DESC'
};
// Objet qui contient les de la consultation
this.params = {
- start: 0,
- limit: this.Modele.data.nombreLignesParPage,
- sortInfo: Ext.encode(this.sortInfo),
- criteres: Ext.encode(filter.getCriteres())
+ start:0,
+ limit:this.Modele.data.nombreLignesParPage,
+ sortInfo:Ext.encode(this.sortInfo),
+ criteres:Ext.encode(filter.getCriteres())
};
// Description du store de la consultation des sanctions
this.store = new Ext.data.Store({
- url : this.Modele.url.getSanctions,
- autoLoad : true,
- autoDestroy: false,
- autoSave: false,
- baseParams : this.params,
-
- reader: new Ext.data.JsonReader({
- fields: [
+ url:this.Modele.url.getSanctions,
+ autoLoad:true,
+ autoDestroy:false,
+ autoSave:false,
+ baseParams:this.params,
+
+ reader:new Ext.data.JsonReader({
+ fields:[
{
name:'id'
},
{
- name: this.Modele.dataIndex.date,
+ name:this.Modele.dataIndex.date,
type:'date',
- convert: function(value) {
+ convert:function (value) {
return Date.parseDate(value, "d/m/Y");
}
},
{
- name: this.Modele.dataIndex.type
+ name:this.Modele.dataIndex.type
},
{
- name: this.Modele.dataIndex.nomAffichage
+ name:this.Modele.dataIndex.nomAffichage
},
{
- name: this.Modele.dataIndex.eleveId
+ name:this.Modele.dataIndex.eleveId
},
{
- name: this.Modele.dataIndex.classe
+ name:this.Modele.dataIndex.classe
},
{
- name: this.Modele.dataIndex.censeur
+ name:this.Modele.dataIndex.censeur
},
{
- name: this.Modele.dataIndex.statut
+ name:this.Modele.dataIndex.statut
},
{
- name : 'absenceLiee'
+ name:'absenceLiee'
}
],
root:'data',
totalProperty:'nbData',
- id: 'id'
+ id:'id'
})
});
this.observeFilter(filter);
},
- observeFilter: function(filter) {
+ observeFilter:function (filter) {
this.filter = filter;
filter.addListener(eliot.absences.saisie.commons.filter.Constantes.eventId.cherche,
- function(criteres) {
+ function (criteres) {
this.store.baseParams.criteres = Ext.encode(criteres);
this.store.load();
}, this);
},
- observeStore : function() {
+ observeStore:function () {
this.store.addListener({
- load : {
- fn : function() {
+ load:{
+ fn:function () {
if (this.store.getTotalCount() > 0) {
this.fireEvent(this.BoutonExportEventsId.donneesPretesAExporter, this.filter.getCriteres());
+ this.fireEvent(
+ eliot.impression.resultats.Constantes.eventId.changeEtatBoutonImprimer,
+ false
+ );
} else {
this.fireEvent(this.BoutonExportEventsId.aucuneDonneesAExporter);
+ this.fireEvent(
+ eliot.impression.resultats.Constantes.eventId.changeEtatBoutonImprimer,
+ true
+ );
}
},
- scope : this
+ scope:this
}
})
},
// Observe les actions de la toolbar (Création/Modification/Suppression)
- observeCUDToolBarView : function(CUDToolBarView) {
+ observeCUDToolBarView:function (CUDToolBarView) {
var toolBarEventsId = eliot.absences.commons.CUDToolbarViewConstantes.
eventId;
CUDToolBarView.addListener(
toolBarEventsId.actionCreer,
this.actionCreerSanction,
this
- );
+ );
CUDToolBarView.addListener(
toolBarEventsId.actionModifier,
this.actionModifierSanction,
this
- );
+ );
CUDToolBarView.addListener(
toolBarEventsId.actionSupprimer,
this.actionSupprimeSanction,
this
- );
+ );
},
// Observe la grille afin de mettre les variables à jours
- observeSanctionView : function(sanctionView) {
+ observeSanctionView:function (sanctionView) {
var grilleConsultationEventId = eliot.absences.commons.
GrilleConsultationViewConstantes.eventId;
grilleConsultationEventId.actionSelection,
this.actionSelectionSanction,
this
- );
+ );
sanctionView.addListener(
grilleConsultationEventId.actionDbClick,
this.actionDbClickSanction,
this
- );
+ );
sanctionView.addListener(
grilleConsultationEventId.actionClassementChange,
this.executeClassementChange,
this
- );
+ );
},
/**
* Effectue un rechargement des données avec les nouvelles infos de classement
* @param newSortInfo
*/
- executeClassementChange : function(newSortInfo) {
+ executeClassementChange:function (newSortInfo) {
this.sortInfo = newSortInfo;
//Important : la modification de la valeur de 'sortInfo' est faite 2 fois
// différement, en pagination le setBaseParam a l'air de ne pas fonctionner
this.store.setBaseParam('sortInfo', Ext.encode(this.sortInfo));
var lastOptions = this.store.lastOptions;
Ext.apply(lastOptions.params, {
- sortInfo: Ext.encode(this.sortInfo)
+ sortInfo:Ext.encode(this.sortInfo)
});
this.store.reload(lastOptions)
* Met à jour les boutons de la toolBar
* @param recordSelectionne le record seléctionné
*/
- actionSelectionSanction : function(recordSelectionne) {
+ actionSelectionSanction:function (recordSelectionne) {
var toolBarEventsId = eliot.absences.commons.CUDToolbarViewConstantes.eventId;
this.idSanctionSelectionne = recordSelectionne.id;
* Appelle la page de modification de la sanction
* @param recordSelectionne
*/
- actionDbClickSanction : function(recordSelectionne) {
+ actionDbClickSanction:function (recordSelectionne) {
this.idSanctionSelectionne = recordSelectionne.id;
this.actionModifierSanction();
},
/**
* Appeler pour la création d'une nouvelle sanction
*/
- actionCreerSanction : function() {
+ actionCreerSanction:function () {
this.getPageCreation();
},
/**
* Appeler pour la modification d'une sanction
*/
- actionModifierSanction : function () {
+ actionModifierSanction:function () {
this.getPageModification()
},
/**
* Action de suppression de la sanction sélectionné
*/
- actionSupprimeSanction : function() {
+ actionSupprimeSanction:function () {
var recordSelectionne = this.store.getById(this.idSanctionSelectionne);
var date = recordSelectionne.json.date;
var message = this.Modele.message.suppressionConfirmation + ' ' + date + ' ?';
message,
this.actionSupprimeSanctionConfirmee.createDelegate(this),
this.annuleSuppressionSanction.createDelegate(this)
- )
+ )
},
- actionSupprimeSanctionConfirmee : function() {
+ actionSupprimeSanctionConfirmee:function () {
var record = this.store.getById(this.idSanctionSelectionne);
if (record.get('absenceLiee')) {
eliot.absences.Message.afficherDialogConfirmation(
this.Modele.message.confirmationSuppressionSanctionReferencee,
this.executeSupprimeSanction.createDelegate(this),
this.annuleSuppressionSanction.createDelegate(this)
- )
+ )
}
else {
this.executeSupprimeSanction();
/**
* Exécute la suppression de la sanction sélectionné
*/
- executeSupprimeSanction : function() {
+ executeSupprimeSanction:function () {
Ext.Ajax.request({
- scope : this,
- url: this.Modele.url.supprimeSanction,
- params : {
- id : this.idSanctionSelectionne
+ scope:this,
+ url:this.Modele.url.supprimeSanction,
+ params:{
+ id:this.idSanctionSelectionne
},
- success : function(response, request) {
+ success:function (response, request) {
var resultats = Ext.decode(response.responseText);
if (resultats.success) {
}
},
- failure : function(response, request) {
+ failure:function (response, request) {
eliot.absences.Message.showErreur(this.Modele.message.erreurInconnue);
}
});
},
- changeEtatBoutonExport : function() {
+ changeEtatBoutonExport:function () {
if (this.store.getCount() <= 0) {
this.fireEvent(
this.BoutonExportEventsId.aucuneDonneesAExporter
- );
+ );
}
},
* - Désactivation du bouton modifier
*
*/
- changeEtatToolBarApresSuppression : function() {
+ changeEtatToolBarApresSuppression:function () {
var toolBarEventsId = eliot.absences.commons.CUDToolbarViewConstantes.
eventId;
this.fireEvent(
toolBarEventsId.changeEtatBtnModifier,
false
- );
+ );
this.fireEvent(
toolBarEventsId.changeEtatBtnSupprimer,
false
- )
+ )
},
/**
* Annule la suppression de la sanction seléctionnée
*/
- annuleSuppressionSanction : function() {
+ annuleSuppressionSanction:function () {
eliot.absences.Message.resetMessages();
},
/**
* Charge la page de création d'une nouvelle sanction
*/
- getPageCreation : function() {
+ getPageCreation:function () {
var href = this.Modele.url.afficheCreation;
eliot.commun.PostHelper.post({
- url: href,
- params: {
- criteres: Ext.encode(this.filter.getCriteres())
+ url:href,
+ params:{
+ criteres:Ext.encode(this.filter.getCriteres())
}
});
},
/**
* Charge la page de modification de la sanction seléctionnée
*/
- getPageModification : function() {
+ getPageModification:function () {
var href = this.Modele.url.afficheModification +
'?id=' + this.idSanctionSelectionne;
eliot.commun.PostHelper.post({
- url: href,
- params: {
- criteres: Ext.encode(this.filter.getCriteres())
+ url:href,
+ params:{
+ criteres:Ext.encode(this.filter.getCriteres())
}
});
},
- rendererNomEleve: function(eleveNom, obj, record) {
+ rendererNomEleve:function (eleveNom, obj, record) {
var eleveId = record.get('eleveId');
return '<a href="#" onclick="eliot.ficheeleve.Application.' +
'afficheFicheEleve(' + eleveId + ',' + true + ');">' + eleveNom + '</a>';
},
- getColonnesGrilleConsultationSanctions : function() {
+ getColonnesGrilleConsultationSanctions:function () {
var columns = [
{
- header: this.Modele.header.date,
- dataIndex: this.Modele.dataIndex.date,
- renderer: Ext.util.Format.dateRenderer('d/m/Y'),
+ header:this.Modele.header.date,
+ dataIndex:this.Modele.dataIndex.date,
+ renderer:Ext.util.Format.dateRenderer('d/m/Y'),
width:100
},
{
- header: this.Modele.header.type,
- dataIndex: this.Modele.dataIndex.type,
+ header:this.Modele.header.type,
+ dataIndex:this.Modele.dataIndex.type,
width:150
},
{
- header: this.Modele.header.nomAffichage,
- dataIndex: this.Modele.dataIndex.nomAffichage,
- renderer: this.rendererNomEleve,
+ header:this.Modele.header.nomAffichage,
+ dataIndex:this.Modele.dataIndex.nomAffichage,
+ renderer:this.rendererNomEleve,
width:200
},
{
- header: this.Modele.header.classe,
- dataIndex: this.Modele.dataIndex.classe,
+ header:this.Modele.header.classe,
+ dataIndex:this.Modele.dataIndex.classe,
width:90
},
{
- header: this.Modele.header.censeur,
- dataIndex: this.Modele.dataIndex.censeur,
+ header:this.Modele.header.censeur,
+ dataIndex:this.Modele.dataIndex.censeur,
width:150
},
{
- header: this.Modele.header.statut,
- dataIndex: this.Modele.dataIndex.statut,
+ header:this.Modele.header.statut,
+ dataIndex:this.Modele.dataIndex.statut,
width:150
}
];
return columns;
+ },
+
+ getParametresRecherche:function () {
+ return this.filter.getCriteres();
}
});