« Dyris » : différence entre les versions

Aller à la navigation Aller à la recherche
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 3 : Ligne 3 :
Cet outil utilise JavaScript pour rendre le QCM dynamique.
Cet outil utilise JavaScript pour rendre le QCM dynamique.


Astuce pour que les sélections sur les cases à cocher et sur les boutons radios soit plus pratique ; un clic sur le libellé, agit sur l'élément :
Astuce pour que les sélections sur les cases à cocher et sur les boutons radios soit plus pratique ; un clic sur le libellé agit sur l'élément :
* ajout de la balise <code><label></code> pour encadrer le code de la balise <code><input></code>
* ajout de la balise <code><label></code> pour encadrer le code de la balise <code><input></code>


Code avant modification
Code avant modification, ligne 50, page d'affichage des thèmes :
 
 
<pre>
<pre>
function afficher_themes() {
function afficher_themes() {
var i;
      ...
var ch='<div class="cadre"><h2>'+txt.titre[0]+'</h2>';
      for (i=0;i<mod.th.length;i++) {
if (opt.mode_presentation=="1") {
        ch+='<input type="checkbox" name="case'+i+'" onclick="p1_choisir_themes();"';
for (i=0;i<mod.th.length;i++) {
        if (mod.th[i].choisi=="oui") ch+=' checked';
ch+='<input type="checkbox" name="case'+i+'" onclick="p1_choisir_themes();"';
        ch+='>&nbsp;&nbsp;'+mod.th[i].titre+'<br>';
if (mod.th[i].choisi=="oui") ch+=' checked';
      }
ch+='>&nbsp;&nbsp;'+mod.th[i].titre+'<br>';
      ch+='<input type="checkbox" name="tous" onclick="p1_choisir_themes();">&nbsp;&nbsp;'+txt.mot[0];
}
  }
ch+='<input type="checkbox" name="tous" onclick="p1_choisir_themes();">&nbsp;&nbsp;'+txt.mot[0];
  else {
}
      ch+='<input type="radio" name="ch_th" checked>&nbsp;&nbsp;'+mod.th[0].titre+'<br>';
else {
      for (i=1;i<mod.th.length;i++) {
ch+='<input type="radio" name="ch_th" checked>&nbsp;&nbsp;'+mod.th[0].titre+'<br>';
        ch+='<input type="radio" name="ch_th"';
for (i=1;i<mod.th.length;i++) {
        if (mod.th[i].choisi=="oui") ch+=' checked';
ch+='<input type="radio" name="ch_th"';
        ch+='>&nbsp;&nbsp;'+mod.th[i].titre+'<br>';
if (mod.th[i].choisi=="oui") ch+=' checked';
      }
ch+='>&nbsp;&nbsp;'+mod.th[i].titre+'<br>';
  }
}
}
ch+='</div>';
return ch;
}
 
