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