Subversion Repositories wimsdev

Rev

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