function afficher_nb_questions() {
var ch='<div class="cadre"><h2>'+txt.titre[1]+'</h2>';
ch+='<input type="radio" name="ch_nb" checked>&nbsp;&nbsp;'+opt.nb_questions[0]+' '+txt.mot[1]+'<br>';
for (var i=1;i<opt.nb_questions.length;i++) {
ch+='<input type="radio" name="ch_nb"';
if (cont.nb_quest_choisi==opt.nb_questions[i]) ch+=' checked';
ch+='>&nbsp;&nbsp;'+opt.nb_questions[i]+' '+txt.mot[1]+'<br>';
}
ch+='</div>';
return ch;
</pre>
</pre>


Test en ligne 122, pour les cases à cocher des exercices
Code après modification, ligne 50, page d'affichage des thèmes :
<pre>
<pre>
  if (mod.th[a].quest[b].type=="cases a cocher") {
function afficher_themes() {
       var k=0;
       ...
       for (i=0;i<c;i++) {
       for (i=0;i<mod.th.length;i++) {
        k=num[i];
        ch+='<label><input type="checkbox" name="case'+i+'" onclick="p1_choisir_themes();"';
        ch+='<input type="checkbox" name="case'+k+'">&nbsp;&nbsp;';
        if (mod.th[i].choisi=="oui") ch+=' checked';
        ch+=mod.th[a].quest[b].rep[k].enonce+'<br>';
        ch+='>&nbsp;'+mod.th[i].titre+'</label><br />';
       }
       }
      ch+='<label><input type="checkbox" name="tous" onclick="p1_choisir_themes();">&nbsp;'+txt.mot[0]+'</label>';
   }
   }
  else {
      ch+='<label><input type="radio" name="ch_th" checked>&nbsp;&nbsp;'+mod.th[0].titre+'<br />';
      for (i=1;i<mod.th.length;i++) {
        ch+='<input type="radio" name="ch_th"';
        if (mod.th[i].choisi=="oui") ch+=' checked';
        ch+='>&nbsp;'+mod.th[i].titre+'</label><br />';
        ...
</pre>
</pre>


Boucle en ligne 143, pour les boutons radios des exercices
Code avant modification, ligne 68, fonction d'affichage du nombre de questions :
<pre>
<pre>
      for (i=0;i<c;i++) {
function afficher_nb_questions() {
        ch+='<input type="radio" name="ch_rep">&nbsp;&nbsp;';
  var ch='<div class="cadre"><h2>'+txt.titre[1]+'</h2>';
        ch+=mod.th[a].quest[b].rep[i].enonce+'<br />';
  ch+='<input type="radio" name="ch_nb" checked>&nbsp;&nbsp;'+opt.nb_questions[0]+' '+txt.mot[1]+'<br />';
      }
  for (var i=1;i<opt.nb_questions.length;i++) {
      ch+='<input type="radio" name="ch_nb"';
      if (cont.nb_quest_choisi==opt.nb_questions[i]) ch+=' checked';
      ch+='>&nbsp;&nbsp;'+opt.nb_questions[i]+' '+txt.mot[1]+'<br />';
  }
  ch+='</div>';
  return ch;
}
</pre>
</pre>


Code après modification :
Code après modification, ligne 68, fonction d'affichage du nombre de questions :
<pre>
<pre>
function afficher_themes() {
function afficher_nb_questions() {
var i;
  var ch='<div class="cadre"><h2>'+txt.titre[1]+'</h2>';
var ch='<div class="cadre"><h2>'+txt.titre[0]+'</h2>';
  ch+='<label><input type="radio" name="ch_nb" checked>&nbsp;&nbsp;'+opt.nb_questions[0]+' '+txt.mot[1]+'</label><br />';
if (opt.mode_presentation=="1") {
  for (var i=1;i<opt.nb_questions.length;i++) {
for (i=0;i<mod.th.length;i++) {
      ch+='<label><input type="radio" name="ch_nb"';
ch+='<label><input type="checkbox" name="case'+i+'" onclick="p1_choisir_themes();"';
      if (cont.nb_quest_choisi==opt.nb_questions[i]) ch+=' checked';
if (mod.th[i].choisi=="oui") ch+=' checked';
      ch+='>&nbsp;&nbsp;'+opt.nb_questions[i]+' '+txt.mot[1]+'</label><br />';
ch+='>&nbsp;'+mod.th[i].titre+'</label><br />';
  }
}
  ch+='</div>';
ch+='<label><input type="checkbox" name="tous" onclick="p1_choisir_themes();">&nbsp;'+txt.mot[0]+'</label>';
  return ch;
}
else {
ch+='<label><input type="radio" name="ch_th" checked>&nbsp;&nbsp;'+mod.th[0].titre+'<br />';
for (i=1;i<mod.th.length;i++) {
ch+='<input type="radio" name="ch_th"';
if (mod.th[i].choisi=="oui") ch+=' checked';
ch+='>&nbsp;'+mod.th[i].titre+'</label><br />';
}
}
ch+='</div>';
return ch;
}
}
</pre>


function afficher_nb_questions() {
Code avant modification, ligne 122, fonction d'affichage des questions :
var ch='<div class="cadre"><h2>'+txt.titre[1]+'</h2>';
<pre>
ch+='<label><input type="radio" name="ch_nb" checked>&nbsp;&nbsp;'+opt.nb_questions[0]+' '+txt.mot[1]+'</label><br />';
  if (mod.th[a].quest[b].type=="cases a cocher") {
for (var i=1;i<opt.nb_questions.length;i++) {
      var k=0;
ch+='<label><input type="radio" name="ch_nb"';
      for (i=0;i<c;i++) {
if (cont.nb_quest_choisi==opt.nb_questions[i]) ch+=' checked';
        k=num[i];
ch+='>&nbsp;&nbsp;'+opt.nb_questions[i]+' '+txt.mot[1]+'</label><br />';
        ch+='<input type="checkbox" name="case'+k+'">&nbsp;&nbsp;';
}
        ch+=mod.th[a].quest[b].rep[k].enonce+'<br />';
ch+='</div>';
      }
return ch;
  }
}
</pre>
</pre>


Test en ligne 122, pour les cases à cocher des exercices
Code après modification, ligne 122, fonction d'affichage des questions et cases à cocher :
<pre>
<pre>
   if (mod.th[a].quest[b].type=="cases a cocher") {
   if (mod.th[a].quest[b].type=="cases a cocher") {
Ligne 115 : Ligne 101 :
</pre>
</pre>


Boucle en ligne 143, pour les boutons radios des exercices
Code avant modification, ligne 143, fonction d'affichage des questions et boutons radios :
<pre>
      for (i=0;i<c;i++) {
        ch+='<input type="radio" name="ch_rep">&nbsp;&nbsp;';
        ch+=mod.th[a].quest[b].rep[i].enonce+'<br />';
      }
</pre>
 
Code après modification, ligne 143, fonction d'affichage des questions et boutons radios :
<pre>
<pre>
       for (i=0;i<c;i++) {
       for (i=0;i<c;i++) {

Version du 22 janvier 2018 à 11:56

Dyris est un outil pour créer des QCM (questionnaire à choix multiples) en ligne.

Cet outil utilise JavaScript pour rendre le QCM dynamique.

Astuce pour que les sélections sur les cases à cocher et sur les boutons radios soit plus pratique ; un clic sur le libellé agit sur l'élément :

  • ajout de la balise <label> pour encadrer le code de la balise <input>

Code avant modification, ligne 50, page d'affichage des thèmes :

function afficher_themes() {
      ...
      for (i=0;i<mod.th.length;i++) {
         ch+='<input type="checkbox" name="case'+i+'" onclick="p1_choisir_themes();"';
         if (mod.th[i].choisi=="oui") ch+=' checked';
         ch+='>  '+mod.th[i].titre+'<br>';
      }
      ch+='<input type="checkbox" name="tous" onclick="p1_choisir_themes();">  '+txt.mot[0];
   }
   else {
      ch+='<input type="radio" name="ch_th" checked>  '+mod.th[0].titre+'<br>';
      for (i=1;i<mod.th.length;i++) {
         ch+='<input type="radio" name="ch_th"';
         if (mod.th[i].choisi=="oui") ch+=' checked';
         ch+='>  '+mod.th[i].titre+'<br>';
      }
   }

Code après modification, ligne 50, page d'affichage des thèmes :

function afficher_themes() {
      ...
      for (i=0;i<mod.th.length;i++) {
         ch+='<label><input type="checkbox" name="case'+i+'" onclick="p1_choisir_themes();"';
         if (mod.th[i].choisi=="oui") ch+=' checked';
         ch+='> '+mod.th[i].titre+'</label><br />';
      }
      ch+='<label><input type="checkbox" name="tous" onclick="p1_choisir_themes();"> '+txt.mot[0]+'</label>';
   }
   else {
      ch+='<label><input type="radio" name="ch_th" checked>  '+mod.th[0].titre+'<br />';
      for (i=1;i<mod.th.length;i++) {
         ch+='<input type="radio" name="ch_th"';
         if (mod.th[i].choisi=="oui") ch+=' checked';
         ch+='> '+mod.th[i].titre+'</label><br />';
         ...

Code avant modification, ligne 68, fonction d'affichage du nombre de questions :

function afficher_nb_questions() {
   var ch='<div class="cadre"><h2>'+txt.titre[1]+'</h2>';
   ch+='<input type="radio" name="ch_nb" checked>  '+opt.nb_questions[0]+' '+txt.mot[1]+'<br />';
   for (var i=1;i<opt.nb_questions.length;i++) {
      ch+='<input type="radio" name="ch_nb"';
      if (cont.nb_quest_choisi==opt.nb_questions[i]) ch+=' checked';
      ch+='>  '+opt.nb_questions[i]+' '+txt.mot[1]+'<br />';
   }
   ch+='</div>';
   return ch;
}

Code après modification, ligne 68, fonction d'affichage du nombre de questions :

function afficher_nb_questions() {
   var ch='<div class="cadre"><h2>'+txt.titre[1]+'</h2>';
   ch+='<label><input type="radio" name="ch_nb" checked>  '+opt.nb_questions[0]+' '+txt.mot[1]+'</label><br />';
   for (var i=1;i<opt.nb_questions.length;i++) {
      ch+='<label><input type="radio" name="ch_nb"';
      if (cont.nb_quest_choisi==opt.nb_questions[i]) ch+=' checked';
      ch+='>  '+opt.nb_questions[i]+' '+txt.mot[1]+'</label><br />';
   }
   ch+='</div>';
   return ch;
}

Code avant modification, ligne 122, fonction d'affichage des questions :

   if (mod.th[a].quest[b].type=="cases a cocher") {
      var k=0;
      for (i=0;i<c;i++) {
         k=num[i];
         ch+='<input type="checkbox" name="case'+k+'">  ';
         ch+=mod.th[a].quest[b].rep[k].enonce+'<br />';
      }
   }

Code après modification, ligne 122, fonction d'affichage des questions et cases à cocher :

   if (mod.th[a].quest[b].type=="cases a cocher") {
      var k=0;
      for (i=0;i<c;i++) {
         k=num[i];
         ch+='<label><input type="checkbox" name="case'+k+'">  ';
         ch+=mod.th[a].quest[b].rep[k].enonce+'</label><br />';
      }
   }

Code avant modification, ligne 143, fonction d'affichage des questions et boutons radios :

      for (i=0;i<c;i++) {
         ch+='<input type="radio" name="ch_rep">  ';
         ch+=mod.th[a].quest[b].rep[i].enonce+'<br />';
      }

Code après modification, ligne 143, fonction d'affichage des questions et boutons radios :

      for (i=0;i<c;i++) {
         ch+='<label><input type="radio" name="ch_rep">  ';
         ch+=mod.th[a].quest[b].rep[i].enonce+'</label><br />';
      }