Rev 13477 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
11375 | bpr | 1 | type=imaudio |
13705 | obado | 2 | textarea="data instruction" |
3 | iEdit="instruction" |
||
4 | |||
5 | :Answer to choose from a list of images |
||
7114 | bpr | 6 | <p> |
13705 | obado | 7 | To build an exercise with this model, just type the list of images and their characterization. |
8 | This characterization can be put in the statement with the word |
||
9 | <span class="tt wims_code_variable">\name</span>. |
||
10 | 170/5000 |
||
11 | If you want to put an image appearing as disruptive without definition, |
||
12 | do not put any characterization. |
||
13 | Several images can have the same characterization. |
||
7114 | bpr | 14 | </p> |
13477 | obado | 15 | <p class="wims_credits"> |
11544 | obado | 16 | Author of the model: Bernadette Perrin-Riou <bpr@math.u-psud.fr> |
7114 | bpr | 17 | </p> |
7300 | bpr | 18 | |
7114 | bpr | 19 | :%%%%%%%%%%%%%%%%% ATTENTION %%%%%%%%%%%%%%%%%%%% |
20 | |||
11544 | obado | 21 | Remove the above header if you destroy the model tags! (The lines starting |
22 | with a ':'.) Otherwise the exercise might not be taken back by Createxo. |
||
7114 | bpr | 23 | |
11544 | obado | 24 | :%%%%%%%% Sample parameters to be redefined %%%%%%%%%%%%%%%%% |
7114 | bpr | 25 | |
13705 | obado | 26 | :\title{Click on the correct form(s)} |
7114 | bpr | 27 | :\author{Bernadette, Perrin-Riou} |
28 | :\email{bpr@math.u-psud.fr} |
||
29 | :\credits{} |
||
13477 | obado | 30 | |
31 | :Data |
||
13705 | obado | 32 | The images can either be in the exercise |
33 | (then simply put the name of the image, do not forget to load them in the exercise), |
||
34 | or in an image data module (see the example). |
||
35 | \text{data=modules/data/images/imgschool.fr/images/abeille.png, bee |
||
36 | modules/data/images/imgschool.fr/images/ange.png, angel |
||
37 | modules/data/images/imgschool.fr/images/araignee.png, spider |
||
38 | modules/data/images/imgschool.fr/images/aubergine.png, eggplant |
||
39 | modules/data/images/imgschool.fr/images/ananas.png, pineapple |
||
7114 | bpr | 40 | } |
41 | |||
13705 | obado | 42 | :Amount of displayed images |
7300 | bpr | 43 | |
7114 | bpr | 44 | \integer{cnt=4} |
7300 | bpr | 45 | |
13705 | obado | 46 | :Image height (in pixels) |
7300 | bpr | 47 | |
7114 | bpr | 48 | \text{sizev=100} |
7300 | bpr | 49 | |
7114 | bpr | 50 | :%%%%%%%%%%%%%% |
13477 | obado | 51 | do not put ; in sizev |
13355 | bpr | 52 | \if{\sizev notsametext }{ |
53 | \text{sizev= style="height:wims(nospace \sizev px)"} |
||
7114 | bpr | 54 | } |
7300 | bpr | 55 | \text{data=wims(embraced randitem \data)} |
56 | \text{tot=rows(\data)} |
||
57 | \text{name=} |
||
58 | \while{\name issametext }{ |
||
59 | \text{mot = randrow(\data)} |
||
60 | \text{name=\mot[2]} |
||
61 | } |
||
7114 | bpr | 62 | \text{image=\mot[1]} |
63 | \text{ext=item(2,wims(replace internal . by , in wims(lowercase \image)))} |
||
64 | |||
13477 | obado | 65 | :Instructions |
13705 | obado | 66 | Here \name represents the second item of the image that will be clicked. |
67 | \text{instruction=Click on the \name and submit.} |
||
7114 | bpr | 68 | |
69 | :%%%%%%%%%%%%%% |
||
13705 | obado | 70 | \css{<style>table.ans_multipleclick {margin-left:auto;margin-right:auto}</style>} |
7300 | bpr | 71 | \text{liste=column(1,\data)} |
72 | \text{listename=column(2,\data)} |
||
73 | \text{rep=position(\name,\listename)} |
||
74 | \text{perturb=wims(makelist x for x=1 to \tot)} |
||
7114 | bpr | 75 | \text{perturb=shuffle(\perturb)} |
7300 | bpr | 76 | \text{perturb=\perturb[1..\cnt]} |
7350 | bpr | 77 | \text{inter=wims(listintersection \rep and \perturb)} |
78 | \if{\inter=}{ |
||
79 | \integer{repcnt=items(\rep)} |
||
80 | \text{rep= \repcnt >1 ? randitem(\rep)} |
||
7300 | bpr | 81 | \text{perturb=\rep,\perturb[1..\cnt-1]} |
82 | \text{perturb=shuffle(\perturb)} |
||
83 | } |
||
84 | \matrix{data=\data} |
||
85 | \text{liste=\data[\perturb;1]} |
||
86 | \text{listename=\data[\perturb;2]} |
||
7350 | bpr | 87 | \text{cnt=items(\liste)} |
7114 | bpr | 88 | \text{Image=} |
89 | \for{j=1 to \cnt}{ |
||
90 | \text{Image=/ isin \liste[\j] ? wims(append item \liste[\j] to \Image): |
||
91 | wims(append item \imagedir/\liste[\j] to \Image)} |
||
92 | } |
||
13355 | bpr | 93 | \text{liste=wims(makelist imgrename(x \sizev) for x in \Image)} |
7300 | bpr | 94 | \text{rep=position(\name,\listename)} |
13705 | obado | 95 | |
7114 | bpr | 96 | \statement{ |
13705 | obado | 97 | <div class="instruction">\instruction</div> |
98 | <div>\embed{r1}</div> |
||
7114 | bpr | 99 | } |
13705 | obado | 100 | |
7300 | bpr | 101 | \answer{}{\rep;\liste}{type=multipleclick}{option=shuffle} |