Subversion Repositories wimsdev

Rev

Rev 17832 | Rev 18141 | Go to most recent revision | 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
18127 bpr 83
      !set tmp_sheetstatus=!getsheetstatus sheet=$i user=$proc_wims_user
84
      !!if $wims_user!=supervisor and $hi!=$empty and $job=getuser
85
      !! ------test if sheet is hidden for this user
86
      !!   proc_wims_user=$getuser
87
      !!   !readproc adm/vfilter/ishiddensheet.proc $hi
88
      !!!else
89
      !!  hidden_sheet=0
90
      !!!endif
14441 guerimand 91
      !! -----end test
18127 bpr 92
      !if $tmp_sheetstatus!=3
93
      !!if $hidden_sheet<1
14441 guerimand 94
        shw=!line $i+1 of $shweights
95
        shw=!word 1 of $shw
96
        !bound shw between 0 and 100000 default $tmp
18127 bpr 97
        !if $tmp_sheetstatus>0 and ($tmp_sheetstatus<2 or $wims_user=supervisor or $shw>0)
98
        !!if $a>0 and ($a<2 or $wims_user=supervisor or $shw>0)
14441 guerimand 99
          ec=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$i
15763 guerimand 100
          activesheets=!append line $i,$ec,$indiv,$t to $activesheets
14441 guerimand 101
          activesh=!append item $i to $activesh
102
        !endif
103
      !endif
11114 obado 104
    !next i
105
  !else
106
    !!!for sequences
107
    !set seq_reverse=!defof sequence_reverse in wimshome/log/classes/$wims_class/seq/.def
16280 guerimand 108
    !if $wims_user=supervisor
109
      listshowseq=!values 1 for v=1 to $seq_cnt
110
    !else
111
      listshowseq=!values 0 for v=1 to $seq_cnt
112
    !endif
11114 obado 113
    !!!!!! for compatibility. Will be remove in the definitive version
114
    !read adm/class/sheetindex
115
    !!!!!!
116
    !for ii=1 to $seq_cnt
117
      !if $seq_reverse=yes
118
        !set iii=$[$seq_cnt+2-$ii]
119
      !else
120
        !set iii=$[$ii+1]
121
      !endif
16256 guerimand 122
      riii=$[$iii-1]
123
      !!  ----- test if sequence is active and not hidden for user
124
      !if $wims_user!=supervisor and $job=getuser
125
        tmp=!record 1 of wimshome/log/classes/$wims_class/seq/.sequence$riii
126
        tmp=!line 4 of $tmp
127
        !if $tmp=1
128
          !readproc adm/class/checkuserscorecondition S$riii
129
        !else
130
          output=no
131
        !endif
132
      !else
133
        output=yes
134
      !endif
135
      !if $output=yes
16280 guerimand 136
         listshowseq=!replace item number $riii by 1 in $listshowseq
137
      !endif
138
      n=!itemcnt $(seq_[$iii;])
139
      !for j=2 to $n
140
        !if sheet isin $(seq_[$iii;$j])
141
          i=!word 2 of $(seq_[$iii;$j])
142
          s=!record $i of wimshome/log/classes/$wims_class/sheets/.sheets
143
          !distribute lines $s into a,e,t,d,bl,bl,bl,bl,hi,indiv
144
          !if $wims_user!=supervisor and $hi!=$empty and $job=getuser
145
            !! ------test if sheet is hidden for this user
146
            proc_wims_user=$getuser
18127 bpr 147
            !!readproc adm/vfilter/ishiddensheet.proc $hi
148
            !set tmp_sheetstatus=!getsheetstatus sheet=$i user=$proc_wims_user
16280 guerimand 149
          !else
150
            hidden_sheet=0
18127 bpr 151
            !!???
16280 guerimand 152
          !endif
153
          !! -----end test
18127 bpr 154
          !if $tmp_sheetstatus<3
155
          !!if $hidden_sheet!=1
