%%Le source de cet exercice a été créé à l'aide de Quicktool
%%Le type de l'exercice est QCM.
%% Vous pouvez le modifier si vous désirez l'adapter.
%% Mon Dec 22 11:15:38 2008

###################
\title{Expressions idiomatiques}
\author{Csilla Ducrocq}
\email{csilla.ducrocq@u-psud.fr}
\language{fr}
\computeanswer{no}
\format{html}
\text{file=expressions}
\text{notepad=slib(utilities/notepad Notepad,small)}
\text{instruction=asis(Choisissez la signification de l'expression idiomatique.)}
\text{instruction2=asis()}
\text{choice=}
\text{common=}
\text{audio_file=no}
\text{reading_file=no}
\text{image_file=no}
\text{video_file=no}
\text{alea=yes}
\text{size=}
\text{partialscore=split}
\text{percent=1}
\text{aucune=aucune de ces possibilités}
\text{format=checkbox}
\text{specialhelp1=}
\text{specialhelp2=}
\text{specialhelp3=}
\text{helpprompt=}
\text{reaccent=}
\text{style_question=background-color: #FFFFCC;margin: 2% 2%;padding: 1%;}
\text{style_reponse=background-color: #FFCC99;color: black;margin: 2% 2%;padding: 0%;}
\text{style_oef=}
\text{style_css=ol li {list-style: upper-alpha; }}
\text{paste=yes}
\text{pos_rep=inside}
\text{second_step=yes}
\text{first_step=1}
\text{answer_given=}
\text{try=}
\text{packs=fra}
\text{player=player}
\text{player_option=}
#####################

\text{file0=randitem(\file)}
\integer{cnt_question= wims(recordcnt \file0)}

################
\text{MAX=1}
\text{N=1}
\text{M=3}
################
\text{autocompletion=\format iswordof case ? autocomplete=off}
\text{player=wims(replace internal - by in \player)}
\text{specialhelp=\specialhelp1,\specialhelp2,\specialhelp3}
\text{helpprompt=\helpprompt = ?++>}
\integer{first_step=\first_step notwordof 0 ? 1}
\text{option_reaccent=\reaccent!=yes ? noreaccent:}
\text{nopaste=\paste issametext no ? slib(utilities/nopaste )}

\text{instruction=\instruction issametext ? wims(getdef instruction in \file0)}
\text{instruction2=\instruction2 issametext ? wims(getdef instruction2 in \file0)}
\text{size=\size issametext ? wims(getdef size in \file0)}
\text{reading_file=\reading_file issametext ? wims(getdef reading_file in \file0)}
\text{reading = wims(record 0 of \reading_file)}

\text{audio_file = \audio_file issametext ? wims(getdef audio_file in \file0)}
\text{audio=\audio_file notsametext  and  \audio_file notsametext no? 
<p align="center">slib(media/audio \imagedir/\audio_file,player=\player)</p>}

\text{image_file=\image_file issametext ? wims(getdef image_file in \file0)}
\text{image=\image_file notsametext  and  \image_file notsametext no? 
wims(makelist <img src=\imagedir/x> for x in \image_file)}

\text{video_file=\video_file issametext ? wims(getdef video_file in \file0)}
\if{\video_file notsametext  and  \video_file notsametext no}{ 
  \text{video_file=http notin \video_file ? \imagedir/\video_file}
\text{video=\video_file notsametext ? <a wims_target=external href="\video_file">[video] </a></p>}
}
\text{choix=\choice issametext ? wims(getdef choice in \file0):\choice}

\text{style = <style type="text/css">
 .question {\style_question}
 .reponse {\style_reponse}
 .oefstatement{\style_oef}
 \style_css
 </style>
 }

\text{try =\try notwordof 1 2 3 4 5 6 7 8 9 10 ? 1}
\text{size=\format iswordof dragfill clickfill ? \size x 1}
\integer{N = min(\cnt_question,\N)}
\integer{MAX=min(\N*\MAX,\cnt_question)}
\text{battage=\alea issametext yes ? shuffle(\cnt_question) :
wims(makelist x for x = 1 to \cnt_question)}
     
\text{qcm_prompt1=Votre réponse :}
\text{qcm_prompt2=La bonne réponse :}
\text{good_answer_text=Bonne réponse}
\text{bad_answer_text=Mauvaise réponse}
\text{incomplete_answer_text=Réponse incomplète}
\text{option=}
\matrix{question=}
\matrix{explication=}
\matrix{rep=}
\text{CNT_choix= }
\matrix{CHOIX=}
\text{PRELIMINAIRE=}
\for{i= 1 to \MAX}{
 \text{QUEST=wims(record \battage[\i] of \file)}
 \text{preliminaire_test=\QUEST}
 \text{preliminaire_test=row(1,\preliminaire_test)}
 \text{inst_audio=wims(getopt audio in \preliminaire_test)}
 \text{inst_image=wims(getopt image in \preliminaire_test)}
 \text{inst_title=wims(getopt title in \preliminaire_test)}
 \text{inst_intro=wims(getopt intro in \preliminaire_test)}
 \text{test_inst=\inst_audio\inst_image\inst_title\inst_intro  notsametext ? 1 : 0}
 \text{rab_inst=}
 \text{rab_inst=\inst_title notsametext ?\rab_inst<p align="center">\inst_title</p>}
 \text{rab_inst=\inst_intro notsametext ?\rab_inst \inst_intro}
 \text{rab_inst=\inst_image notsametext ? \rab_inst <p align="center"><img src=\imagedir/\inst_image></p>}
 \if{\inst_audio notsametext }{
     \text{rab_inst1= . isin \inst_audio or \packs= ? 
       slib(media/audio \imagedir/\inst_audio,\player_option,player=\player):slib(lang/swac \inst_audio,\packs,player=\player,\player_option)}
     \text{rab_inst=\rab_inst <p align="center">\rab_inst1[1;1]</p>}
   }
 \text{preliminaire=\test_inst=1  ? \rab_inst:&nbsp;}
 \text{QUEST=\test_inst=1 ? wims(line 2 to -1 of \QUEST)}
  \matrix{QUEST=wims(embraced randitem \QUEST)}
  \matrix{question = \question
  \QUEST[1;]}
  \matrix{PRELIMINAIRE=\PRELIMINAIRE
  \preliminaire}
  \text{expl=\QUEST[2;]}
  \text{ligne=wims(upper \expl)}
  \text{ligne=wims(text select ABCDEFGHIJKLMNOPQRSTUVWXYZ in \ligne)}
  \if{\ligne issametext and \expl notsametext }{
  \matrix{explication = \explication ;
  }
  \integer{debut = 2}
 }
 \if{\ligne issametext and \expl issametext }{
  \matrix{explication = \explication ;
  }
  \integer{debut = 3}
  }
  \if{\ligne notsametext}{
     \matrix{explication = \explication
  \expl}
  \integer{debut = 3}
 }
  \integer{cnt_choix=rows(\QUEST)-\debut}
  \text{CNT_choix=\CNT_choix,\cnt_choix}
   \text{Choix=}
   \text{mix=shuffle(\cnt_choix)}
   \for{ j=\debut+1 to \cnt_choix + \debut+1}{
     \text{choix= \QUEST[\j;]}
     \text{choix=wims(replace internal , by  &#44; in \choix)}
     \matrix{Choix = \Choix, \choix[1;]}
   }
   \text{Choix=wims(nonempty items \Choix)}
   \text{Choix= \Choix[\mix]}
   \matrix{CHOIX=\CHOIX
     \Choix}
   \text{H = wims(nospace \QUEST[\debut;])}
   \text{cnt_c=items(\H)}
   \text{Rep = }
   \for{ k = 1 to \cnt_c}{ 
     \text{Rep = \Rep, position(\H[\k],\mix)}
   }
   \text{Rep = wims(sort items wims(nonempty items \Rep))}
   \matrix{rep = \rep
    \Rep}
}

\text{CNT_choix=wims(nonempty items \CNT_choix)}

\text{U = pari(divrem(\MAX,\N)~)}
\integer{cnt_step = \U[1] + 1}
\matrix{STEPS = }
\matrix{CNT = }
\text{CONDSTEP=}
\for{ u = 1 to \cnt_step -1}{
   \matrix{STEPS =\STEPS
wims(makelist r x for x = \N*\u -\N+1 to \N*\u)}
   \matrix{CNT =\CNT
wims(makelist x for x = \N*\u -\N+1 to \N*\u)}
   \text{condstep= wims(values \u+1 for x = (\u-1)*\N +1 to \u*\N)}
   \text{CONDSTEP= wims(append item \condstep to \CONDSTEP)}
}
 \matrix{STEPS = \STEPS
 wims(makelist r x  for x = \N*\cnt_step-\N+1 to \MAX)
}
\matrix{CNT = \CNT
 wims(makelist x  for x = \N*\cnt_step-\N+1 to \MAX)
}
\text{CONDSTEP=\CONDSTEP, wims(values \cnt_step+1  for x = \N*\cnt_step-\N+1 to \MAX)}

\text{nstep=\STEPS[1;]}
\text{TEST=}
text{testexp=wims(rows2lines \explication)}
text{testexp=wims(lines2items \testexp)}
text{testexp=wims(items2words \testexp)}
text{testexp=wims(nospace \testexp)}
\nextstep{\nstep}
\text{REP=}
\text{etape=wims(values x * \N for x = 1 to \cnt_step+1)}
\text{CONDITION = wims(makelist x for x = 1 to 2*\MAX)}
\text{CONDITION =wims(items2words \CONDITION)}
\conditions{\CONDITION}
\integer{cnt_juste=0}
\real{v = 10}
\statement{\nopaste
\style\instruction
\if{\reading notsametext }{\special{help reading,[à lire]}}
\if{\image notsametext }{\special{help image,[à regarder]}}
\audio\video
 \for{h=1 to \etape[\step]}{\PRELIMINAIRE[\h;]
   \if{(\h <= \etape[\step] - \N or r \h isitemof \nstep) and \question[\h;] notsametext }{
     <p>\if{\cnt_step > 1 and \N > 1}{\h : } \question[\h;]</p>
   }
   \if{\h <= \etape[\step] - \N and \question[\h;] notsametext}{
    <div class="reponse">
      \qcm_prompt1
       \for{ a in \REP[\h;]}{
         \if{ \a  isitemof \CHOIX[\h;\rep[\h;]]}{
           \if{\TEST[\h;2]>0 and \TEST[\h;3]=0}{
           <font color="navy"><b>\a</b></font>}
           {<font color="green"><b>\a</b></font>}
           }
         {
         <font color="red"><b><strike>\a</strike></b></font>} - }
         \if{\TEST[\h;2]>0 and \TEST[\h;3]=0}{
                   <font color="navy">\incomplete_answer_text
          </font>}
         \if{\TEST[\h;3]>0}{<font color="red">\bad_answer_text</font>}
         \if{\TEST[\h;3]=0 and \TEST[\h;2]=0}{<font color="green">\good_answer_text</font>}
         \if{\answer_given=yes}{
         <br> \qcm_prompt2 <font color=green><b>\CHOIX[\h;\rep[\h;]]</font></b>}
      \if{\explication[\h;] notsametext }{<br>\explication[\h;]}     
     </div>
   }
   { \if{ r \h isitemof \nstep}{
      <div class="question">
   <ol>
      \for{s=1 to \CNT_choix[\h]}{ <li>\embed{reply \h , \s}</li> }
      </ol>
      </div>
      }
   }
     </ol>
  }
 }
\answer{}{\REP1;\CHOIX[1;]}{type=\format}{option=\option}
\answer{}{\REP2;\CHOIX[2;]}{type=\format}{option=\option}
\answer{}{\REP3;\CHOIX[3;]}{type=\format}{option=\option}
\answer{}{\REP4;\CHOIX[4;]}{type=\format}{option=\option}
\answer{}{\REP5;\CHOIX[5;]}{type=\format}{option=\option}
\answer{}{\REP6;\CHOIX[6;]}{type=\format}{option=\option}
\answer{}{\REP7;\CHOIX[7;]}{type=\format}{option=\option}
\answer{}{\REP8;\CHOIX[8;]}{type=\format}{option=\option}
\answer{}{\REP9;\CHOIX[9;]}{type=\format}{option=\option}
\answer{}{\REP10;\CHOIX[10;]}{type=\format}{option=\option}
\answer{}{\REP11;\CHOIX[11;]}{type=\format}{option=\option}
\answer{}{\REP12;\CHOIX[12;]}{type=\format}{option=\option}
\answer{}{\REP13;\CHOIX[13;]}{type=\format}{option=\option}
\answer{}{\REP14;\CHOIX[14;]}{type=\format}{option=\option}
\answer{}{\REP15;\CHOIX[15;]}{type=\format}{option=\option}
\answer{}{\REP16;\CHOIX[16;]}{type=\format}{option=\option}
\answer{}{\REP17;\CHOIX[17;]}{type=\format}{option=\option}
\answer{}{\REP18;\CHOIX[18;]}{type=\format}{option=\option}
\answer{}{\REP19;\CHOIX[19;]}{type=\format}{option=\option}
\answer{}{\REP20;\CHOIX[20;]}{type=\format}{option=\option}

\matrix{REP = \REP1
\REP2
\REP3
\REP4
\REP5
\REP6
\REP7
\REP8
\REP9
\REP10
\REP11
\REP12
\REP13
\REP14
\REP15
\REP16
\REP17
\REP18
\REP19
\REP20}
\if{\format=radio}{
 \text{REP=wims(replace internal , by  &#44; in \REP)}
}
\matrix{explication2 = \explication2}

\for{u = 1 to \N}{
   \text{H = \CNT[\step-1;\u]}
   \text{test1 = wims(listuniq \REP[\H;],\CHOIX[\H;\rep[\H;]])}
   \integer{test1 = items(\test1)-items(\CHOIX[\H;\rep[\H;]])}
   \text{test2 = wims(listcomplement \REP[\H;] in \CHOIX[\H;\rep[\H;]])}
   \text{test3 = wims(listcomplement \CHOIX[\H;\rep[\H;]] in \REP[\H;])}
  %%% \integer{test4=items(\REP[\H;]) - items(\CHOIX[\H;])}
   \text{test_cnt=\test1, items(\test2),items(\test3)}    
   \integer{cnt_juste= \test_cnt[1]+\test_cnt[2]+\test_cnt[3] =0 ? \cnt_juste + 1}
   \matrix{TEST=\TEST
   \test_cnt}
}

test1 = 0 rep < juste
test2  nombre de réponses dites justes et en fait fausses
test3  nombre de réponses dites fausses et en fait justes

totalement justes : test1=0, test2=0 test3=0
partiellement justes : 

\real{v=\cnt_juste/\CNT[\step-1;\N]}

\text{nstep = \v >= \percent ? \STEPS[\step;]:}

\condition{Question 1 : \REP1}{\TEST[1;3]=0}{option=hide}
\condition{Question 1 : \REP1}{\TEST[1;1]=0 and \TEST[1;2]=0 and \TEST[1;3]=0}{option=hide}
\condition{Question 2 : \REP2}{\TEST[2;3]=0 and \step >=\CONDSTEP[2]}{option=hide}
\condition{Question 2 : \REP2}{\TEST[2;1]=0 and \TEST[2;2]=0 and \TEST[2;3]=0 and \step >=\CONDSTEP[2]}{option=hide}
\condition{Question 3 : \REP3}{\TEST[3;3]=0 and \step >=\CONDSTEP[3]}{option=hide}
\condition{Question 3 : \REP3}{\TEST[3;1]=0 and \TEST[3;2]=0 and \TEST[3;3]=0 and \step >=\CONDSTEP[3]}{option=hide}
\condition{Question 4 : \REP4}{\TEST[4;3]=0 and \step >=\CONDSTEP[4]}{option=hide}
\condition{Question 4 : \REP4}{\TEST[4;1]=0 and \TEST[4;2]=0 and \TEST[4;3]=0 and \step >=\CONDSTEP[4]}{option=hide}
\condition{Question 5 : \REP5}{\TEST[5;3]=0 and \step >=\CONDSTEP[5]}{option=hide}
\condition{Question 5 : \REP5}{\TEST[5;1]=0 and \TEST[5;2]=0 and \TEST[5;3]=0 and \step >=\CONDSTEP[5]}{option=hide}
\condition{Question 6 : \REP6}{\TEST[6;3]=0 and \step >=\CONDSTEP[6]}{option=hide}
\condition{Question 6 : \REP6}{\TEST[6;1]=0 and \TEST[6;2]=0 and \TEST[6;3]=0 and \step >=\CONDSTEP[6]}{option=hide}
\condition{Question 7 : \REP7}{\TEST[7;3]=0 and \step >=\CONDSTEP[7]}{option=hide}
\condition{Question 7 : \REP7}{\TEST[7;1]=0 and \TEST[7;2]=0 and \TEST[7;3]=0 and \step >=\CONDSTEP[7]}{option=hide}
\condition{Question 8 : \REP8}{\TEST[8;3]=0 and \step >=\CONDSTEP[8]}{option=hide}
\condition{Question 8 : \REP8}{\TEST[8;1]=0 and \TEST[8;2]=0 and \TEST[8;3]=0 and \step >=\CONDSTEP[8]}{option=hide}
\condition{Question 9 : \REP9}{\TEST[9;3]=0 and \step >=\CONDSTEP[9]}{option=hide}
\condition{Question 9 : \REP9}{\TEST[9;1]=0 and \TEST[9;2]=0 and \TEST[9;3]=0 and \step >=\CONDSTEP[9]}{option=hide}
\condition{Question 10 : \REP10}{\TEST[10;3]=0 and \step >=\CONDSTEP[10]}{option=hide}
\condition{Question 10 : \REP10}{\TEST[10;1]=0 and \TEST[10;2]=0 and \TEST[10;3]=0 and \step >=\CONDSTEP[10]}{option=hide}
\condition{Question 11 : \REP11}{\TEST[11;3]=0 and \step >=\CONDSTEP[11]}{option=hide}
\condition{Question 11 : \REP11}{\TEST[11;1]=0 and \TEST[11;2]=0 and \TEST[11;3]=0 and \step >=\CONDSTEP[11]}{option=hide}
\condition{Question 12 : \REP12}{\TEST[12;3]=0 and \step >=\CONDSTEP[12]}{option=hide}
\condition{Question 12 : \REP12}{\TEST[12;1]=0 and \TEST[12;2]=0 and \TEST[12;3]=0 and \step >=\CONDSTEP[12]}{option=hide}
\condition{Question 13 : \REP13}{\TEST[13;3]=0 and \step >=\CONDSTEP[13]}{option=hide}
\condition{Question 13 : \REP13}{\TEST[13;1]=0 and \TEST[13;2]=0 and \TEST[13;3]=0 and \step >=\CONDSTEP[13]}{option=hide}
\condition{Question 14 : \REP14}{\TEST[14;3]=0 and \step >=\CONDSTEP[14]}{option=hide}
\condition{Question 14 : \REP14}{\TEST[14;1]=0 and \TEST[14;2]=0 and \TEST[14;3]=0 and \step >=\CONDSTEP[14]}{option=hide}
\condition{Question 15 : \REP15}{\TEST[15;3]=0 and \step >=\CONDSTEP[15]}{option=hide}
\condition{Question 15 : \REP15}{\TEST[15;1]=0 and \TEST[15;2]=0 and \TEST[15;3]=0 and \step >=\CONDSTEP[15]}{option=hide}
\condition{Question 16 : \REP16}{\TEST[16;3]=0 and \step >=\CONDSTEP[16]}{option=hide}
\condition{Question 16 : \REP16}{\TEST[16;1]=0 and \TEST[16;2]=0 and \TEST[16;3]=0 and \step >=\CONDSTEP[16]}{option=hide}
\condition{Question 17 : \REP17}{\TEST[17;3]=0 and \step >=\CONDSTEP[17]}{option=hide}
\condition{Question 17 : \REP17}{\TEST[17;1]=0 and \TEST[17;2]=0 and \TEST[17;3]=0 and \step >=\CONDSTEP[17]}{option=hide}
\condition{Question 18 : \REP18}{\TEST[18;3]=0 and \step >=\CONDSTEP[18]}{option=hide}
\condition{Question 18 : \REP18}{\TEST[18;1]=0 and \TEST[18;2]=0 and \TEST[18;3]=0 and \step >=\CONDSTEP[18]}{option=hide}
\condition{Question 19 : \REP19}{\TEST[19;3]=0 and \step >=\CONDSTEP[19]}{option=hide}
\condition{Question 19 : \REP19}{\TEST[19;1]=0 and \TEST[19;2]=0 and \TEST[19;3]=0 and \step >=\CONDSTEP[19]}{option=hide}
\condition{Question 20 : \REP20}{\TEST[20;3]=0 and \step >=\CONDSTEP[20]}{option=hide}
\condition{Question 20 : \REP20}{\TEST[20;1]=0 and \TEST[20;2]=0 and \TEST[20;3]=0 and \step >=\CONDSTEP[20]}{option=hide}


\text{test=wims(rows2lines \explication)}
\text{test=wims(lines2items \test)}
\text{test=wims(items2words \test)}
\text{test=wims(nospace \test)}
feedback{1=1}{
   \if{\test notsametext}{
     <div class="reponse"><ol>
      \for{w = 1 to \MAX}{
        \if{\explication[\w;] notsametext }
         {<li style="list-style:decimal;" value=\w>\explication[\w;] </li>}
     }
     </ol>
    </div>
  }
}
{<ol>
  \for{ t = 1 to \N}{
    \if{\CNT[\step;\t] != }{
  <li style="list-style:decimal;" value=\CNT[\step;\t]> <b>\question[\N*(\step-1) + \t;]</b>
  <div class="question"><ol>
   \for{s=1 to \CNT_choix[\N*(\step-1) + \t]}{
   <li>\embed{\STEPS[\step;\t] , \s }</li>
    }
   </ol>
   </div>
   </li>}
 }
</ol>
}     
