Subversion Repositories wimsdev

Rev

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

Rev Author Line No. Line
23 reyssat 1
# Variable calculations should be done in this file.
2
# It is read and interpreted by wims for all valid calls to the module.
7720 bpr 3
!readproc adm/whoconnect
23 reyssat 4
wims_prefix=class user tmp n sharing sharable
5
!read adm/class/authchars
8255 bpr 6
max_sheets=!defof MAX_SHEETS in wimshome/public_html/bases/sys/define.conf
23 reyssat 7
title_limit=80
8
desc_limit=4000
10978 bpr 9
!!use for avoid the variable_overflow
10
TOO_BIG=320
23 reyssat 11
!read tabletheme
12
wims_helper=chapter=3
13
userdir=!item -1 of $wims_superclass
14
!default userdir=$wims_class
5151 bpr 15
sclassdir=log/classes/$userdir
23 reyssat 16
userdir=log/classes/$userdir/.users
7901 bpr 17
 
18
shweights=!record 0 of wimshome/log/classes/$wims_class/sheets/.severity
11114 obado 19
 
23 reyssat 20
!if $wims_user=$empty
11114 obado 21
  error=not_supervisor
22
  !exit
23 reyssat 23
!endif
24
 
25
!if $cmd=help
15993 guerimand 26
  !read adm/class/classlang
11114 obado 27
  !exit
23 reyssat 28
!endif
29
 
30
!if $wims_user!=supervisor
11114 obado 31
  !reset deluser,formula,getraw,delprep
14440 guerimand 32
  !bound job within getuser,examcheck,getraw default getuser
11114 obado 33
  getuser=$wims_user
8306 guerimand 34
!else
9990 guerimand 35
  !readproc adm/vfilter/listvarfilter.proc
36
  !readproc adm/vfilter/varfilter proc
8444 guerimand 37
  !bound job within getuser,userprop,examcheck,getraw,userexam,userexamclose,showsheet,csv,formula,sheets,$empty default $empty
23 reyssat 38
!endif
15993 guerimand 39
!read adm/class/classlang
23 reyssat 40
 
5778 obado 41
!if $cmd=reply && $job=examcheck
11114 obado 42
  !changeto var.proc.examcheck
23 reyssat 43
!endif
44
 
45
!if $job=showsheet
10511 bpr 46
  show_tmp=!words2items $show
11114 obado 47
  !!no comma in the first field of the line for oneitem.phtml
10511 bpr 48
  !set wims_ariane=!append line sheet $show,1,cmd=reply&job=sheets&showsheet=$show_tmp\
49
to $wims_ariane
50
 
11114 obado 51
  !changeto var.proc.showsheet
23 reyssat 52
!endif
53
 
54
deluser=!word 1 of $deluser
55
!if $job=sheets
11114 obado 56
  show=!translate , to $ $ in $showsheet
23 reyssat 57
!else
11114 obado 58
  showsheet=!words2items $show
23 reyssat 59
!endif
60
mean_per=0
61
mean_av=0
11105 bpr 62
!set tmp=!defof DF_SEVERITY in wimshome/public_html/bases/sys/define.conf
63
!set tmp=!word 1 of $tmp
23 reyssat 64
!for i in $showsheet
11114 obado 65
  !distribute item 0,0,0 into per_$i, av_$i, cnt_$i
23 reyssat 66
!next i
67
sheetcnt=!itemcnt $showsheet
68
!if $activesheets=$empty
11114 obado 69
  scoremax=!line 1 of $shweights
70
  !default scoremax=10
71
  defaultformula=!line 2 to -1 of $shweights
72
  examweights=!record 0 of wimshome/log/classes/$wims_class/exams/.eseverity
73
  n=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheets
74
  !distribute item $ into activevars,activesh
1587 bpr 75
 
11114 obado 76
  seq_open=!defof sequence_open in wimshome/log/classes/$wims_class/seq/.def
77
  !set seq_=!record 0 of wimshome/log/classes/$wims_class/seq/.sequences
78
  !set seq_cnt=!line 1 of $seq_
79
  !if $seq_open!=yes or $seq_cnt= or $seq_cnt=0
80
    !for i=1 to $n
81
      s=!record $i of wimshome/log/classes/$wims_class/sheets/.sheets
15763 guerimand 82
      !distribute lines $s into a,e,t,d,bl,bl,bl,bl,hi,indiv
18146 bpr 83
	    !set tmp_sheetstatus=!getsheetstatus sheet=$i user=$getuser
18168 bpr 84
      !set tmp_sheetstatusgen=!getsheetstatus sheet=$i user=no
18146 bpr 85
      !if $tmp_sheetstatus<3 or $tmp_sheetstatusgen=3
14441 guerimand 86
        shw=!line $i+1 of $shweights
87
        shw=!word 1 of $shw
88
        !bound shw between 0 and 100000 default $tmp
18145 bpr 89
        !if $tmp_sheetstatus>0 and ($tmp_sheetstatus=1 or $wims_user=supervisor or $shw>0)
18168 bpr 90
          ec=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$i
15763 guerimand 91
          activesheets=!append line $i,$ec,$indiv,$t to $activesheets
14441 guerimand 92
          activesh=!append item $i to $activesh
93
        !endif
94
      !endif
11114 obado 95
    !next i
96
  !else
97
    !!!for sequences
98
    !set seq_reverse=!defof sequence_reverse in wimshome/log/classes/$wims_class/seq/.def
16280 guerimand 99
    !if $wims_user=supervisor
100
      listshowseq=!values 1 for v=1 to $seq_cnt
101
    !else
102
      listshowseq=!values 0 for v=1 to $seq_cnt
103
    !endif
