/*
Copyright (C) 2001, 2002 Loc Dayot
EPNadmin - Version 0.5.1 - 01/10/2002
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
http://epnadmin.pierrefitte93.fr/
*/
// Function crite en JavaScript
// Quand l'usager rpond aux questions prcises sur les connaissances,
// le niveau est ajust automatiquement et fonction
// du nombre de rponses oui, non, doute...
function autoeval(id_session)
{
nboui = 0
nbnon = 0;
nbdoute = 0;
nb=0;
chaine ='rponse_'+id_session+'_';
for (i=0;i<document.formulaire.length; i++)
{
obj = document.formulaire.elements[i];
if ((obj.name.substring(0,10)==chaine.substring(0,10)) && (obj.checked))
{
switch (obj.value)
{
case 'oui' : nboui++; break;
case 'non' : nbnon++; break;
default : nbdoute++; break;
}
nb++;
}
}
switch (nboui)
{
case 0 :
val = 'dbutant(e)';
break;
case 1 : if (nbdoute+nbnon==0)
val='initi(e)';
else
val = 'dbutant(e)';
break;
case 2 : if (nbnon>=2)
val = 'dbutant(e)';
else
val = 'initi(e)';
break;
default : if (nbnon>0)
if (nbnon+nbdoute<nboui)
val = 'initi(e)';
else
val = 'dbutant(e)';
else if (nbdoute==1)
val = 'initi(e)';
else
val = 'avanc(e)';
break;
}
//alert(nbnon+' '+nbdoute+' '+nboui+' '+val);
chaine ='niveau';
for (i=0;i<document.formulaire.length; i++)
{
obj = document.formulaire.elements[i];
chaine0 = obj.name + "_";
if (chaine0.substring(0,5)==chaine.substring(0,5))
{
if (obj.value==val)
obj.checked = true;
else
obj.checked = false;
}
}
}