Rev 17410 | Rev 17420 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
17410 | guerimand | 1 | !! make a progress bar for exam |
2 | !! for the moment only compatible for course mode |
||
3 | !! wims_read_parm is list of score for each exercise (-1=noscore) |
||
4 | !! output : wims_progressbar |
||
5 | !! if $wims_read_parm is empty list of score is calculated |
||
6 | |||
7 | !if $wims_read_parm!=$empty |
||
8 | progressbar_=$wims_read_parm |
||
9 | !goto html |
||
10 | !endif |
||
11 | |||
12 | !! ---- calculate list of score only work for exam in course mode |
||
13 | wims_pses=!translate _ to , in $wims_session |
||
14 | t_=!replace internal exam by $empty in $(wims_pses[2]) |
||
15 | t_=!replace internal t by , in $t_ |
||
16 | !distribute item $t_ into bl,bl,exo_ |
||
17 | pos_=!positionof item $exo_ in $(wims_exrandomlist[1;]) |
||
18 | !if $pos_>1 |
||
19 | progressbar_=!values 10 for v=1 to $[$pos_-1] |
||
20 | !else |
||
21 | !reset progressbar_ |
||
22 | !endif |
||
17419 | guerimand | 23 | sco_=$module_score |
17410 | guerimand | 24 | !default sco_=-1 |
25 | progressbar_=!append item $sco_ to $progressbar_ |
||
26 | tmp_=!itemcnt $(wims_exrandomlist[1;]) |
||
27 | !if $pos_<$tmp_ |
||
28 | tmp_=!values -1 for v=$[$pos_+1] to $tmp_ |
||
29 | progressbar_=!append item $tmp_ to $progressbar_ |
||
30 | !endif |
||
31 | |||
32 | :html |
||
33 | wims_progressbar=<div class="inline wims_score_bar"> |
||
34 | !for i_ in $progressbar_ |
||
35 | !if $i_=10 |
||
36 | wims_progressbar=$wims_progressbar <div class="inline wims_seed_item" style="background-color:blue" title="$i_"></div> |
||
37 | !else |
||
38 | !if $i_=-1 |
||
39 | wims_progressbar=$wims_progressbar <div class="inline wims_seed_item" style="background-color:#FFF" title="todo"></div> |
||
40 | !else |
||
41 | wims_progressbar=$wims_progressbar <div class="inline wims_seed_item" style="background-color:red" title="$i_"></div> |
||
42 | !endif |
||
43 | !endif |
||
44 | !next i_ |
||
45 | wims_progressbar=$wims_progressbar </div> |
||
46 | !!debug $wims_progressbar |