Subversion Repositories wimsdev

Rev

Rev 17423 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
17420 bpr 1
!! make a progress bar for exam
17410 guerimand 2
!! for the moment only compatible for course mode
17420 bpr 3
!! wims_read_parm is list of scores for each exercise (-1=noscore)
17410 guerimand 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
17431 guerimand 13
pses_=!translate _ to , in $wims_session
14
t_=!replace internal exam by $empty in $(pses_[2])
17420 bpr 15
t_=!replace internal t by , in $t_
17423 guerimand 16
!distribute item $t_ into bl,exam_,exo_
17420 bpr 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
23
sco_=$module_score
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_
17423 guerimand 30
  wims_examnextexo=$(wims_exrandomlist[1;$pos_+1])
31
!else
32
  !reset wims_examnextexo
17420 bpr 33
!endif
17410 guerimand 34
 
35
:html
36
wims_progressbar=<div class="inline wims_score_bar">
37
!for i_ in $progressbar_
38
  !if $i_=10
39
    wims_progressbar=$wims_progressbar <div class="inline wims_seed_item" style="background-color:blue" title="$i_"></div>
40
  !else
41
    !if $i_=-1
42
      wims_progressbar=$wims_progressbar <div class="inline wims_seed_item" style="background-color:#FFF" title="todo"></div>
43
    !else
44
      wims_progressbar=$wims_progressbar <div class="inline wims_seed_item" style="background-color:red" title="$i_"></div>
45
    !endif
46
  !endif
47
!next i_
48
wims_progressbar=$wims_progressbar </div>