16280 guerimand 156
            shw=!line $i+1 of $shweights
157
            shw=!word 1 of $shw
158
            !bound shw between 0 and 100000 default $tmp
18127 bpr 159
            !if $tmp_sheetstatus>0 and ($tmp_sheetstatus<2 or $wims_user=supervisor or $shw>0)
160
            !!if $a>0 and ($a<2 or $wims_user=supervisor or $shw>0)
16280 guerimand 161
              ec=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$i
162
              activesheets=!append line $i,$ec,$indiv,$riii,$t to $activesheets
163
              activesh=!append item $i to $activesh
14441 guerimand 164
            !endif
165
          !endif
16280 guerimand 166
        !endif
167
      !next j
11114 obado 168
    !next ii
169
  !endif seq_open
170
  !reset activexams
171
  ecnt=!recordcnt wimshome/log/classes/$wims_class/exams/.exams
172
  !for i=1 to $ecnt
173
    e=!record $i of wimshome/log/classes/$wims_class/exams/.exams
174
    e=!word 1 of $e
175
    !if $e>0
176
      activexams=!append item $i to $activexams
1627 bpr 177
    !endif
11114 obado 178
  !next i
10879 bpr 179
!endif activesheets=$empty
23 reyssat 180
activecnt=!linecnt $activesheets
181
eactivecnt=!itemcnt $activexams
182
 
7665 bpr 183
!bound job_affi within notes,points,quality,best,level default notes
115 guerimand 184
!if $showsheet=$empty and $job_affi!=notes
11114 obado 185
  showsheet=$activesh
186
  !for i in $showsheet
187
    !distribute item 0,0,0 into per_$i, av_$i, cnt_$i
188
  !next i
115 guerimand 189
!endif
190
 
7363 bpr 191
!!! allow the definition of the sheet calculation formula f_$i
23 reyssat 192
!read var.proc.weights
193
usercnt=!recordcnt wimshome/log/classes/$wims_class/.userlist
194
 
195
job=!word 1 of $job
8444 guerimand 196
!if $job iswordof getuser getraw delprep deluser userexam userexamclose
11114 obado 197
  logname=$getuser$getraw$delprep$deluser
198
  !read adm/class/userdef classes,$wims_class,$logname
199
  !defread $userdef
200
  lastname=$user_lastname
201
  firstname=$user_firstname
23 reyssat 202
!endif
203
 
8309 guerimand 204
!if $job=$empty or $job iswordof sheets csv
11114 obado 205
  m=!record 1 of wimshome/log/classes/$wims_class/.grades
206
  !distribute lines $m into manual,titles,weights
207
  gcnt=!itemcnt $titles
208
  gcnt=$[$gcnt-2]
209
  !if $gcnt<1
210
    manual=0
211
  !else
212
    mwtot=0
213
    !for g=1 to $gcnt
214
      w$g=!item $g+2 of $weights
215
      mwtot=$[$mwtot+$(w$g)]
216
    !next g
217
  !endif
17832 czzmrn 218
  !if $gcnt>0
11114 obado 219
    uucnt=!recordcnt wimshome/log/classes/$wims_class/.grades
220
    !for i=2 to $uucnt
221
      l=!record $i of wimshome/log/classes/$wims_class/.grades
222
      n=!item 1 of $l
223
      g=!item 3 to -1 of $l
224
      n=!hex $n
225
      Manual_$n=$g
226
      mm=0
227
      !for j=1 to $gcnt
228
        g_=!item $j of $g
14341 guerimand 229
        !if $g_!=$empty
230
          mm=$[$mm+($(w$j))*($g_)]
231
        !endif
11114 obado 232
      !next j
233
      manual_$n=$[rint(100*$mm/$mwtot)/100]
234
    !next i
235
  !endif
23 reyssat 236
!endif
237
!if $job!=$empty
11114 obado 238
  wims_module_log=$job
239
  !read var.proc.$job
23 reyssat 240
!endif
11105 bpr 241
!reset tmp