Subversion Repositories wimsdev

Rev

Rev 17154 | Details | Compare with Previous | Last modification | View Log | RSS feed

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