--- /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.commun');
+
+eliot.commun.LinkedHashMap = function() {
+ this.array = [];
+ this.map = {};
+}
+eliot.commun.LinkedHashMap.prototype = {
+ constructor : eliot.commun.LinkedHashMap,
+ /**
+ */
+ hs : function(key, value) {
+ var key = key || null, value = value || null, me = this;
+ if(key == null) {
+ if(value != null) {
+ for(var p in me.map) {
+ if(me.map[p] == value) {
+ return true;
+ }
+ }
+ }
+ } else {
+ if( key in me.map) {
+ return true;
+ }
+ }
+ return false;
+ },
+ /**
+ */
+ ad : function(key, value) {
+ var value = value || null;
+ var key = key || null;
+ var me = this;
+ if(key == null) {
+ return;
+ }
+ if( key in me.map) {
+ me.map[key] = value;
+ } else {
+ me.array.push(key);
+ me.map[key] = value;
+ }
+ },
+ /**
+ */
+ rm : function(key) {
+ var key = key || null;
+ var me = this;
+ if( key in me.map) {
+ delete me.map[key];
+ for(var i = 0; i < me.array.length; i++) {
+ if(me.array[i] == key) {
+ me.array.splice(i, 1);
+ break;
+ }
+ }
+ }
+ },
+ /**
+ */
+ rmTill : function(key) {
+ var me = this, delIndex = -1;
+ for(var i = 0; i < me.array.length; i++) {
+ if(me.array[i] == key) {
+ delIndex = i;
+ break;
+ }
+ }
+ if(delIndex > -1) {
+ for(var i = 0; i <= delIndex; i++) {
+ delete me.map[me.array[i]];
+ }
+ me.array.splice(0, delIndex + 1);
+ }
+ },
+ /**
+ */
+ rmFrom : function(key) {
+ var me = this;
+ for(var i = 0; i < me.array.length; i++) {
+ if(me.array[i] == key) {
+ delIndex = i;
+ break;
+ }
+ }
+ if(delIndex > -1) {
+ for(var i = delIndex; i < me.array.length; i++) {
+ delete me.map[me.array[i]];
+ }
+ me.array.splice(delIndex, me.array.length - delIndex);
+ }
+ },
+ /**
+ */
+ size : function() {
+ return this.array.length;
+ },
+ /**
+ */
+ each : function(fn, scope) {
+ var me = this;
+ var scope = scope || window;
+ var fn = fn || null;
+ if(fn == null || typeof (fn) != "function") {
+ return;
+ }
+ for(var i = 0; i < me.array.length; i++) {
+ var key = me.array[i];
+ var value = me.map[key];
+ var re = fn.call(scope, key, value, i, me.array, me.map);
+ if(re == false) {
+ break;
+ }
+ }
+ },
+ /**
+ */
+ get : function(key) {
+ return this.map[key];
+ },
+ /**
+ */
+ sort : function(compare) {
+ var me = this;
+ me.array.sort(compare);
+ }
+};
+
}
// trouver les plages de l'appel
- var plagesAppelInfos = {};
+ var plagesAppelInfos = new eliot.commun.LinkedHashMap();
if (largeurAppel > 1){
plagesAppelInfos = this.findPlagesAppel(index, largeurAppel);
}
storeAbsences.each(
function(dataAbsence){
if (dataAbsence.get('eleveId') == record.get('eleveId')){
- for (var idPlageAppel in plagesAppelInfos){
- var absenceSurPlageAppel = dataAbsence.get("plage"+idPlageAppel);
- if (absenceSurPlageAppel != ""){
- // ce sera la cellule correspondant à la dernière plage de l'appel
- // contenant une absence qui sera affichée,
- plageId = idPlageAppel;
- plageOuverte = plagesAppelInfos[idPlageAppel];
- }
- }
+ plagesAppelInfos.each(function(key, value, order){
+ var absenceSurPlageAppel = dataAbsence.get("plage"+key);
+ if (absenceSurPlageAppel != ""){
+ // ce sera la cellule correspondant à la dernière plage de l'appel
+ // contenant une absence qui sera affichée,
+ plageId = key;
+ plageOuverte = plagesAppelInfos.get(key);
+ }
+ }, this);
}
}
);
},
findPlagesAppel: function(indexAppel, largeurAppel){
- var plagesAppelInfos = {};
+ var plagesAppelInfos = new eliot.commun.LinkedHashMap();
var placePremierePlageAppel, placeDernierePlageAppel = indexAppel - 1;
placePremierePlageAppel = indexAppel - largeurAppel;
for (var i = placePremierePlageAppel; i <= placeDernierePlageAppel; ++i){
var plageAppel = this.storePlagesHoraires.getAt(i);
- plagesAppelInfos[plageAppel.id] = plageAppel.get('ouvert');
+ plagesAppelInfos.ad(plageAppel.id, plageAppel.get('ouvert'));
}
return plagesAppelInfos;