Subversion Repositories wimsdev

Rev

Rev 16926 | Rev 17036 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
16903 guerimand 1
!if $wims_show_stat!=yes
2
  error=nostat
3
  notallowed=1
4
  !exit
5
!endif
16946 czzmrn 6
!!
7
!! temporary fix, need to be checked with portals
8
!!
9
!! for groupements, data are stored in a uniq file
10
!! (ccaccount/$wims_superclas) for the groupement and all the
11
!! subclasses. With this fix, workingtime.proc shows the working time
12
!! in all subclasses
13
!!
14
classtype=!defof class_type in wimshome/log/classes/$wims_class/.def
15
!if $classtype=1
16
  statclass=$wims_superclass
17
!else
18
  statclass=$wims_class
19
!endif
16903 guerimand 20
!if $wims_user!=supervisor
21
  user=$wims_user
22
!else
23
  !if $ulist=$empty
24
    !! --- check for list of user
25
    nbuser=!recordcnt wimshome/log/classes/$wims_class/.userlist
26
    !reset ulist,flist,llist,uulist
27
    !for i=1 to $nbuser
28
      u_=!record $i of wimshome/log/classes/$wims_class/.userlist
29
      !distribute item $u_ into l_,f_,n_
30
      ulist=!append item $n_ to $ulist
31
      flist=!append item $f_ to $flist
32
      llist=!append item $l_ to $llist
33
    !next i
34
  !endif
35
  !bound user within $ulist,$empty default $empty
36
!endif
37
 
38
job_title=!nosubst $name_workingtime
39
!if $user=$empty
40
  !exit
41
!endif
42
 
43
!read wimshome/log/classes/$wims_class/.def
44
older=!sh date +%Y%m%d -d "1 year ago";
45
date=$[max($class_creation,$older)]
46
now=!char 1 to 8 of $wims_now
47
!readproc adm/calendar.proc prevday $now
48
enddate=$[min($class_expiration,$output)]
49
mois=!char 5 to 6 of $date
50
!readproc adm/calendar.proc whatday $date
51
dnum=!word 1 of $output
52
!readproc adm/calendar.proc endmonth $date
53
wnum=$[ceil(($output-(7-$dnum+1))/7)+1]
54
test=!fileexists wimshome/sessions/$wims_session/$user.st
55
!if $test!=yes
16946 czzmrn 56
  test=!sh if [ -e $wims_home/log/ccaccount/$statclass/$user ]; then\
57
             awk -F" " 'BEGIN {d=0;v=0} {if (substr($$1,1,8)==d) {v+=$$2} else {if (d!=0) print ":"d","v;d=substr($$1,1,8);v=$$2}}' $wims_home/log/ccaccount/$statclass/$user > $wims_home/sessions/$wims_session/$user.st;\
16926 guerimand 58
           fi
16903 guerimand 59
!endif
60
nbactivity=!recordcnt wimshome/sessions/$wims_session/$user.st
61
!if $nbactivity>0
62
  cpta=0
63
  activity=0,0
64
  !while $cpta<$nbactivity and $(activity[1])<$date
65
    !increase cpta
66
    activity=!record $cpta of wimshome/sessions/$wims_session/$user.st
67
  !endwhile  
16926 guerimand 68
!else
69
  error=noactivity
70
  notallowed=1
71
  !exit
16903 guerimand 72
!endif
73
!! ----- first item is color for 0 activity (maybe zone number and color can be paramétrizable ?)
74
ltcolor=white,red,yellow,orange,green
75
!! ------ time for each zone
76
utime=$class_utime
77
!default utime=15
78
 
79
!! make data for the student
80
!reset data,lt_month
81
!while $date<$enddate
82
  !increase wcount
83
  !if $wcount=1
84
    lt_month=!append line $wnum,$mois to $lt_month           
85
  !endif
86
  !reset ligne
87
  !for k=1 to 7
88
    !ifval $k=$dnum and $date<$enddate
89
      !if $(activity[1])=$date
90
        col=$[min(ceil($(activity[2])/$utime),4)+1]
91
        ligne=!append item $col $date $(activity[2]) to $ligne
92
        !increase cpta
93
        !if $cpta<=$nbactivity
94
          activity=!record $cpta of wimshome/sessions/$wims_session/$user.st
95
        !endif
96
      !else
97
        ligne=!append item 1 $date to $ligne
98
      !endif
99
      !readproc adm/calendar.proc nextday $date
100
      date=$output
101
      month=!char 5 to 6 of $date
102
      !if $dnum=7
103
        dnum=1
104
      !else
105
        !increase dnum
106
      !endif
107
      !ifval $month!=$mois
108
        wcount=0
109
        mois=$month
110
        !readproc adm/calendar.proc endmonth $date
111
        wnum=$[ceil(($output-(7-$dnum+1))/7)+1]
112
        !if $dnum!=1
113
          flag=$dnum
114
          !reset dnum
115
        !endif
116
      !endif
117
    !else
118
      ligne=$ligne,
119
      !if $flag!=$empty
120
        dnum=$flag
121
        !reset flag
122
      !endif
123
    !endif
124
  !next k
125
  data=!append line $ligne to $data
126
!endwhile
127
nb_dtl=!linecnt $data
128