Subversion Repositories wimsdev

Rev

Rev 8301 | Rev 8315 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

# Variable calculations should be done in this file.
# It is read and interpreted by wims for all valid calls to the module.
!read adm/class/classlang
!readproc adm/whoconnect
wims_prefix=class user tmp n sharing sharable
!read adm/class/authchars
max_sheets=!defof MAX_SHEETS in wimshome/public_html/bases/sys/define.conf
title_limit=80
desc_limit=4000
!read tabletheme
wims_helper=chapter=3
userdir=!item -1 of $wims_superclass
!default userdir=$wims_class
sclassdir=log/classes/$userdir
userdir=log/classes/$userdir/.users
tooltip_parm=FONTSIZE,'11pt',ABOVE,'true'
picto=<img src="gifs/picto.gif" alt="picto" />
!!!can be defined in the name.phtml.$lang module in an another way
!default name_student1=!nosubst $lastname, $firstname
!default name_student2=!nosubst $firstname $lastname

shweights=!record 0 of wimshome/log/classes/$wims_class/sheets/.severity
!if $wims_user=$empty
 error=not_supervisor
 !exit
!endif

!if $cmd=help
 !exit
!endif
!if $varfilter!=$empty
   !reset varfilter_
   !set varfilter_cnt=!linecnt $varfilter
   !for v=1 to $varfilter_cnt
    var_line=!singlespace $(varfilter[$v;])
    var_line =!replace $ $ by , in $var_line
    varfilter_=!append line $var_line to $varfilter_
  !next
  !set name_classAverage=$name_groupAverage
!endif


!if $wims_user!=supervisor
 !reset deluser,formula,getraw,delprep
 !bound job within userprop default getuser
!! getuser=$wims_user
!else
 !bound job within userprop,delprep,deluser,recover,transfer,teacher,userlist default userlist
!endif

!if $job=teacher
 !changeto var.proc.teacher
!endif

deluser=!word 1 of $deluser
!if $job=sheets
 show=!translate , to $ $ in $showsheet
!else
 showsheet=!words2items $show
!endif
mean_per=0
mean_av=0
!for i in $showsheet
 !distribute item 0,0,0 into per_$i, av_$i, cnt_$i
!next i
sheetcnt=!itemcnt $showsheet
!if $activesheets=$empty
 s=!record 0 of wimshome/log/classes/$wims_class/sheets/.severity
 scoremax=!line 1 of $s
 !default scoremax=10
 defaultformula=!line 2 to -1 of $s
 shweights=!record 0 of wimshome/log/classes/$wims_class/sheets/.severity
 examweights=!record 0 of wimshome/log/classes/$wims_class/exams/.eseverity
 n=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheets
 !distribute item $ into activevars,activesh

 seq_open=!defof sequence_open in wimshome/log/classes/$wims_class/seq/.def
 !set seq_=!record 0 of wimshome/log/classes/$wims_class/seq/.sequences
 !set seq_cnt=!line 1 of $seq_
 !if $seq_open!=yes or $seq_cnt= or $seq_cnt=0
  !for i=1 to $n
   s=!record $i of wimshome/log/classes/$wims_class/sheets/.sheets
   !distribute lines $s into a,e,t,d
   shw=!line $i+1 of $shweights
   shw=!word 1 of $shw
   !default shw=1
   !if $a>0 and ($a<2 or $wims_user=supervisor or $shw>0)
    ec=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$i
    activesheets=!append line $i,$ec,$t to $activesheets
    activesh=!append item $i to $activesh
   !endif
  !next i
 !else
!!!for sequences
 !set seq_reverse=!defof sequence_reverse in wimshome/log/classes/$wims_class/seq/.def

!!!!!! for compatibility. Will be remove in the definitive version
  !read adm/class/sheetindex
!!!!!!
  !for ii=1 to $seq_cnt
   !if $seq_reverse=yes
      !set iii=$[$seq_cnt+2-$ii]
     !else
      !set iii=$[$ii+1]
    !endif
    n=!itemcnt $(seq_[$iii;])
    !for j=2 to $n
      !if sheet isin $(seq_[$iii;$j])
        i=!word 2 of $(seq_[$iii;$j])
        s=!record $i of wimshome/log/classes/$wims_class/sheets/.sheets
        !distribute lines $s into a,e,t,d
        shw=!line $i+1 of $shweights
        shw=!word 1 of $shw
       !default shw=1
       !if $a>0 and ($a<2 or $wims_user=supervisor or $shw>0)
        ec=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$i
        activesheets=!append line $i,$ec,$[$iii-1],$t to $activesheets
        activesh=!append item $i to $activesh
      !endif
     !endif
   !next j
 !next ii
 !endif seq_open

 ecnt=!recordcnt wimshome/log/classes/$wims_class/exams/.exams
 !for i=1 to $ecnt
  e=!record $i of wimshome/log/classes/$wims_class/exams/.exams
  e=!word 1 of $e
  !if $e>0
   activexams=!append item $i to $activexams
  !endif
 !next i
!endif
activecnt=!linecnt $activesheets
eactivecnt=!itemcnt $activexams

!bound job_affi within notes,points,quality,best,level default notes
!if $showsheet=$empty and $job_affi!=notes
 showsheet=$activesh
 !for i in $showsheet
  !distribute item 0,0,0 into per_$i, av_$i, cnt_$i
 !next i
!endif

!!! allow the definition of the sheet calculation formula f_$i
!read var.proc.weights
usercnt=!recordcnt wimshome/log/classes/$wims_class/.userlist

job=!word 1 of $job
!if $job iswordof getuser getraw delprep deluser userexam userexamclose transfer
 logname=$getuser$getraw$delprep$deluser
 !read adm/class/userdef classes,$wims_class,$logname
 !defread $userdef
 lastname=$user_lastname
 firstname=$user_firstname
!endif

!if $job=$empty or $job iswordof sheets csv or \
 ($job=userprop and $abandon!=$empty)
 m=!record 1 of wimshome/log/classes/$wims_class/.grades
 !distribute lines $m into manual,titles,weights
 gcnt=!itemcnt $titles
 gcnt=$[$gcnt-2]
 !if $gcnt<1
  manual=0
 !else
  mwtot=0
  !for g=1 to $gcnt
   w$g=!item $g+2 of $weights
   mwtot=$[$mwtot+$(w$g)]
  !next g
 !endif
 !if $manual>0
  uucnt=!recordcnt wimshome/log/classes/$wims_class/.grades
  !for i=2 to $uucnt
   l=!record $i of wimshome/log/classes/$wims_class/.grades
   n=!item 1 of $l
   g=!item 3 to -1 of $l
   n=!hex $n
   Manual_$n=$g
   mm=0
   !for j=1 to $gcnt
    g_=!item $j of $g
    mm=$[$mm+($(w$j))*($g_)]
   !next j
   manual_$n=$[rint(100*$mm/$mwtot)/100]
  !next i
 !endif
!endif

!if $job!=$empty
 wims_module_log=$job
 !read $job.proc
!endif