Subversion Repositories wimsdev

Rev

Rev 18127 | Rev 18144 | 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
18141 czzmrn 128
          !! check technical variable access to sequence
129
          !! (if sequence accessible the script set output=yes)
16256 guerimand 130
          !readproc adm/class/checkuserscorecondition S$riii
131
        !else
132
          output=no
133
        !endif
134
      !else
135
        output=yes
136
      !endif
137
      !if $output=yes
16280 guerimand 138
         listshowseq=!replace item number $riii by 1 in $listshowseq
139
      !endif
140
      n=!itemcnt $(seq_[$iii;])
141
      !for j=2 to $n
142
        !if sheet isin $(seq_[$iii;$j])
143
          i=!word 2 of $(seq_[$iii;$j])
144
          s=!record $i of wimshome/log/classes/$wims_class/sheets/.sheets
145
          !distribute lines $s into a,e,t,d,bl,bl,bl,bl,hi,indiv
18141 czzmrn 146
!!          !if $wims_user!=supervisor and $hi!=$empty and $job=getuser
16280 guerimand 147
            !! ------test if sheet is hidden for this user
148
            proc_wims_user=$getuser
18141 czzmrn 149
!!            !!readproc adm/vfilter/ishiddensheet.proc $hi
18127 bpr 150
            !set tmp_sheetstatus=!getsheetstatus sheet=$i user=$proc_wims_user
18141 czzmrn 151
          !if $tmp_sheetstatus<3
152
            hidden_sheet=1
153
            !!???
16280 guerimand 154
          !else
155
            hidden_sheet=0
18127 bpr 156
            !!???
16280 guerimand 157
          !endif
158
          !! -----end test
18127 bpr 159
          !if $tmp_sheetstatus<3
160
          !!if $hidden_sheet!=1
16280 guerimand 161
            shw=!line $i+1 of $shweights
162
            shw=!word 1 of $shw
163
            !bound shw between 0 and 100000 default $tmp
18141 czzmrn 164
            !if $tmp_sheetstatus>0 and ($tmp_sheetstatus<2 or $wims_user=supervisor or $shw>0) and $(listshowseq[$ii])=1
18127 bpr 165
            !!if $a>0 and ($a<2 or $wims_user=supervisor or $shw>0)
16280 guerimand 166
              ec=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$i
167
              activesheets=!append line $i,$ec,$indiv,$riii,$t to $activesheets
168
              activesh=!append item $i to $activesh
14441 guerimand 169
            !endif
170
          !endif
16280 guerimand 171
        !endif
172
      !next j
11114 obado 173
    !next ii
174
  !endif seq_open
175
  !reset activexams
176
  ecnt=!recordcnt wimshome/log/classes/$wims_class/exams/.exams
177
  !for i=1 to $ecnt
178
    e=!record $i of wimshome/log/classes/$wims_class/exams/.exams
179
    e=!word 1 of $e
180
    !if $e>0
181
      activexams=!append item $i to $activexams
1627 bpr 182
    !endif
11114 obado 183
  !next i
10879 bpr 184
!endif activesheets=$empty
23 reyssat 185
activecnt=!linecnt $activesheets
186
eactivecnt=!itemcnt $activexams
187
 
7665 bpr 188
!bound job_affi within notes,points,quality,best,level default notes
115 guerimand 189
!if $showsheet=$empty and $job_affi!=notes
11114 obado 190
  showsheet=$activesh
191
  !for i in $showsheet
192
    !distribute item 0,0,0 into per_$i, av_$i, cnt_$i
193
  !next i
115 guerimand 194
!endif
195
 
7363 bpr 196
!!! allow the definition of the sheet calculation formula f_$i
23 reyssat 197
!read var.proc.weights
198
usercnt=!recordcnt wimshome/log/classes/$wims_class/.userlist
199
 
200
job=!word 1 of $job
8444 guerimand 201
!if $job iswordof getuser getraw delprep deluser userexam userexamclose
11114 obado 202
  logname=$getuser$getraw$delprep$deluser
203
  !read adm/class/userdef classes,$wims_class,$logname
204
  !defread $userdef
205
  lastname=$user_lastname
206
  firstname=$user_firstname
23 reyssat 207
!endif
208
 
8309 guerimand 209
!if $job=$empty or $job iswordof sheets csv
11114 obado 210
  m=!record 1 of wimshome/log/classes/$wims_class/.grades
211
  !distribute lines $m into manual,titles,weights
212
  gcnt=!itemcnt $titles
213
  gcnt=$[$gcnt-2]
214
  !if $gcnt<1
215
    manual=0
216
  !else
217
    mwtot=0
218
    !for g=1 to $gcnt
219
      w$g=!item $g+2 of $weights
220
      mwtot=$[$mwtot+$(w$g)]
221
    !next g
222
  !endif
17832 czzmrn 223
  !if $gcnt>0
11114 obado 224
    uucnt=!recordcnt wimshome/log/classes/$wims_class/.grades
225
    !for i=2 to $uucnt
226
      l=!record $i of wimshome/log/classes/$wims_class/.grades
227
      n=!item 1 of $l
228
      g=!item 3 to -1 of $l
229
      n=!hex $n
230
      Manual_$n=$g
231
      mm=0
232
      !for j=1 to $gcnt
233
        g_=!item $j of $g
14341 guerimand 234
        !if $g_!=$empty
235
          mm=$[$mm+($(w$j))*($g_)]
236
        !endif
11114 obado 237
      !next j
238
      manual_$n=$[rint(100*$mm/$mwtot)/100]
239
    !next i
240
  !endif
23 reyssat 241
!endif
242
!if $job!=$empty
11114 obado 243
  wims_module_log=$job
244
  !read var.proc.$job
23 reyssat 245
!endif
11105 bpr 246
!reset tmp