* Définit une variable javascript de type numérique en utilisant le namespace courant
* @param name le nom de la variable
* @param value la valeur de la variable
+ * @param nullable paramètre optionnel permettant de ne pas effectuer la vérification
+ * de la nullité de la valeur
* @author jtra
*/
def varNumeric = { attr, body ->
String jsNamespace = request.jsNamespace
String varName = attr.name
String varValue = attr.value
+ Boolean nullable = attr.nullable
+
+ String v = getVarQualifiee(jsNamespace, varName)
+
+ if ((nullable != null) && (nullable == true)) {
+ if (!varValue) {
+ out << "// $v is not defined"
+ return
+ }
+ }
+
checkAttributIsNotEmpty('value', varValue)
// Génère le code résultat
- String v = getVarQualifiee(jsNamespace, varName)
out << "$v = $varValue;"
}
package org.lilie.services.eliot.absences.saisie.discipline.incident
+import groovy.time.TimeCategory
import org.lilie.services.eliot.absences.AbstractAbsencesController
+import org.lilie.services.eliot.absences.TypeSanction
import org.lilie.services.eliot.absences.page.Page
import org.lilie.services.eliot.absences.PreferencesEtablissementAbsences
import grails.converters.JSON
import org.lilie.services.eliot.absences.LieuIncident
import org.lilie.services.eliot.absences.PartenaireAPrevenir
import org.lilie.services.eliot.absences.QualiteProtagoniste
+import org.lilie.services.eliot.scolarite.StructureEnseignement
+import org.lilie.services.eliot.scolarite.structureenseignement.LocalStructureEnseignementService
import org.lilie.services.eliot.securite.impl.Autorite
import org.lilie.services.eliot.absences.saisie.discipline.incident.exceptions.IncidentException
import org.lilie.services.eliot.securite.AutorisationException
AbsencesPreparationExportCSVService absencesPreparationExportCSVService
AffichageIncidentService affichageIncidentService
EnumMarshallerService enumMarshallerService
+ LocalStructureEnseignementService localStructureEnseignementService
int nbLigneParPage =
ConfigurationHolder.config.eliot.absences.incident.consultation.
AbsencesFonctionnalite.ABS_SAISIE_INC_PUN_SAN_CUD
)
+ addFilterData(modele)
+
render(
view: '/saisie/incident/consultation/index',
model: modele
)
}
+ private void addFilterData(Map modele) {
+ PreferencesEtablissementAbsences preferences =
+ getPreferencesEtablissementCourant()
+
+ Calendrier calendrier =
+ calendrierService.getCalendrierForEtablissement(preferences.etablissement)
+
+ def anneeScolaire = [
+ debutAnneeScolaire: formateDate(calendrier.premierJour),
+ finAnneeScolaire: formateDate(calendrier.dernierJour)
+ ]
+
+ modele.anneeScolaire = anneeScolaire as JSON
+
+ Date dateDebut
+ Date dateFin = new Date()
+
+ if (dateFin < calendrier.premierJour) {
+ dateFin = calendrier.premierJour
+ }
+
+ if (dateFin > calendrier.dernierJour) {
+ dateFin = calendrier.dernierJour
+ }
+
+ use (TimeCategory) {
+ dateDebut = dateFin - 1.month
+ }
+
+ if (dateDebut < calendrier.premierJour) {
+ dateDebut = calendrier.premierJour
+ }
+
+ if (dateDebut > calendrier.dernierJour) {
+ dateDebut = calendrier.dernierJour
+ }
+
+ modele.dateDebut = formateDate(dateDebut)
+ modele.dateFin = formateDate(dateFin)
+
+ Locale locale = RCU.getLocale(request)
+
+ modele.etablissementId = etablissementCourantId()
+ modele.lieux = getAllLieuxIncident() as JSON
+ modele.types = getAllTypesIncident() as JSON
+ modele.classes = getAllClasses() as JSON
+ modele.responsables = getAllResponsables() as JSON
+
+ modele.typesProtagoniste =
+ enumMarshallerService.getEnumData(TypeProtagonisteIncident, locale) as JSON
+
+ modele.profils =
+ enumMarshallerService.getEnumData(ProfilCenseur, locale) as JSON
+ }
+
+ private List getAllClasses() {
+ List<StructureEnseignement> structures = localStructureEnseignementService.
+ findAllClasseByEtablissement(etablissementCourant())
+
+ structures.sort {a, b -> comparateurLogique.compare(a.code, b.code)}
+ return structures.collect { [id: it.id, libelle: it.code]}
+ }
+
+ private Map getAllResponsables() {
+ Map responsables = [:]
+
+ def collector = { Personne personne ->
+ [
+ id: personne.id,
+ libelle: personne.nomAffichage()
+ ]
+ }
+
+ responsables.direction = personneAnnuaireService.
+ findAllPersonnelDirectionByEtablissement(etablissementCourant()).collect(collector)
+
+ responsables.personnelEducation = personneAnnuaireService.
+ findAllPersonnelEducationByEtablissement(etablissementCourant()).collect(collector)
+
+ responsables.enseignants = personneAnnuaireService.
+ findAllEnseignantByEtablissement(etablissementCourant()).collect(collector)
+
+ return responsables
+ }
+
/**
* Alimente la page de consultation des incidents
*/
def sortInfo = JSON.parse(params.sortInfo)
int start = params.start ? Integer.parseInt(params.start) : 0
int limit = params.limit ? Integer.parseInt(params.limit) : nbLigneParPage
+
+ Map criteres = parseCriteres(params.criteres)
+
ListeIncidentsInfo listeIncidents = absencesIncidentService.findIncidents(
securiteSession,
securiteSession.personne,
sortInfo.field ?: 'date',
(sortInfo.direction == 'ASC'),
start,
- limit
+ limit,
+ criteres
)
Map nomsAffichageByIdExterne =
render resultats as JSON
}
+ Map parseCriteres(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.lieux != null) {
+ result.lieux = LieuIncident.getAll(criteres.lieux)
+ }
+
+ if (criteres.types != null) {
+ result.typesIncident = TypeIncident.getAll(criteres.types)
+ }
+
+ if (criteres.typesProtagoniste != null) {
+ result.typesProtagoniste = criteres.typesProtagoniste.collect {
+ TypeProtagonisteIncident.parseByCode(Integer.parseInt(it))
+ }
+ }
+
+ if (criteres.profils != null) {
+ result.profils = criteres.profils.collect {
+ ProfilCenseur.parseByCode(Integer.parseInt(it))
+ }
+ }
+
+ if (criteres.classes != null) {
+ result.classes = StructureEnseignement.getAll(criteres.classes)
+ }
+
+ if (criteres.personnes != null) {
+ result.personnes = Personne.getAll(criteres.personnes)
+ }
+
+ }
+
+ return result
+ }
+
+
def findIncidentsCSV = {
verifieDroitFonctionnalite(AbsencesFonctionnalite.ABS_SAISIE_INC_PUN_SAN)
return breadCrumbsInfo
}
-
}
package org.lilie.services.eliot.absences.saisie.discipline.punition
+import groovy.time.TimeCategory
import org.lilie.services.eliot.absences.PreferencesEtablissementAbsences
+import org.lilie.services.eliot.absences.TypeProtagonisteIncident
+import org.lilie.services.eliot.absences.TypeSanction
import org.lilie.services.eliot.scolarite.Calendrier
import grails.converters.JSON
import org.lilie.services.eliot.absences.page.Page
import org.lilie.services.eliot.parametrages.calendrier.CalendrierService
import org.lilie.services.eliot.absences.saisie.discipline.incident.ProfilCenseur
import org.codehaus.groovy.grails.commons.ConfigurationHolder
+import org.lilie.services.eliot.scolarite.StructureEnseignement
+
import java.text.SimpleDateFormat
import org.lilie.services.eliot.absences.saisie.discipline.punition.exceptions.PunitionException
import org.lilie.services.eliot.absences.TypePunition
AbsencesFonctionnalite.ABS_SAISIE_INC_PUN_SAN_CUD
)
+ addFilterData(modele)
+
render(
view: '/saisie/punition/consultation/index',
model: modele
)
}
+ private void addFilterData(Map modele) {
+ PreferencesEtablissementAbsences preferences =
+ getPreferencesEtablissementCourant()
+
+ Calendrier calendrier =
+ calendrierService.getCalendrierForEtablissement(preferences.etablissement)
+
+ def anneeScolaire = [
+ debutAnneeScolaire: formateDate(calendrier.premierJour),
+ finAnneeScolaire: formateDate(calendrier.dernierJour)
+ ]
+
+ modele.anneeScolaire = anneeScolaire as JSON
+
+ Date dateDebut
+ Date dateFin = new Date()
+
+ if (dateFin < calendrier.premierJour) {
+ dateFin = calendrier.premierJour
+ }
+
+ if (dateFin > calendrier.dernierJour) {
+ dateFin = calendrier.dernierJour
+ }
+
+ use (TimeCategory) {
+ dateDebut = dateFin - 1.month
+ }
+
+ if (dateDebut < calendrier.premierJour) {
+ dateDebut = calendrier.premierJour
+ }
+
+ if (dateDebut > calendrier.dernierJour) {
+ dateDebut = calendrier.dernierJour
+ }
+
+ modele.dateDebut = formateDate(dateDebut)
+ modele.dateFin = formateDate(dateFin)
+
+ Locale locale = RCU.getLocale(request)
+
+ modele.etablissementId = etablissementCourantId()
+ modele.types = getAllTypesPunition() as JSON
+ modele.classes = getAllClasses() as JSON
+ modele.responsables = getAllResponsables() as JSON
+
+ }
+
+ private List getAllClasses() {
+ List<StructureEnseignement> structures = localStructureEnseignementService.
+ findAllClasseByEtablissement(etablissementCourant())
+
+ structures.sort {a, b -> comparateurLogique.compare(a.code, b.code)}
+ return structures.collect { [id: it.id, libelle: it.code]}
+ }
+
+ private Map getAllResponsables() {
+ Map responsables = [:]
+
+ def collector = { Personne personne ->
+ [
+ id: personne.id,
+ libelle: personne.nomAffichage()
+ ]
+ }
+
+ responsables.direction = personneAnnuaireService.
+ findAllPersonnelDirectionByEtablissement(etablissementCourant()).collect(collector)
+
+ responsables.personnelEducation = personneAnnuaireService.
+ findAllPersonnelEducationByEtablissement(etablissementCourant()).collect(collector)
+
+ responsables.enseignants = personneAnnuaireService.
+ findAllEnseignantByEtablissement(etablissementCourant()).collect(collector)
+
+ return responsables
+ }
+
/**
* Affiche la page de création d'une nouvelle punition
* Envoie le necessaire apr le modèle
int limit = Integer.parseInt(params.limit ?: '0') ?: nbLigneParPage
int start = Integer.parseInt(params.start ?: '0')
Map sortInfo = (Map) JSON.parse(params.sortInfo)
+
+ Map criteres = parseCriteres(params.criteres)
+
Map resultats = absencesPunitionService.findPunitions(
securiteSession,
securiteSession.personne,
sortInfo.field,
(sortInfo.direction == 'ASC'),
start,
- limit
+ limit,
+ criteres
)
def resultatsJson = [
render resultatsJson as JSON
}
+ Map parseCriteres(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
+ }
+
+
/**
* Permet de construire les dto pour la vue de consultation des sanctions
* @param sanctions
package org.lilie.services.eliot.absences.saisie.discipline.sanction
+import groovy.time.TimeCategory
import org.lilie.services.eliot.absences.AbstractAbsencesController
import org.lilie.services.eliot.absences.page.Page
import org.lilie.services.eliot.absences.PreferencesEtablissementAbsences
import org.lilie.services.eliot.absences.saisie.discipline.incident.ProfilCenseur
import org.codehaus.groovy.grails.commons.ConfigurationHolder
import org.lilie.services.eliot.absences.Sanction
+import org.lilie.services.eliot.scolarite.StructureEnseignement
+import org.lilie.services.eliot.scolarite.structureenseignement.LocalStructureEnseignementService
+import org.lilie.services.eliot.temps.DateUtil
+
import java.text.SimpleDateFormat
import org.lilie.services.eliot.securite.impl.Autorite
import org.lilie.services.eliot.absences.TypeSanction
PlageHoraireService plageHoraireService
AbsencesPreparationExportCSVService absencesPreparationExportCSVService
EnumMarshallerService enumMarshallerService
+ LocalStructureEnseignementService localStructureEnseignementService
static final int NB_LIGNES_PAR_PAGES = ConfigurationHolder.config.eliot.absences.sanction.consultation.nombreLignesParPage ?: 100
AbsencesFonctionnalite.ABS_SAISIE_INC_PUN_SAN_CUD
)
+ addFilterData(modele)
+
render(
view: '/saisie/sanction/consultation/index',
model: modele
)
}
+ private void addFilterData(Map modele) {
+ PreferencesEtablissementAbsences preferences =
+ getPreferencesEtablissementCourant()
+
+ Calendrier calendrier =
+ calendrierService.getCalendrierForEtablissement(preferences.etablissement)
+
+ def anneeScolaire = [
+ debutAnneeScolaire: formateDate(calendrier.premierJour),
+ finAnneeScolaire: formateDate(calendrier.dernierJour)
+ ]
+
+ modele.anneeScolaire = anneeScolaire as JSON
+
+ Date dateDebut
+ Date dateFin = new Date()
+
+ if (dateFin < calendrier.premierJour) {
+ dateFin = calendrier.premierJour
+ }
+
+ if (dateFin > calendrier.dernierJour) {
+ dateFin = calendrier.dernierJour
+ }
+
+ use (TimeCategory) {
+ dateDebut = dateFin - 1.month
+ }
+
+ if (dateDebut < calendrier.premierJour) {
+ dateDebut = calendrier.premierJour
+ }
+
+ if (dateDebut > calendrier.dernierJour) {
+ dateDebut = calendrier.dernierJour
+ }
+
+ modele.dateDebut = formateDate(dateDebut)
+ modele.dateFin = formateDate(dateFin)
+
+ Locale locale = RCU.getLocale(request)
+
+ modele.etablissementId = etablissementCourantId()
+ modele.types = getAllTypesSanction() as JSON
+ modele.classes = getAllClasses() as JSON
+ modele.responsables = getAllResponsables() as JSON
+
+ }
+
+ private List getAllClasses() {
+ List<StructureEnseignement> structures = localStructureEnseignementService.
+ findAllClasseByEtablissement(etablissementCourant())
+
+ structures.sort {a, b -> comparateurLogique.compare(a.code, b.code)}
+ return structures.collect { [id: it.id, libelle: it.code]}
+ }
+
+ private Map getAllResponsables() {
+ Map responsables = [:]
+
+ def collector = { Personne personne ->
+ [
+ id: personne.id,
+ libelle: personne.nomAffichage()
+ ]
+ }
+
+ responsables.direction = personneAnnuaireService.
+ findAllPersonnelDirectionByEtablissement(etablissementCourant()).collect(collector)
+
+ responsables.personnelEducation = personneAnnuaireService.
+ findAllPersonnelEducationByEtablissement(etablissementCourant()).collect(collector)
+
+ responsables.enseignants = personneAnnuaireService.
+ findAllEnseignantByEtablissement(etablissementCourant()).collect(collector)
+
+ return responsables
+ }
+
def getSanctionsCSV = {
verifieDroitFonctionnalite(AbsencesFonctionnalite.ABS_SAISIE_INC_PUN_SAN)
Personne enseignant = securiteSession.personne
int start = Integer.parseInt(params.start ?: '0')
Map sortInfo = (Map) JSON.parse(params.sortInfo)
+ Map criteres = parseCriteres(params.criteres)
+
Personne enseignent = securiteSession.personne
Map resultats = absencesSanctionService.findAllSanctionParPersonne(
sortInfo.field,
(sortInfo.direction == 'ASC'),
start,
- limit
+ limit,
+ criteres
)
def resultatsJson = [
render resultatsJson as JSON
}
+ Map parseCriteres(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
+ }
+
/**
* Affiche la page de création d'une nouvelle sanction
* Envoie le necessaire dans le modèle
eliot.absences.export.absences.incident.gravite=Gravité
eliot.absences.export.absences.incident.partenaires=Partenaires prévenus
eliot.absences.export.absences.incident.protagonistes=Protagonistes
+eliot.absences.export.absences.incident.typePprotagoniste=Type protagoniste
eliot.absences.export.absences.typePunition=Type punition
eliot.absences.export.statistiques.totaux=Totaux
absences.libelle.selection=Sélection
absences.libelle.total=Total
-menu.etablissement.titre=Etablissements
\ No newline at end of file
+menu.etablissement.titre=Etablissements
+
+eliot.absences.saisie.filter.profilClasse=Profil / Classe
\ No newline at end of file
}
}
+ return findAllPersonneEleveForStructure(securiteSession, structuresId)
+ }
+
+ List<Personne> findAllPersonneEleveForStructure(
+ SecuriteSession securiteSession,
+ List<Long> structuresId) {
+
if (structuresId.contains(VALEUR_TOUS)) {
structuresId =
(localStructureEnseignementService.findAllStructureEnseignementByEnseignantAndEtablissement(
package org.lilie.services.eliot.absences.saisie.discipline.incident
+import groovy.time.TimeCategory
import org.lilie.services.eliot.absences.Incident
+import org.lilie.services.eliot.absences.ScolariteService
+import org.lilie.services.eliot.absences.TypeProtagonisteIncident
+import org.lilie.services.eliot.scolarite.StructureEnseignement
+import org.lilie.services.eliot.scolarite.personne.PersonneAnnuaireService
+import org.lilie.services.eliot.scolarite.structureenseignement.LocalStructureEnseignementService
import org.lilie.services.eliot.securite.AutorisationException
import org.lilie.services.eliot.absences.securite.DroitsService
import org.lilie.services.eliot.absences.ProtagonisteIncident
EleveAnnuaireService eleveAnnuaireService
AbsencesSanctionService absencesSanctionService
AbsencesPunitionService absencesPunitionService
+ ScolariteService scolariteService
+ LocalStructureEnseignementService localStructureEnseignementService
+ PersonneAnnuaireService personneAnnuaireService
private static final FIND_INCIDENTS = """
from Incident as incident
incident.partenairesAPrevenir?.each {
PartenaireAPrevenirIncident partenaireAPrevenirIncident ->
- // Suppression du partenaire
- if (!incidentParams.partenairesParams.find { PartenaireAPrevenirIncidentParams params ->
- params.partenaireAPrevenir.id == partenaireAPrevenirIncident.partenaireAPrevenir.id
- }) {
- partenairesAPrevenirASupprimer.add(
- partenaireAPrevenirIncident.id
- )
- }
+ // Suppression du partenaire
+ if (!incidentParams.partenairesParams.find { PartenaireAPrevenirIncidentParams params ->
+ params.partenaireAPrevenir.id == partenaireAPrevenirIncident.partenaireAPrevenir.id
+ }) {
+ partenairesAPrevenirASupprimer.add(
+ partenaireAPrevenirIncident.id
+ )
+ }
}
partenaireAPrevenirIncidentService.supprimePartenaireAPrevenirIncidents(
incidentParams.partenairesParams.each {
PartenaireAPrevenirIncidentParams partenaireAPrevenirIncidentDto ->
- if (!incident.partenairesAPrevenir.find {
- PartenaireAPrevenirIncident partenaireAPrevenirIncident ->
- partenaireAPrevenirIncidentDto.partenaireAPrevenir.id == partenaireAPrevenirIncident.partenaireAPrevenir.id
- }) {
+ if (!incident.partenairesAPrevenir.find {
+ PartenaireAPrevenirIncident partenaireAPrevenirIncident ->
+ partenaireAPrevenirIncidentDto.partenaireAPrevenir.id == partenaireAPrevenirIncident.partenaireAPrevenir.id
+ }) {
- partenairesAPrevenirACreer << partenaireAPrevenirIncidentDto
- }
+ partenairesAPrevenirACreer << partenaireAPrevenirIncidentDto
+ }
}
partenaireAPrevenirIncidentService.creePartenairesAPrevenirIncident(
String champOrdre,
Boolean ascendant,
int start,
- int limit) {
+ int limit,
+ Map criteres = [:]) {
- List<Autorite> eleves = []
ListeIncidentsInfo result = new ListeIncidentsInfo(
nbIncidents: 0,
incidents: []
)
+
Map hqlParams = [etablissementId: etablissement.id]
String hql = FIND_INCIDENTS
)
if (estSeulementEnseig) {
- eleves = eleveAnnuaireService.findAllEleveByService(
+ List<Personne> elevesEnseignant = eleveAnnuaireService.findAllEleveByService(
securiteSession,
droitsService.getPerimetreServiceIds(securiteSession)
- )?.collect { it.autorite }
+ )
- if (eleves.size() == 0) {
+ if (elevesEnseignant.size() == 0) {
return result
}
- hql += ' and protagoniste_incident.autorite in (:eleves)'
- hqlParams.eleves = eleves
- result.nbIncidents =
- (Integer) ProtagonisteIncident.createCriteria().get {
- 'in'('autorite', eleves)
- incident {
- eq('etablissement', etablissement)
- }
- projections {
- 'countDistinct'('incident')
- }
+
+ hql += ' and protagoniste_incident.autorite in (:elevesEnseignant)'
+ hqlParams.elevesEnseignant = elevesEnseignant?.collect { it.autorite }
+ }
+
+
+ if (criteres.dateDebut != null) {
+ hql += ' and incident.date >= :dateDebut'
+ hqlParams['dateDebut'] = criteres.dateDebut
+ }
+
+ if (criteres.dateFin != null) {
+ Date dateFin = criteres.dateFin
+ use (TimeCategory) {
+ dateFin += 23.hours + 59.minutes
+ }
+
+ hql += ' and incident.date <= :dateFin'
+ hqlParams['dateFin'] = dateFin
+ }
+
+ if ((criteres.lieux != null) && (criteres.lieux.size() > 0)) {
+ hql += ' and incident.lieu in (:lieux)'
+ hqlParams['lieux'] = criteres.lieux
+ }
+
+ if ((criteres.typesIncident != null) && (criteres.typesIncident.size() > 0)) {
+ hql += ' and incident.type in (:typesIncident)'
+ hqlParams['typesIncident'] = criteres.typesIncident
+ }
+
+ List<Personne> personnes = []
+
+ if ((criteres.personnes != null) && (criteres.personnes.size() > 0)) {
+ personnes.addAll(criteres.personnes)
+ }
+
+ else if ((criteres.typesProtagoniste == null) ||
+ criteres.typesProtagoniste.contains(TypeProtagonisteIncident.CENSEUR)) {
+
+
+ if (((criteres.typesProtagoniste != null) && (criteres.typesProtagoniste.size() > 0)) ||
+ ((criteres.profils != null) && (criteres.profils.size() > 0))) {
+
+ Boolean direction = true
+ Boolean personnelsEducation = true
+ Boolean enseignants = true
+
+ if ((criteres.profils != null) && (criteres.profils.size() > 0)) {
+ direction = criteres.profils.contains(ProfilCenseur.DIRECTIONS)
+ personnelsEducation = criteres.profils.contains(ProfilCenseur.PERSONNELS_EDUCATION)
+ enseignants = criteres.profils.contains(ProfilCenseur.ENSEIGNANTS)
+ }
+ else if ((criteres.classes != null) && (criteres.classes.size() > 0)) {
+ direction = false
+ personnelsEducation = false
+ enseignants = false
+ }
+
+ if (direction == true) {
+ personnes.addAll(personneAnnuaireService.
+ findAllPersonnelDirectionByEtablissement(etablissement))
+ }
+
+ if (personnelsEducation == true) {
+ personnes.addAll(personneAnnuaireService.
+ findAllPersonnelEducationByEtablissement(etablissement))
+ }
+
+ if (enseignants == true) {
+ personnes.addAll(personneAnnuaireService.
+ findAllEnseignantByEtablissement(etablissement))
}
+ }
+ }
+
+ if ((criteres.classes != null) &&
+ ((criteres.classes.size() > 1) || (criteres.personnes == null))) {
+
+ Boolean eleves = true
+ Boolean parents = true
+
+ if ((criteres.typesProtagoniste != null) && (criteres.typesProtagoniste.size() > 0)) {
+ eleves = criteres.typesProtagoniste.contains(TypeProtagonisteIncident.ELEVE)
+ parents = criteres.typesProtagoniste.contains(TypeProtagonisteIncident.PARENT)
+ }
+
+ if (eleves == true) {
+ personnes.addAll(scolariteService.findAllPersonneEleveForStructure(
+ securiteSession,
+ criteres.classes.collect {it.id}
+ ))
+ }
+
+ if (parents == true) {
+ personnes.addAll(localStructureEnseignementService.findAllParentsForStructures(
+ securiteSession,
+ StructureEnseignement.getAll(criteres.classes)
+ ))
+ }
+
}
- else {
- result.nbIncidents = Incident.countByEtablissement(etablissement)
+
+ if (personnes.size() > 0) {
+ hql += ' and protagoniste_incident.autorite in (:personnes) '
+ hqlParams['personnes'] = personnes.collect { it.autorite }
}
switch (champOrdre) {
[max: limit, offset: start]
)
+ result.nbIncidents = Incident.executeQuery(hql, hqlParams).size()
+
return result
}
Boolean result = false
incident.partenairesAPrevenir.each {
PartenaireAPrevenirIncident part ->
- if (ids.contains(part.partenaireAPrevenir.id)) {
- result = true
- }
- ids.add(part.partenaireAPrevenir.id)
+ if (ids.contains(part.partenaireAPrevenir.id)) {
+ result = true
+ }
+ ids.add(part.partenaireAPrevenir.id)
}
return result
}
package org.lilie.services.eliot.absences.saisie.discipline.punition
import org.lilie.services.eliot.absences.Punition
+import org.lilie.services.eliot.absences.ScolariteService
import org.lilie.services.eliot.absences.securite.DroitsService
import org.lilie.services.eliot.absences.saisie.discipline.punition.exceptions.PunitionException
import org.lilie.services.eliot.absences.saisie.discipline.punition.exceptions.PunitionDescriptionLongueException
DroitsService droitsService
EleveRecupService eleveRecupService
EleveAnnuaireService eleveAnnuaireService
+ ScolariteService scolariteService
static transactional = true
void supprimePunition(SecuriteSession securiteSession,
Punition punitionASupprimer)
throws AutorisationException, PunitionException {
-
+ droitsService.verifieDroitModificationFonctionnalite(
+ securiteSession,
+ punitionASupprimer.etablissement,
+ AbsencesFonctionnalite.ABS_SAISIE_INC_PUN_SAN
+ )
internalSupprimePunition(punitionASupprimer)
}
String champOrdre,
Boolean ascendant,
int start,
- int limit) {
+ int limit,
+ Map criteres = [:]) {
+
+ boolean personneIsEnseignant =
+ droitsService.hasOnlyPerimetreService(
+ securiteSession
+ )
Map result = [
'nbPunitionsInfo': 0,
'punitionsInfo': []
]
- List<Personne> eleves = []
- String hqlFromPunition = findPunitionHqlFromPunition()
- Map params = (Map) [:]
- Map paramsPagination = (Map) [:]
- boolean estSeulementEnseig = droitsService.hasOnlyPerimetreService(
- securiteSession
- )
+ // fait la requête seulement si on n'est pas un prof sans élèves
+ if (!(personneIsEnseignant && eleves?.size() == 0)) {
+ String hqlFromPunition = findPunitionHqlFromPunition()
- if (estSeulementEnseig) {
- eleves = eleveAnnuaireService.findAllEleveByService(
- securiteSession,
- droitsService.getPerimetreServiceIds(securiteSession)
- )
+ Map hqlParams = (Map) [
+ etablissementId: etablissement.id,
+ typeClasse: StructureEnseignement.TYPE_CLASSE
+ ]
- if (eleves.size() == 0) {
- return result
+ if (personneIsEnseignant) {
+ List<Personne> elevesEnseignant = eleveRecupService.findAllEleveByEnseignantAndEtablissement(
+ securiteSession,
+ personne,
+ etablissement
+ )
+
+ if (elevesEnseignant.size() == 0) {
+ return resultats
+ }
+
+ hqlFromPunition += ' and eleve in (:elevesEnseignant)'
+ hqlParams.elevesEnseignant = elevesEnseignant
+ }
+
+ if (criteres.dateDebut != null) {
+ hqlFromPunition += ' and punition.date >= :dateDebut'
+ hqlParams['dateDebut'] = criteres.dateDebut
}
- hqlFromPunition += ' and eleve in (:eleves)'
- params.eleves = eleves
- result['nbPunitionsInfo'] = Punition.createCriteria().get {
- eq('etablissement', etablissement)
- 'in'('eleve', eleves)
- projections {
- countDistinct('id')
+ if (criteres.dateFin != null) {
+ hqlFromPunition += ' and punition.date <= :dateFin'
+ hqlParams['dateFin'] = criteres.dateFin
+ }
+
+ if ((criteres.classes != null) && (criteres.classes.size() > 0)) {
+ List<Personne> elevesClasse = scolariteService.findAllPersonneEleveForStructure(
+ securiteSession,
+ criteres.classes.collect {it.id}
+ )
+
+ if (elevesClasse.size() > 0) {
+ hqlFromPunition += ' and eleve in (:elevesClasse)'
+ hqlParams['elevesClasse'] = elevesClasse
}
}
- } else {
- result['nbPunitionsInfo'] = Punition.countByEtablissement(etablissement)
- }
- String ordre = ascendant ? ' asc' : ' desc'
- String champ = champOrdre
-
- switch (champOrdre) {
- case ConsultationPunitionSanctionNomColonnes.DATE:
- champ = 'punition.date'
- break
- case ConsultationPunitionSanctionNomColonnes.ELEVE_ID:
- champ = 'punition.eleve.id'
- break
- case ConsultationPunitionSanctionNomColonnes.NOM_AFFICHAGE:
- champ = 'punition.eleve.nom, punition.eleve.prenom'
- break
- case ConsultationPunitionSanctionNomColonnes.TYPE:
- champ = 'punition.typePunition.libelle'
- break
- case ConsultationPunitionSanctionNomColonnes.CENSEUR:
- champ = 'punition.eleve.nom, punition.eleve.prenom'
- break
- case ConsultationPunitionSanctionNomColonnes.STATUT:
- champ = 'punition.effectue'
- break
- case ConsultationPunitionSanctionNomColonnes.CLASSE:
- champ = 'pps.proprietesScolarite.structureEnseignement.code'
- break
- }
- hqlFromPunition += 'order by ' + champ + ordre
+ if ((criteres.eleves != null) && (criteres.eleves.size() > 0)) {
+ hqlFromPunition += ' and eleve in (:eleves)'
+ hqlParams['eleves'] = criteres.eleves
+ }
- paramsPagination.max = limit
- paramsPagination.offset = start
- params.etablissementId = etablissement.id
- params.typeClasse = StructureEnseignement.TYPE_CLASSE
+ if ((criteres.responsables != null) && (criteres.responsables.size() > 0)) {
+ hqlFromPunition += ' and punition.censeur in (:responsables)'
+ hqlParams['responsables'] = criteres.responsables
+ }
- result['punitionsInfo'] = Punition.executeQuery(
- hqlFromPunition,
- params,
- paramsPagination
- )
+ if ((criteres.typesPunition != null) && (criteres.typesPunition.size() > 0)) {
+ hqlFromPunition += ' and punition.typePunition in (:typesPunition)'
+ hqlParams['typesPunition'] = criteres.typesPunition
+ }
+
+ if (criteres.effectue != null) {
+ hqlFromPunition += ' and punition.effectue = :effectue'
+ hqlParams['effectue'] = criteres.effectue
+ }
+ String ordre = ascendant ? ' asc' : ' desc'
+ String champ = getNomCompletChampOrdre(champOrdre)
+ hqlFromPunition += ' order by ' + champ + ordre
+
+ result['punitionsInfo'] = Punition.executeQuery(
+ hqlFromPunition,
+ hqlParams,
+ [max: limit, offset: start]
+ )
+
+ result['nbPunitionsInfo'] =
+ Punition.executeQuery(hqlFromPunition, hqlParams).size()
+
+ }
return result
}
+ private String getNomCompletChampOrdre(String champOrdre) {
+ String champ
+ switch (champOrdre) {
+ case ConsultationPunitionSanctionNomColonnes.DATE:
+ champ = 'punition.date'
+ break
+ case ConsultationPunitionSanctionNomColonnes.ELEVE_ID:
+ champ = 'punition.eleve.id'
+ break
+ case ConsultationPunitionSanctionNomColonnes.NOM_AFFICHAGE:
+ champ = 'punition.eleve.nom, punition.eleve.prenom'
+ break
+ case ConsultationPunitionSanctionNomColonnes.TYPE:
+ champ = 'punition.typePunition.libelle'
+ break
+ case ConsultationPunitionSanctionNomColonnes.CENSEUR:
+ champ = 'punition.eleve.nom, punition.eleve.prenom'
+ break
+ case ConsultationPunitionSanctionNomColonnes.STATUT:
+ champ = 'punition.effectue'
+ break
+ case ConsultationPunitionSanctionNomColonnes.CLASSE:
+ champ = 'pps.proprietesScolarite.structureEnseignement.code'
+ break
+ }
+ return champ
+ }
+
Map findPunitions(SecuriteSession securiteSession,
Personne personne,
Etablissement etablissement) {
'nbPunitionsInfo': 0,
'punitionsInfo': []
]
- Map params = (Map) [:]
- Map paramsPagination = (Map) [:]
- String hqlFromPunition = findPunitionHqlFromPunition()
+ Map params = (Map) [:]
+ Map paramsPagination = (Map) [:]
+ String hqlFromPunition = findPunitionHqlFromPunition()
boolean estSeulementEnseig = droitsService.hasOnlyPerimetreService(
securiteSession
return result
}
hqlFromPunition += ' and eleve in (:eleves)'
- params.eleves = eleves
- result['nbPunitionsInfo'] = Punition.createCriteria().get {
- eq('etablissement', etablissement)
- 'in'('eleve', eleves)
- projections {
- countDistinct('id')
+ params.eleves = eleves
+ result['nbPunitionsInfo'] = Punition.createCriteria().get {
+ eq('etablissement', etablissement)
+ 'in'('eleve', eleves)
+ projections {
+ countDistinct('id')
+ }
}
+ } else {
+ result['nbPunitionsInfo'] = Punition.countByEtablissement(etablissement)
}
- } else {
- result['nbPunitionsInfo'] = Punition.countByEtablissement(etablissement)
- }
params.etablissementId = etablissement.id
params.typeClasse = StructureEnseignement.TYPE_CLASSE
- result['punitionsInfo'] = Punition.executeQuery(
- hqlFromPunition,
- params,
- paramsPagination
- )
+ result['punitionsInfo'] = Punition.executeQuery(
+ hqlFromPunition,
+ params,
+ paramsPagination
+ )
return result
}
package org.lilie.services.eliot.absences.saisie.discipline.sanction
import org.lilie.services.eliot.absences.Sanction
+import org.lilie.services.eliot.absences.ScolariteService
+import org.lilie.services.eliot.absences.TypeSanction
import org.lilie.services.eliot.absences.saisie.discipline.sanction.exceptions.SanctionException
import org.lilie.services.eliot.absences.securite.DroitsService
import org.lilie.services.eliot.securite.AutorisationException
AbsenceJourneeService absenceJourneeService
EleveRecupService eleveRecupService
EleveAnnuaireService eleveAnnuaireService
+ ScolariteService scolariteService
/**
* Crée une nouvelle sanction
*/
Sanction modifieSanction(SecuriteSession securiteSession,
Sanction sanctionAModifier,
- SanctionParams sanctionParams
+ SanctionParams sanctionParams
) throws SanctionException {
initialiseSanction(sanctionAModifier, sanctionParams)
internalSupprimeAbsencesExistantes(sanctionAModifier)
- // TOREFACT : appel méthode protected à partir d'une classe externe
+ // TOREFACT : appel méthode protected à partir d'une classe externe
absenceJourneeService.internalModifieAbsencesForSanction(
sanctionParams.operateurSaisie,
sanctionAModifier
String champOrdre,
Boolean ascendant,
int start,
- int limit
+ int limit,
+ Map criteres = [:]
) {
+ boolean personneIsEnseignant = droitsService.hasOnlyPerimetreService(
+ securiteSession
+ )
+
List sanctionsInfo = []
Map resultats = [
nbsanctionsInfo: 0,
sanctionsInfo: sanctionsInfo
]
- Map hqlParams = [
- etablissementId: etablissement.id,
- typeClasse: StructureEnseignement.TYPE_CLASSE
- ]
- List<Personne> eleves = []
- String hqlFromSanction = findAllSanctionsHqlFromSanctions()
- boolean estSeulementEnseig = droitsService.hasOnlyPerimetreService(
- securiteSession
- )
+ // fait la requête seulement si on n'est pas un prof sans élèves
+ if (!(personneIsEnseignant && eleves?.size() == 0)) {
- if (estSeulementEnseig) {
- eleves = eleveAnnuaireService.findAllEleveByService(
+ String hqlFromSanction = findAllSanctionsHqlFromSanctions()
+ Map hqlParams = [
+ etablissementId: etablissement.id,
+ typeClasse: StructureEnseignement.TYPE_CLASSE
+ ]
+
+ if (personneIsEnseignant) {
+ List<Personne> elevesEnseignant = eleveRecupService.findAllEleveByEnseignantAndEtablissement(
securiteSession,
- droitsService.getPerimetreServiceIds(securiteSession)
- )
+ personne,
+ etablissement
+ )
- if (eleves.size() == 0) {
- return resultats
+ if (elevesEnseignant.size() == 0) {
+ return resultats
+ }
+
+ hqlFromSanction += ' and eleve in (:elevesEnseignant)'
+ hqlParams['elevesEnseignant'] = elevesEnseignant
}
- hqlFromSanction += ' and eleve in (:eleves)'
- hqlParams['eleves'] = eleves
- resultats['nbsanctionsInfo'] = Sanction.createCriteria().get {
- eq('etablissement', etablissement)
- 'in'('eleve', eleves)
- projections {
- countDistinct('id')
+
+ if (criteres.dateDebut != null) {
+ hqlFromSanction += ' and sanction.date >= :dateDebut'
+ hqlParams['dateDebut'] = criteres.dateDebut
+ }
+
+ if (criteres.dateFin != null) {
+ hqlFromSanction += ' and sanction.date <= :dateFin'
+ hqlParams['dateFin'] = criteres.dateFin
+ }
+
+ if ((criteres.classes != null) && (criteres.classes.size() > 0)) {
+ List<Personne> elevesClasse = scolariteService.findAllPersonneEleveForStructure(
+ securiteSession,
+ criteres.classes.collect {it.id}
+ )
+
+ if (elevesClasse.size() > 0) {
+ hqlFromSanction += ' and eleve in (:elevesClasse)'
+ hqlParams['elevesClasse'] = elevesClasse
}
}
- } else {
- resultats['nbsanctionsInfo'] = Sanction.countByEtablissement(etablissement)
- }
- String ordre = ascendant ? ' asc' : ' desc'
- String champ = champOrdre
+ if ((criteres.eleves != null) && (criteres.eleves.size() > 0)) {
+ hqlFromSanction += ' and eleve in (:eleves)'
+ hqlParams['eleves'] = criteres.eleves
+ }
+
+ if ((criteres.responsables != null) && (criteres.responsables.size() > 0)) {
+ hqlFromSanction += ' and sanction.censeur in (:responsables)'
+ hqlParams['responsables'] = criteres.responsables
+ }
- champ = getNomCompletChampOrdre(champOrdre)
+ if ((criteres.typesSanction != null) && (criteres.typesSanction.size() > 0)) {
+ hqlFromSanction += ' and sanction.typeSanction in (:typesSanction)'
+ hqlParams['typesSanction'] = criteres.typesSanction
+ }
- hqlFromSanction += 'order by ' + champ + ordre
+ if (criteres.effectue != null) {
+ hqlFromSanction += ' and sanction.effectue = :effectue'
+ hqlParams['effectue'] = criteres.effectue
+ }
- resultats['sanctionsInfo'] = Sanction.executeQuery(
- hqlFromSanction,
- hqlParams,
- [max: limit, offset: start]
- )
+ String ordre = ascendant ? ' asc' : ' desc'
+ String champ = getNomCompletChampOrdre(champOrdre)
+ hqlFromSanction += ' order by ' + champ + ordre
+ resultats['sanctionsInfo'] = Sanction.executeQuery(
+ hqlFromSanction,
+ hqlParams,
+ [max: limit, offset: start]
+ )
+
+ resultats['nbsanctionsInfo'] =
+ Sanction.executeQuery(hqlFromSanction, hqlParams).size()
+
+ }
return resultats
}
+
private String getNomCompletChampOrdre(String champOrdre) {
String champ
switch (champOrdre) {
nbsanctionsInfo: 0,
sanctionsInfo: sanctionsInfo
]
- Map hqlParams = [
- etablissementId: etablissement.id,
- typeClasse: StructureEnseignement.TYPE_CLASSE
- ]
+ Map hqlParams = [
+ etablissementId: etablissement.id,
+ typeClasse: StructureEnseignement.TYPE_CLASSE
+ ]
List<Personne> eleves = []
String hqlFromSanction = findAllSanctionsHqlFromSanctions()
hqlFromSanction += ' and eleve in (:eleves)'
hqlParams['eleves'] = eleves
- resultats['nbsanctionsInfo'] = Sanction.createCriteria().get {
- eq('etablissement', etablissement)
- 'in'('eleve', eleves)
- projections {
- countDistinct('id')
+ resultats['nbsanctionsInfo'] = Sanction.createCriteria().get {
+ eq('etablissement', etablissement)
+ 'in'('eleve', eleves)
+ projections {
+ countDistinct('id')
+ }
}
}
- }
- else {
- resultats['nbsanctionsInfo'] = Sanction.countByEtablissement(
- etablissement
- )
- }
+ else {
+ resultats['nbsanctionsInfo'] = Sanction.countByEtablissement(
+ etablissement
+ )
+ }
resultats['donnees'] = Sanction.executeQuery(
hqlFromSanction,
--- /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:render template="/consultation/commun"/>
+
+<g:javascript library="src/views/saisie/commons/filter/Constantes"/>
+<g:javascript library="src/views/saisie/commons/filter/ConfigServeur"/>
+
+<g:javascript>
+
+ <eliotjs:ns name="eliot.absences.saisie.commons.filter.ConfigServeur">
+
+ <eliotjs:ns name="url">
+ <eliotjs:varLink name="getEleves" action="getAllPersonneEleveByStructureEnseignement" controller="jsonScolarite"/>
+ <eliotjs:varLink name="getParents" action="getAllParentByStructureEnseignement" controller="jsonScolarite"/>
+ </eliotjs:ns>
+
+ <eliotjs:ns name="icon">
+ <eliotjs:varResource name="chercher" dir="images" file="properties.gif"/>
+ </eliotjs:ns>
+
+ <eliotjs:ns name="libelle">
+ <eliotjs:varI18n name="periodeFin" code="absences.formulaire.titreDateFin"/>
+ <eliotjs:varI18n name="periodeDebut" code="absences.formulaire.titreDateDebut"/>
+ <eliotjs:varI18n name="chercher" code="absences.formulaire.titreChercher"/>
+ <eliotjs:varI18n name="plusDeCriteres" code="absences.formulaire.titrePlusDeCriteres"/>
+
+ <eliotjs:varI18n name="lieu" code="absences.ips.libelle.lieux"/>
+ <eliotjs:varI18n name="type" code="absences.ips.libelle.type"/>
+ <eliotjs:varI18n name="typeProtagoniste" code="eliot.absences.export.absences.incident.typePprotagoniste"/>
+ <eliotjs:varI18n name="profilClasse" code="eliot.absences.saisie.filter.profilClasse"/>
+ <eliotjs:varI18n name="personne" code="absences.libelle.comboPersonneEducField"/>
+
+ <eliotjs:varI18n name="classe" code="absences.libelle.comboClasse"/>
+ <eliotjs:varI18n name="eleve" code="absences.libelle.comboEleveField"/>
+ <eliotjs:varI18n name="responsable" code="absences.libelle.responsable"/>
+ <eliotjs:varI18n name="statut" code="absences.libelle.statut"/>
+
+ <eliotjs:varI18n name="effectuee" code="absences.data.effectuee"/>
+ <eliotjs:varI18n name="nonEffectuee" code="absences.data.nonEffectuee"/>
+
+ </eliotjs:ns>
+
+ <eliotjs:ns name="data">
+ <eliotjs:varString name="dateDebut" value="${dateDebut}"/>
+ <eliotjs:varString name="dateFin" value="${dateFin}"/>
+ <eliotjs:varJson name="anneeScolaire" value="${anneeScolaire}"/>
+ <eliotjs:varNumeric name="etablissementId" value="${etablissementId}"/>
+ <eliotjs:varJson name="lieux" value="${lieux}" nullable="true"/>
+ <eliotjs:varJson name="types" value="${types}"/>
+ <eliotjs:varJson name="typesProtagoniste" value="${typesProtagoniste}" nullable="true"/>
+ <eliotjs:varJson name="classes" value="${classes}"/>
+ <eliotjs:varJson name="profils" value="${profils}" nullable="true"/>
+ <eliotjs:varJson name="responsables" value="${responsables}" nullable="true"/>
+ </eliotjs:ns>
+
+ </eliotjs:ns>
+
+</g:javascript>
+
+<g:javascript library="src/views/commons/helper/AjaxHelper"/>
+<g:javascript library="src/views/consultation/Constantes"/>
+<g:javascript library="src/views/consultation/DateView"/>
+<g:javascript library="src/views/consultation/LovComboView"/>
+
+<g:javascript library="src/views/saisie/commons/filter/FilterModel"/>
+<g:javascript library="src/views/saisie/commons/filter/FilterView"/>
+<g:javascript library="src/views/saisie/commons/filter/FilterController"/>
+
+<g:javascript library="src/views/saisie/commons/filter/Composant"/>
\ No newline at end of file
<!-- Template pour les définitions des constantes de modèle-->
<g:render template="/saisie/incident/consultation/modele"/>
+ <g:render template="/saisie/commons/filter/composant"/>
+
<g:javascript library="src/views/commons/Message"/>
<g:javascript library="src/views/saisie/incident/consultation/IncidentController"/>
<g:javascript library="src/views/saisie/incident/consultation/Application"/>
<!-- 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/Application"/>
%{--<!-- 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/Application"/>
--- /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>.
+ */
+
+Ext.ns('eliot.absences.saisie.commons.filter');
+
+eliot.absences.saisie.commons.filter.Composant = Ext.extend(Ext.util.Observable, {
+
+ constructor: function(config) {
+ this.init(eliot.absences.saisie.commons.filter, config);
+
+ var model = new this.ns.FilterModel({
+ dateDebut: this.ConfigServeur.data.dateDebut,
+ dateFin: this.ConfigServeur.data.dateFin,
+ lieux: '-1',
+ types: '-1',
+ typesProtagoniste: '-1',
+ profilsClasses: '-1',
+ personne: '-1'
+ });
+
+ var controller = new this.ns.FilterController({
+ model: model,
+ composant: {
+ cherche: this.cherche.createDelegate(this)
+ }
+ }).getInterface();
+
+ var view = new this.ns.FilterView({
+ model: model,
+ controller: controller,
+ container: this.config.container,
+ criteres: this.config.criteres,
+ plusDeCriteres: this.config.plusDeCriteres
+ }).getInterface();
+
+ controller.observeView(view);
+
+ this.controller = controller;
+ this.view = view;
+ },
+
+ init: function(ns, config) {
+ this.ns = ns;
+ this.Constantes = this.ns.Constantes;
+ this.ConfigServeur = this.ns.ConfigServeur;
+ this.config = Ext.apply(this.creeConfig(), config);
+ this.addEvents(this.Constantes.eventId.cherche);
+ },
+
+ creeConfig: function() {
+ return {
+ container: undefined,
+
+ criteres: {
+ nbColumn: 2,
+ fields: ['DateDebut', 'DateFin']
+ },
+
+ plusDeCriteres: {
+ nbColumn: 3,
+ fields: []
+ }
+ };
+ },
+
+ getInterface: function() {
+ return {
+ getItems: this.getItems.createDelegate(this),
+ getCriteres: this.getCriteres.createDelegate(this),
+ addListener: this.addListener.createDelegate(this)
+ };
+ },
+
+ getItems: function() {
+ return this.view.getItems();
+ },
+
+ cherche: function(criteres) {
+ this.fireEvent(this.Constantes.eventId.cherche, criteres);
+ },
+
+ getCriteres: function() {
+ return this.controller.getCriteres();
+ }
+
+});
\ No newline at end of file
--- /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>.
+ */
+
+Ext.ns('eliot.absences.saisie.commons.filter');
+
+eliot.absences.saisie.commons.filter.ConfigServeur = {
+
+ url: {
+ getEleves: undefined,
+ getParents: undefined
+ },
+
+ icon: {
+ chercher: undefined
+ },
+
+ libelle: {
+ tous: 'Tous',
+ toutes: 'Toutes',
+
+ periodeDebut: undefined,
+ periodeFin: undefined,
+ chercher: undefined,
+ plusDeCriteres: undefined,
+
+ lieu: undefined,
+ type: undefined,
+ typeProtagoniste: undefined,
+ profilClasse: undefined,
+ personne: undefined,
+
+ classes: undefined,
+ eleve: undefined,
+ responsable: undefined,
+ statut: undefined,
+
+
+ effectuee: undefined,
+ nonEffectuee: undefined
+
+ },
+
+ data: {
+ dateDebut: undefined,
+ dateFin: undefined,
+
+ anneeScolaire: {
+ debutAnneeScolaire: undefined,
+ finAnneeScolaire: undefined
+ },
+
+ etablissementId: undefined,
+
+ lieux: [],
+ types: [],
+ typesProtagoniste: [],
+ classes: [],
+ profils: [],
+ responsables: []
+
+ }
+
+};
\ No newline at end of file
--- /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>.
+ */
+
+Ext.ns('eliot.absences.saisie.commons.filter');
+
+eliot.absences.saisie.commons.filter.Constantes = {
+
+ eventId: {
+ change: 'change',
+ cherche: 'cherche'
+ },
+
+ typeProtagoniste: {
+ responsable: 0,
+ eleve: 1,
+ parent: 2
+ },
+
+ profil: {
+ direction: 1,
+ personnelEducation: 2,
+ enseignants: 3
+ },
+
+ statut: {
+ effectuee: 1,
+ nonEffectuee: 0
+ }
+
+};
\ No newline at end of file
--- /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>.
+ */
+
+Ext.ns('eliot.absences.saisie.commons.filter');
+
+eliot.absences.saisie.commons.filter.FilterController = Ext.extend(Ext.util.Observable, {
+
+ constructor: function(config) {
+ this.init(eliot.absences.saisie.commons.filter, config);
+ this.stores = {};
+
+ this.config.model.addListener({
+ change: function(value) {
+ this.onModelChange(value);
+ },
+ scope: this
+ });
+ this.value = Ext.apply({}, this.config.model.getValue());
+ },
+
+ init: function(ns, config) {
+ this.ns = ns;
+ this.Constantes = this.ns.Constantes;
+ this.ConfigServeur = this.ns.ConfigServeur;
+ this.config = Ext.apply(this.creeConfig(), config);
+ },
+
+ creeConfig: function() {
+ return {
+ model: undefined,
+ typeData: []
+ };
+ },
+
+ getInterface: function() {
+ return {
+ observeView: this.observeView.createDelegate(this),
+ getStore: this.getStore.createDelegate(this),
+ cherche: this.cherche.createDelegate(this),
+ getCriteres: this.getCriteres.createDelegate(this)
+ };
+ },
+
+ observeView: function(view) {
+ this.view = view;
+ },
+
+ cherche: function() {
+ var criteres = this.getCriteres();
+ this.config.composant.cherche(criteres);
+ },
+
+ getCriteres: function() {
+ var value = this.config.model.getValue();
+ var criteres = {
+ dateDebut: value.dateDebut,
+ dateFin: value.dateFin
+ };
+
+ if (value.lieux != null) {
+ var lieux = this.getModelListe('lieux');
+
+ if (lieux.length != 0) {
+ criteres.lieux = lieux;
+ }
+ }
+
+ if (value.types != null) {
+ var types = this.getModelListe('types');
+
+ if (types.length != 0) {
+ criteres.types = types;
+ }
+ }
+
+ if (value.eleves != null) {
+ var eleves = this.getModelListe('eleves');
+
+ if (eleves.length != 0) {
+ criteres.eleves = eleves;
+ }
+ }
+
+ if (value.typesProtagoniste != null) {
+ var typesProtagoniste = this.getModelListe('typesProtagoniste');
+
+ if (typesProtagoniste.length != 0) {
+ criteres.typesProtagoniste = typesProtagoniste;
+ }
+ }
+
+ if (value.statuts != null) {
+ var statuts = this.getModelListe('statuts');
+
+ if (statuts.length != 0) {
+ criteres.statuts = statuts;
+ }
+ }
+
+ if (value.responsables != null) {
+ var responsables = this.getModelListe('responsables');
+
+ if (responsables.length != 0) {
+ criteres.responsables = responsables;
+ }
+ }
+
+ if (value.classes != null) {
+ var classes = this.getModelListe('classes');
+
+ if (classes.length != 0) {
+ criteres.classes = classes;
+ }
+ }
+
+ if (value.personnes != null) {
+ var personnes = this.getModelListe('personnes');
+
+ if (personnes.length != 0) {
+ criteres.personnes = personnes;
+ }
+ }
+
+ if (value.profilsClasses != null) {
+ var profilsClasses = this.getModelListe('profilsClasses');
+ var classes = [];
+ var profils = [];
+
+ for (var i = 0; i < profilsClasses.length; i++) {
+ var profilClasse = profilsClasses[i];
+ var type = profilClasse.split('_')[0];
+
+ if (type == 'C') {
+ var classe = profilClasse.split('_')[1];
+ classes.push(classe);
+ }
+
+ if (type == 'P') {
+ var profil = profilClasse.split('_')[1];
+ profils.push(profil);
+ }
+ }
+
+ if (classes.length != 0) {
+ criteres.classes = classes;
+ }
+
+ if (profils.length != 0) {
+ criteres.profils = profils;
+ }
+ }
+
+ return criteres;
+ },
+
+ onModelChange: function(value) {
+
+ if (!this.compareList('typesProtagoniste')) {
+ this.value.typesProtagoniste = value.typesProtagoniste;
+ this.getStore('ProfilClasse').loadData(this.getProfilClasseData());
+ this.config.model.applyValue({profilsClasses: '-1'});
+
+ this.value.profilsClasses = value.profilsClasses;
+ this.updatePersonneData();
+ }
+
+ if (!this.compareList('profilsClasses')) {
+ this.value.profilsClasses = value.profilsClasses;
+ this.updatePersonneData();
+ }
+
+ if (!this.compareList('classes')) {
+ this.value.classes = value.classes;
+ this.updateEleveData();
+ }
+
+ this.value = Ext.apply({}, value);
+ },
+
+ getStore: function(name) {
+ if (this.stores[name] == null) {
+ var constructor = 'cree' + name + 'Store';
+
+ if (this[constructor] != null) {
+ this.stores[name] = this[constructor](name);
+ }
+
+ else {
+ this.stores[name] = new Ext.data.JsonStore({
+ fields: [
+ {name: 'id'},
+ {name: 'libelle'}
+ ]
+ });
+ }
+ }
+
+ return this.stores[name];
+ },
+
+ creeLieuStore: function() {
+ return new Ext.data.JsonStore({
+
+ data: this.initData(
+ this.ConfigServeur.data.lieux, this.ConfigServeur.libelle.tous),
+
+ fields: [
+ {name: 'id'},
+ {name: 'libelle'}
+ ]
+ });
+ },
+
+ creeTypeStore: function() {
+ return new Ext.data.JsonStore({
+
+ data: this.initData(
+ this.ConfigServeur.data.types, this.ConfigServeur.libelle.tous),
+
+ fields: [
+ {name: 'id'},
+ {name: 'libelle'}
+ ]
+ });
+ },
+
+ creeTypeProtagonisteStore: function() {
+ return new Ext.data.JsonStore({
+
+ data: this.initData(
+ this.ConfigServeur.data.typesProtagoniste, this.ConfigServeur.libelle.tous),
+
+ fields: [
+ {name: 'id'},
+ {name: 'libelle'}
+ ]
+ });
+ },
+
+ creeResponsableStore: function() {
+
+ var data = this.getResponsables(true, true, true);
+ data = this.sortItemsBy(data, 'libelle');
+
+ return new Ext.data.JsonStore({
+
+ data: this.initData(data, this.ConfigServeur.libelle.tous),
+
+ fields: [
+ {name: 'id'},
+ {name: 'libelle'}
+ ]
+ });
+ },
+
+ creePersonneStore: function() {
+
+ var data = this.getResponsables(true, true, true);
+ data = this.sortItemsBy(data, 'libelle');
+
+ return new Ext.data.JsonStore({
+
+ data: this.initData(data, this.ConfigServeur.libelle.tous),
+
+ fields: [
+ {name: 'id'},
+ {name: 'libelle'}
+ ]
+ });
+ },
+
+ sortItemsBy: function(data, name) {
+ return data.sort(function(a, b) {
+
+ if (a[name] > b[name]) {
+ return 1;
+ }
+ else if (a[name] < b[name]){
+ return -1;
+ }
+ return 0;
+
+ });
+ },
+
+ getResponsables: function(direction, personnelEducation, enseignants) {
+ var responsables = [];
+
+ if (direction == true) {
+ responsables = responsables.concat(this.ConfigServeur.data.responsables.direction);
+ }
+
+ if (personnelEducation == true) {
+ responsables = responsables.concat(this.ConfigServeur.data.responsables.personnelEducation);
+ }
+
+ if (enseignants == true) {
+ responsables = responsables.concat(this.ConfigServeur.data.responsables.enseignants);
+ }
+
+ return responsables;
+ },
+
+ creeClasseStore: function() {
+ return new Ext.data.JsonStore({
+
+ data: this.initData(
+ this.ConfigServeur.data.classes, this.ConfigServeur.libelle.toutes),
+
+ fields: [
+ {name: 'id'},
+ {name: 'libelle'}
+ ]
+ });
+ },
+
+ creeStatutStore: function() {
+ return new Ext.data.JsonStore({
+
+ data: this.initData(
+ [
+ {id: this.Constantes.statut.effectuee, libelle: this.ConfigServeur.libelle.effectuee},
+ {id: this.Constantes.statut.nonEffectuee, libelle: this.ConfigServeur.libelle.nonEffectuee}
+ ],
+ this.ConfigServeur.libelle.tous),
+
+ fields: [
+ {name: 'id'},
+ {name: 'libelle'}
+ ]
+ });
+ },
+
+ creeProfilClasseStore: function() {
+ var store = new Ext.data.JsonStore({
+ fields: [
+ {name: 'id'},
+ {name: 'libelle'}
+ ]
+ });
+ store.loadData(this.getProfilClasseData());
+ return store;
+ },
+
+ getProfilClasseData: function() {
+
+ var profils = true;
+ var classes = true;
+
+ var typesProtagoniste = this.getModelListe('typesProtagoniste');
+
+ if (typesProtagoniste.length != 0) {
+ profils = this.listContains(typesProtagoniste, this.Constantes.typeProtagoniste.responsable);
+
+ classes = this.listContains(typesProtagoniste, this.Constantes.typeProtagoniste.eleve) ||
+ this.listContains(typesProtagoniste, this.Constantes.typeProtagoniste.parent);
+ }
+
+ var data = [];
+
+ if (profils) {
+ for (var i = 0; i < this.ConfigServeur.data.profils.length; i++) {
+ var profil = this.ConfigServeur.data.profils[i];
+ data.push({
+ id: 'P_' + profil.id,
+ libelle: profil.libelle
+ });
+ }
+ }
+
+ if (classes){
+ for (var i = 0; i < this.ConfigServeur.data.classes.length; i++) {
+ var classe = this.ConfigServeur.data.classes[i];
+ data.push({
+ id: 'C_' + classe.id,
+ libelle: classe.libelle
+ });
+ }
+ }
+
+ return this.initData(data, this.ConfigServeur.libelle.tous);
+ },
+
+ updatePersonneData: function() {
+
+ var personnes = [];
+
+ var typesProtagoniste = this.getModelListe('typesProtagoniste');
+ var profilsClasses = this.getModelListe('profilsClasses');
+
+ var responsable = true;
+
+ if (typesProtagoniste.length > 0) {
+ responsable =
+ this.listContains(typesProtagoniste, this.Constantes.typeProtagoniste.responsable);
+ }
+
+ if (responsable == true) {
+
+ var direction = this.listContains(profilsClasses, 'P_' + this.Constantes.profil.direction);
+ var personnelEducation = this.listContains(profilsClasses, 'P_' + this.Constantes.profil.personnelEducation);
+ var enseignants = this.listContains(profilsClasses, 'P_' + this.Constantes.profil.enseignants);
+
+ personnes = personnes.concat(this.getResponsables(direction, personnelEducation, enseignants));
+ }
+
+ personnes = this.sortItemsBy(personnes, 'libelle');
+
+ this.getStore('Personne').loadData(this.initData(personnes, this.ConfigServeur.libelle.tous));
+ this.config.model.applyValue({personnes: '-1'});
+ this.view.enablePersonne(personnes.length != 0);
+
+ var classes = [];
+
+ for (var i = 0; i < profilsClasses.length; i++) {
+ var profilClasse = profilsClasses[i];
+ var type = profilClasse.split('_')[0];
+
+ if (type == 'C') {
+ var classe = profilClasse.split('_')[1];
+ classes.push(classe);
+ }
+ }
+
+ if (classes.length == 1) {
+ var classe = classes[0];
+
+ var eleve = true;
+ var parent = true;
+
+ if (typesProtagoniste.length != 0) {
+ eleve = this.listContains(typesProtagoniste, this.Constantes.typeProtagoniste.eleve);
+ parent = this.listContains(typesProtagoniste, this.Constantes.typeProtagoniste.parent);
+ }
+
+ if (eleve == true) {
+ Ext.Ajax.request({
+ url: this.ConfigServeur.url.getEleves,
+ params: {idStructureEnseignement: classe},
+ scope: this,
+
+ success: function(response) {
+ var reponse = Ext.decode(response.responseText);
+
+ personnes = personnes.concat(reponse);
+ personnes = this.sortItemsBy(personnes, 'libelle');
+
+ this.getStore('Personne').loadData(this.initData(personnes, this.ConfigServeur.libelle.tous));
+ this.config.model.applyValue({personnes: '-1'});
+ this.view.enablePersonne(personnes.length != 0);
+ }
+ });
+ }
+
+ if (parent == true) {
+ Ext.Ajax.request({
+ url: this.ConfigServeur.url.getParents,
+ params: {idStructureEnseignement: classe},
+ scope: this,
+
+ success: function(response) {
+ var reponse = Ext.decode(response.responseText);
+
+ personnes = personnes.concat(reponse);
+ personnes = this.sortItemsBy(personnes, 'libelle');
+
+ this.getStore('Personne').loadData(this.initData(personnes, this.ConfigServeur.libelle.tous));
+ this.config.model.applyValue({personnes: '-1'});
+ this.view.enablePersonne(personnes.length != 0);
+ }
+ });
+ }
+ }
+
+ },
+
+ updateEleveData: function() {
+
+ this.getStore('Eleve').loadData([]);
+ this.config.model.applyValue({eleves: '-1'});
+ this.view.enableEleve(false);
+
+ var classes = this.getModelListe('classes');
+
+ if (classes.length == 1) {
+ var classe = classes[0];
+
+ Ext.Ajax.request({
+ url: this.ConfigServeur.url.getEleves,
+ params: {idStructureEnseignement: classe},
+
+ success: function(response) {
+ var reponse = Ext.decode(response.responseText);
+ this.getStore('Eleve').loadData(this.initData(reponse, this.ConfigServeur.libelle.tous));
+ this.config.model.applyValue({eleves: '-1'});
+ this.view.enableEleve(true);
+ },
+
+ scope: this
+
+ });
+
+ }
+ },
+
+ initData: function(data, tous) {
+
+ if (data.length == 0) {
+ return [];
+ }
+
+ var result = [
+ {id: -1, libelle: tous}
+ ];
+
+ return result.concat(data);
+ },
+
+ listContains: function(list, value) {
+ for (var i = 0; i < list.length; i++) {
+ if (list[i] == value) {
+ return true;
+ }
+ }
+ return false;
+ },
+
+ compareList: function(name) {
+ var value = this.config.model.getValue();
+
+ return this.cleanStringList(value[name]) ==
+ this.cleanStringList(this.value[name]);
+ },
+
+ cleanStringList: function(stringList) {
+ if (stringList == null) {
+ return "-1";
+ }
+ var items = stringList.split(',');
+ items = this.removeTous(items);
+
+ if (items.length == 0) {
+ return '-1';
+ }
+ else {
+ items.sort;
+ return items.join(',');
+ }
+
+ },
+
+ getModelListe: function(name) {
+ var value = this.getModelValue(name);
+ value = this.cleanStringList(value);
+
+ if (value == -1) {
+ return [];
+ }
+ else {
+ return value.split(',');
+ }
+ },
+
+ getModelValue: function(name) {
+ return this.config.model.getValue()[name];
+ },
+
+ removeTous: function(list) {
+ var result = [];
+
+ for (var i = 0; i < list.length; i++) {
+ var item = list[i];
+ if (item == -1) {
+ return [];
+ }
+ else {
+ result.push(list[i]);
+ }
+ }
+
+ return result;
+ }
+
+});
\ No newline at end of file
--- /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>.
+ * @author onic
+ */
+
+Ext.ns('eliot.absences.saisie.commons.filter');
+
+eliot.absences.saisie.commons.filter.FilterModel = Ext.extend(Ext.util.Observable, {
+
+ constructor: function(value) {
+ this.init(eliot.absences.saisie.commons.filter, value);
+ this.addEvents(this.Constantes.eventId.change);
+ },
+
+ init: function(ns, value) {
+ this.ns = ns;
+ this.value = value;
+ this.Constantes = this.ns.Constantes;
+ this.ConfigServeur = this.ns.ConfigServeur;
+ },
+
+ applyValue: function(value) {
+ this.value = Ext.apply(this.value, value);
+ this.fireEvent(this.Constantes.eventId.change, this.value);
+ },
+
+ setValue: function(value) {
+ this.value = value;
+ this.fireEvent(this.Constantes.eventId.change, value);
+ },
+
+ getValue: function() {
+ return this.value;
+ }
+
+});
--- /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>.
+ */
+
+Ext.ns('eliot.absences.saisie.commons.filter');
+
+eliot.absences.saisie.commons.filter.FilterView = Ext.extend(Ext.util.Observable, {
+
+ constructor: function(config) {
+ this.init(eliot.absences.saisie.commons.filter, config);
+ this.creeItems();
+ },
+
+ init: function(ns, config) {
+ this.ns = ns;
+ this.Constantes = this.ns.Constantes;
+ this.ConfigServeur = this.ns.ConfigServeur;
+ this.config = Ext.apply(this.creeConfig(), config);
+ },
+
+ creeConfig: function() {
+ return {
+ model: undefined,
+ controller: undefined,
+ container: undefined
+ };
+ },
+
+ getInterface: function() {
+ return {
+ getItems: this.getItems.createDelegate(this),
+ enablePersonne: this.enablePersonne.createDelegate(this),
+ enableEleve: this.enableEleve.createDelegate(this)
+ };
+ },
+
+ getItems: function() {
+ return [this.panel];
+ },
+
+ creeItems: function() {
+ var criteres = this.creeColumnPanel(this.config.criteres);
+ criteres.region = 'center';
+
+ this.panel = new Ext.Panel({
+ frame: true,
+ bodyStyle: 'padding:5px 5px 0',
+ items: [
+ {
+ region: 'north',
+ layout: 'border',
+ height: criteres.height + 10,
+ items: [
+ criteres,
+ {
+ region: 'east',
+ layout: 'fit',
+ width: 210,
+ items: [
+ {
+ width: 210,
+ layout: 'column',
+ items: [
+ {
+ xtype: 'button',
+ width: 76,
+ style: "paddingLeft : 20px",
+ text: this.ConfigServeur.libelle.chercher,
+ icon: this.ConfigServeur.icon.chercher,
+ scope:this,
+ handler: function () {
+ this.config.controller.cherche();
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ region: 'center',
+ bodyStyle: 'padding:12px 5px 0',
+ items: [this.creePlusDeCriteres()]
+ }
+ ]
+ });
+ },
+
+ creePlusDeCriteres: function() {
+ if (this.config.plusDeCriteres.fields.length == 0) {
+ return {};
+ }
+
+ return {
+ xtype: 'fieldset',
+ title: this.ConfigServeur.libelle.plusDeCriteres,
+ collapsible: true,
+ collapsed: true,
+ bodyStyle: 'padding:5x 5px 0;',
+ listeners: {
+ collapse:function () {
+ var panel = Ext.getCmp(this.config.container);
+ if (panel != null) {
+ panel.doLayout();
+ }
+ },
+ expand:function () {
+ var panel = Ext.getCmp(this.config.container);
+ if (panel != null) {
+ panel.doLayout();
+ }
+ },
+ scope: this
+ },
+ items:[this.creeColumnPanel(this.config.plusDeCriteres)]
+ };
+
+ },
+
+ creeColumnPanel: function(config) {
+ var panel = {
+ layout:'column',
+ height: 0,
+ items: []
+ };
+
+ for (var i = 0; i < config.nbColumn; i++) {
+ panel.items.push({
+ layout: 'form',
+ labelAlign: 'right',
+ width: 0,
+ labelWidth: 0,
+ items: []
+ });
+ }
+
+ var columnIndex = 0;
+ for (var i = 0; i < config.fields.length; i++) {
+ if (columnIndex == 0) {
+ panel.height += 28;
+ }
+
+ var column = panel.items[columnIndex];
+ this.addField(column, config.fields[i]);
+ columnIndex = columnIndex < config.nbColumn - 1 ? columnIndex + 1 : 0;
+ }
+
+ return panel;
+ },
+
+ addField: function(column, name) {
+ var constructor = 'cree' + name + 'Field';
+
+ var item = {
+ width: 0,
+ labelWidth: 0,
+ item: {
+ height: 26
+
+ }
+ };
+
+ if (this[constructor] != null) {
+ item = this[constructor](name);
+ }
+
+ column.width = Math.max(column.width, item.width);
+ column.labelWidth = Math.max(column.labelWidth, item.labelWidth);
+
+ column.items.push(item.item);
+ },
+
+ creeDateDebutField: function() {
+ var view = new eliot.absences.consultation.DateView({
+ label: this.ConfigServeur.libelle.periodeDebut,
+ date: this.config.model.getValue().dateDebut,
+ anneeScolaire: this.ConfigServeur.data.anneeScolaire
+ });
+
+ view.addListener(eliot.absences.consultation.Constantes.eventId.actionDateChange,
+ function(value) {
+ this.config.model.applyValue({dateDebut: value})
+ }, this);
+
+ return {
+ width: 270,
+ labelWidth: 110,
+ item: view.date
+ };
+ },
+
+ creeDateFinField: function() {
+ var view = new eliot.absences.consultation.DateView({
+ label: this.ConfigServeur.libelle.periodeFin,
+ date: this.config.model.getValue().dateFin,
+ anneeScolaire: this.ConfigServeur.data.anneeScolaire
+ });
+
+ view.addListener(eliot.absences.consultation.Constantes.eventId.actionDateChange,
+ function(value) {
+ this.config.model.applyValue({dateFin: value})
+ }, this);
+
+ return {
+ width: 270,
+ labelWidth: 110,
+ item: view.date
+ };
+ },
+
+ creeLieuField: function() {
+ var view = new eliot.absences.consultation.LovComboView({
+ store: this.config.controller.getStore('Lieu'),
+ label: this.ConfigServeur.libelle.lieu,
+ width: 180
+ });
+
+ view.addListener(eliot.absences.consultation.Constantes.eventId.actionValeurChange,
+ function(value) {
+ this.config.model.applyValue({lieux: value})
+ }, this);
+
+ return {
+ width: 250,
+ labelWidth: 60,
+ item: view.lovCombo
+ };
+ },
+
+ creeTypeField: function() {
+ var view = new eliot.absences.consultation.LovComboView({
+ store : this.config.controller.getStore('Type'),
+ label : this.ConfigServeur.libelle.type,
+ width: 180
+ });
+
+ view.addListener(eliot.absences.consultation.Constantes.eventId.actionValeurChange,
+ function(value) {
+ this.config.model.applyValue({types: value})
+ }, this);
+
+ return {
+ width: 250,
+ labelWidth: 60,
+ item: view.lovCombo
+ };
+ },
+
+ creeEleveField: function() {
+ var view = new eliot.absences.consultation.LovComboView({
+ store: this.config.controller.getStore('Eleve'),
+ label: this.ConfigServeur.libelle.eleve,
+ disabled: true,
+ width: 180
+ });
+
+ view.addListener(eliot.absences.consultation.Constantes.eventId.actionValeurChange,
+ function(value) {
+ this.config.model.applyValue({eleves: value})
+ }, this);
+
+ this.eleveLovCombo = view.lovCombo;
+
+ return {
+ width: 250,
+ labelWidth: 60,
+ item: view.lovCombo
+ };
+ },
+
+ creeTypeProtagonisteField: function() {
+ var view = new eliot.absences.consultation.LovComboView({
+ store: this.config.controller.getStore('TypeProtagoniste'),
+ label: this.ConfigServeur.libelle.typeProtagoniste,
+ width: 180
+ });
+
+ view.addListener(eliot.absences.consultation.Constantes.eventId.actionValeurChange,
+ function(value) {
+ this.config.model.applyValue({typesProtagoniste: value})
+ }, this);
+
+ return {
+ width: 310,
+ labelWidth: 120,
+ item: view.lovCombo
+ };
+ },
+
+ creeStatutField: function() {
+ var view = new eliot.absences.consultation.LovComboView({
+ store: this.config.controller.getStore('Statut'),
+ label: this.ConfigServeur.libelle.statut,
+ width: 180
+ });
+
+ view.addListener(eliot.absences.consultation.Constantes.eventId.actionValeurChange,
+ function(value) {
+ this.config.model.applyValue({statuts: value})
+ }, this);
+
+ return {
+ width: 250,
+ labelWidth: 60,
+ item: view.lovCombo
+ };
+ },
+
+ creeResponsableField: function() {
+ var view = new eliot.absences.consultation.LovComboView({
+ store: this.config.controller.getStore('Responsable'),
+ label: this.ConfigServeur.libelle.responsable,
+ width: 180
+ });
+
+ view.addListener(eliot.absences.consultation.Constantes.eventId.actionValeurChange,
+ function(value) {
+ this.config.model.applyValue({responsables: value})
+ }, this);
+
+ return {
+ width: 280,
+ labelWidth: 90,
+ item: view.lovCombo
+ };
+ },
+
+ creeProfilClasseField: function() {
+ var view = new eliot.absences.consultation.LovComboView({
+ store: this.config.controller.getStore('ProfilClasse'),
+ label: this.ConfigServeur.libelle.profilClasse,
+ width: 180
+ });
+
+ view.addListener(eliot.absences.consultation.Constantes.eventId.actionValeurChange,
+ function(value) {
+ this.config.model.applyValue({profilsClasses: value})
+ }, this);
+
+ return {
+ width: 280,
+ labelWidth: 90,
+ item: view.lovCombo
+ };
+ },
+
+ creeClasseField: function() {
+ var view = new eliot.absences.consultation.LovComboView({
+ store: this.config.controller.getStore('Classe'),
+ label: this.ConfigServeur.libelle.classe,
+ width: 180
+ });
+
+ view.addListener(eliot.absences.consultation.Constantes.eventId.actionValeurChange,
+ function(value) {
+ this.config.model.applyValue({classes: value})
+ }, this);
+
+ return {
+ width: 240,
+ labelWidth: 50,
+ item: view.lovCombo
+ };
+ },
+
+ creePersonneField: function() {
+ var view = new eliot.absences.consultation.LovComboView({
+ store: this.config.controller.getStore('Personne'),
+ label: this.ConfigServeur.libelle.personne,
+ width: 180
+ });
+
+ view.addListener(eliot.absences.consultation.Constantes.eventId.actionValeurChange,
+ function(value) {
+ this.config.model.applyValue({personnes: value})
+ }, this);
+
+ this.personneLovCombo = view.lovCombo;
+
+ return {
+ width: 260,
+ labelWidth: 70,
+ item: view.lovCombo
+ };
+ },
+
+ enablePersonne: function(enabled) {
+ if (enabled) {
+ this.personneLovCombo.enable();
+ }
+ else {
+ this.personneLovCombo.disable();
+ }
+ },
+
+ enableEleve: function(enabled) {
+ if (enabled) {
+ this.eleveLovCombo.enable();
+ }
+ else {
+ this.eleveLovCombo.disable();
+ }
+ }
+
+
+});
);
var Constantes = eliot.absences.saisie.incidents.Constantes;
+ this.Constantes = Constantes;
var Modele = eliot.absences.saisie.incidents.Modele;
boutonsAAJouter : new Array(boutonExporterView.bouton)
});
+ var filter = this.creeFilter();
var incidentController = new eliot.absences.saisie.incidents.
- IncidentController();
+ IncidentController(filter);
var incidentView = new eliot.absences.commons.GridConsultationView({
store : incidentController.store,
boutonExportController.observeComposantActiveExport(incidentController);
boutonExportController.observeComposantDesactiveExport(incidentController);
-
var centerRegionItems = [
{
layout : 'border',
frame : false,
border : false,
items : [
+ {
+ region : 'north',
+ autoHeight : true,
+ border: false,
+ frame : false,
+ items : filter.getItems()
+ },
{
region : 'center',
id: Constantes.regionId.center,
// Supprime la progresse bar
eliot.absences.commons.Utils.supprimeLoadMask(250);
+ },
+
+ creeFilter: function() {
+ var filter =
+ new eliot.absences.saisie.commons.filter.Composant({
+
+ container: this.Constantes.regionId.centerPanel,
+
+ plusDeCriteres: {
+ nbColumn: 3,
+ fields: [
+ 'Lieu', 'Type', '',
+ 'TypeProtagoniste', 'ProfilClasse', 'Personne'
+ ]
+ }
+
+
+ }).getInterface();
+
+ filter.addListener(eliot.absences.saisie.commons.filter.Constantes.eventId.cherche,
+ function(criteres) {
+ // TODO ; Implémenter la recherche
+ }, this);
+
+ return filter;
}
});
Ext.ns('eliot.absences.saisie.incidents');
eliot.absences.saisie.incidents.IncidentController = Ext.extend(Ext.util.Observable, {
- constructor: function() {
+ constructor: function(filter) {
this.NameSpace = eliot.absences.saisie.incidents;
var toolBarEventsId = eliot.absences.commons.CUDToolbarViewConstantes.eventId;
this.BoutonExportEventsId = eliot.exportdonnees.BoutonExportControllerConstantes.eventId;
this.params = {
start: 0,
limit: this.NameSpace.Modele.data.nombreLignesParPage,
- sortInfo: Ext.encode(this.sortInfo)
+ sortInfo: Ext.encode(this.sortInfo),
+ criteres: Ext.encode(filter.getCriteres())
};
});
this.observeStore();
+ this.observeFilter(filter);
+ },
+ observeFilter: function(filter) {
+ filter.addListener(eliot.absences.saisie.commons.filter.Constantes.eventId.cherche,
+ function(criteres) {
+ this.store.baseParams.criteres = Ext.encode(criteres);
+ this.store.load();
+ }, this);
},
observeStore : function() {
);
this.NameSpace = eliot.absences.saisie.punitions;
-
+ this.Constantes = this.NameSpace.Constantes;
/****************************** Bouton exporter **********************************/
var boutonExporterView = new eliot.exportdonnees.BoutonExportView({});
boutonsAAJouter : new Array(boutonExporterView.bouton)
});
+ var filter = this.creeFilter();
+
// Création du controller principal de la vue
- var punitionController = new this.NameSpace.PunitionController();
+ 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({
frame : false,
border : false,
items : [
+ {
+ region : 'north',
+ autoHeight : true,
+ border: false,
+ frame : false,
+ items : filter.getItems()
+ },
{
region : 'center',
id: this.NameSpace.Constantes.regionId.center,
// Supprime la progresse bar
eliot.absences.commons.Utils.supprimeLoadMask(250);
+ },
+
+ creeFilter: function() {
+ var filter =
+ new eliot.absences.saisie.commons.filter.Composant({
+
+ container: this.Constantes.regionId.centerPanel,
+
+ plusDeCriteres: {
+ nbColumn: 3,
+ fields: [
+ 'Classe', 'Eleve', '',
+ 'Responsable', 'Type', 'Statut'
+ ]
+ }
+
+
+ }).getInterface();
+
+ return filter;
}
});
Ext.ns('eliot.absences.saisie.punitions');
eliot.absences.saisie.punitions.PunitionController = Ext.extend(Ext.util.Observable, {
- constructor: function() {
+ constructor: function(filter) {
this.Constantes = eliot.absences.saisie.punitions.Constantes;
this.Modele = eliot.absences.saisie.punitions.Modele;
var toolBarEventsId = eliot.absences.commons.
this.params = {
start: 0,
limit: this.Modele.data.nombreLignesParPage,
- sortInfo: Ext.encode(this.sortInfo)
+ sortInfo: Ext.encode(this.sortInfo),
+ criteres: Ext.encode(filter.getCriteres())
};
});
this.observeStore();
+ this.observeFilter(filter);
+ },
+
+ observeFilter: function(filter) {
+ filter.addListener(eliot.absences.saisie.commons.filter.Constantes.eventId.cherche,
+ function(criteres) {
+ this.store.baseParams.criteres = Ext.encode(criteres);
+ this.store.load();
+ }, this);
},
observeStore : function() {
);
this.NameSpace = eliot.absences.saisie.sanctions;
-
+ this.Constantes = this.NameSpace.Constantes;
/****************************** Bouton exporter **********************************/
var boutonExporterView = new eliot.exportdonnees.BoutonExportView({});
boutonsAAJouter : new Array(boutonExporterView.bouton)
});
+ var filter = this.creeFilter();
+
// Création du controller principal de la vue
- var sanctionController = new this.NameSpace.SanctionController();
+ var sanctionController = new this.NameSpace.SanctionController(filter);
// Création de la grille qui contient la toolBar de CUD
var sanctionView = new eliot.absences.commons.GridConsultationView({
/*************************************************************************************/
-
var centerRegionItems = [
{
layout : 'border',
frame : false,
border : false,
items : [
+ {
+ region : 'north',
+ autoHeight : true,
+ border: false,
+ frame : false,
+ items : filter.getItems()
+ },
{
region : 'center',
id: this.NameSpace.Constantes.regionId.center,
// Supprime la progresse bar
eliot.absences.commons.Utils.supprimeLoadMask(250);
+ },
+
+ creeFilter: function() {
+ var filter =
+ new eliot.absences.saisie.commons.filter.Composant({
+
+ container: this.Constantes.regionId.centerPanel,
+
+ plusDeCriteres: {
+ nbColumn: 3,
+ fields: [
+ 'Classe', 'Eleve', '',
+ 'Responsable', 'Type', 'Statut'
+ ]
+ }
+
+
+ }).getInterface();
+
+ filter.addListener(eliot.absences.saisie.commons.filter.Constantes.eventId.cherche,
+ function(criteres) {
+ // TODO ; Implémenter la recherche
+ }, this);
+
+ return filter;
}
});
Ext.ns('eliot.absences.saisie.sanctions');
eliot.absences.saisie.sanctions.SanctionController = Ext.extend(Ext.util.Observable, {
- constructor: function() {
+ 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.params = {
start: 0,
limit: this.Modele.data.nombreLignesParPage,
- sortInfo: Ext.encode(this.sortInfo)
+ sortInfo: Ext.encode(this.sortInfo),
+ criteres: Ext.encode(filter.getCriteres())
};
});
this.observeStore();
+ this.observeFilter(filter);
+ },
+
+ observeFilter: function(filter) {
+ filter.addListener(eliot.absences.saisie.commons.filter.Constantes.eventId.cherche,
+ function(criteres) {
+ this.store.baseParams.criteres = Ext.encode(criteres);
+ this.store.load();
+ }, this);
},
observeStore : function() {