Subversion Repositories wimsdev

Rev

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