11114 obado 104
    !!!!!! for compatibility. Will be remove in the definitive version
105
    !read adm/class/sheetindex
106
    !!!!!!
107
    !for ii=1 to $seq_cnt
108
      !if $seq_reverse=yes
109
        !set iii=$[$seq_cnt+2-$ii]
110
      !else
111
        !set iii=$[$ii+1]
112
      !endif
16256 guerimand 113
      riii=$[$iii-1]
114
      !!  ----- test if sequence is active and not hidden for user
115
      !if $wims_user!=supervisor and $job=getuser
116
        tmp=!record 1 of wimshome/log/classes/$wims_class/seq/.sequence$riii
117
        tmp=!line 4 of $tmp
118
        !if $tmp=1
119
          !readproc adm/class/checkuserscorecondition S$riii
120
        !else
121
          output=no
122
        !endif
123
      !else
124
        output=yes
125
      !endif
126
      !if $output=yes
16280 guerimand 127
         listshowseq=!replace item number $riii by 1 in $listshowseq
128
      !endif
129
      n=!itemcnt $(seq_[$iii;])
130
      !for j=2 to $n
131
        !if sheet isin $(seq_[$iii;$j])
132
          i=!word 2 of $(seq_[$iii;$j])
133
          s=!record $i of wimshome/log/classes/$wims_class/sheets/.sheets
134
          !distribute lines $s into a,e,t,d,bl,bl,bl,bl,hi,indiv
18145 bpr 135
          !! ------test status of sheet for this user
136
          !if $wims_user=supervisor and $job=getuser
137
            !set tmp_sheetstatus=!getsheetstatus sheet=$i user=$getuser
16280 guerimand 138
          !else
18145 bpr 139
            !set tmp_sheetstatus=!getsheetstatus sheet=$i
16280 guerimand 140
          !endif
18145 bpr 141
          !if $tmp_sheetstatus<3
16280 guerimand 142
            shw=!line $i+1 of $shweights
143
            shw=!word 1 of $shw
144
            !bound shw between 0 and 100000 default $tmp
18145 bpr 145
            !if $tmp_sheetstatus>0 and ($tmp_sheetstatus=1 or $wims_user=supervisor or $shw>0)
16280 guerimand 146
              ec=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$i
147
              activesheets=!append line $i,$ec,$indiv,$riii,$t to $activesheets
148
              activesh=!append item $i to $activesh
14441 guerimand 149
            !endif
150
          !endif
16280 guerimand 151
        !endif
152
      !next j
11114 obado 153
    !next ii
154
  !endif seq_open
155
  !reset activexams
156
  ecnt=!recordcnt wimshome/log/classes/$wims_class/exams/.exams
157
  !for i=1 to $ecnt
158
    e=!record $i of wimshome/log/classes/$wims_class/exams/.exams
159
    e=!word 1 of $e
160
    !if $e>0
161
      activexams=!append item $i to $activexams
1627 bpr 162
    !endif
11114 obado 163
  !next i
10879 bpr 164
!endif activesheets=$empty
23 reyssat 165
activecnt=!linecnt $activesheets
166
eactivecnt=!itemcnt $activexams
167
 
7665 bpr 168
!bound job_affi within notes,points,quality,best,level default notes
115 guerimand 169
!if $showsheet=$empty and $job_affi!=notes
11114 obado 170
  showsheet=$activesh
171
  !for i in $showsheet
172
    !distribute item 0,0,0 into per_$i, av_$i, cnt_$i
173
  !next i
115 guerimand 174
!endif
175
 
7363 bpr 176
!!! allow the definition of the sheet calculation formula f_$i
23 reyssat 177
!read var.proc.weights
178
usercnt=!recordcnt wimshome/log/classes/$wims_class/.userlist
179
 
180
job=!word 1 of $job
8444 guerimand 181
!if $job iswordof getuser getraw delprep deluser userexam userexamclose
11114 obado 182
  logname=$getuser$getraw$delprep$deluser
183
  !read adm/class/userdef classes,$wims_class,$logname
184
  !defread $userdef
185
  lastname=$user_lastname
186
  firstname=$user_firstname
23 reyssat 187
!endif
188
 
8309 guerimand 189
!if $job=$empty or $job iswordof sheets csv
11114 obado 190
  m=!record 1 of wimshome/log/classes/$wims_class/.grades
191
  !distribute lines $m into manual,titles,weights
192
  gcnt=!itemcnt $titles
193
  gcnt=$[$gcnt-2]
194
  !if $gcnt<1
195
    manual=0
196
  !else
197
    mwtot=0
198
    !for g=1 to $gcnt
199
      w$g=!item $g+2 of $weights
200
      mwtot=$[$mwtot+$(w$g)]
201
    !next g
202
  !endif
17832 czzmrn 203
  !if $gcnt>0
11114 obado 204
    uucnt=!recordcnt wimshome/log/classes/$wims_class/.grades
205
    !for i=2 to $uucnt
206
      l=!record $i of wimshome/log/classes/$wims_class/.grades
207
      n=!item 1 of $l
208
      g=!item 3 to -1 of $l
209
      n=!hex $n
210
      Manual_$n=$g
211
      mm=0
212
      !for j=1 to $gcnt
213
        g_=!item $j of $g
14341 guerimand 214
        !if $g_!=$empty
215
          mm=$[$mm+($(w$j))*($g_)]
216
        !endif
11114 obado 217
      !next j
218
      manual_$n=$[rint(100*$mm/$mwtot)/100]
219
    !next i
220
  !endif
23 reyssat 221
!endif
222
!if $job!=$empty
11114 obado 223
  wims_module_log=$job
224
  !read var.proc.$job
23 reyssat 225
!endif
11105 bpr 226
!reset tmp