Subversion Repositories wimsdev

Rev

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