4 use RTx::Schedule qw( UserDaySchedule );
6 my $im = new GD::Image($width, $height) or die;
8 my $white = $im->colorAllocate(255,255,255);
9 my $black = $im->colorAllocate(0,0,0);
11 # Put a black frame around the picture
12 $im->rectangle(0,0,$width-1,$height-1,$black);
14 my %schedule = UserDaySchedule( CurrentUser => $session{CurrentUser},
15 username => $Username,
19 #XXX block out unavailable times
21 #block out / show / color code existing appointments
22 foreach my $id ( keys %{ $schedule{'scheduled'} } ) {
24 my( $starts, $due, $col, $t ) = @{ $schedule{'scheduled'}->{$id} };
25 my $color = $im->colorAllocate( unpack 'C*', pack 'H*', $col );
26 $im->filledRectangle( int(($starts-$stime)/10), 1, int(($due-$stime)/10)-1, $height-2, $color );
30 $r->content_type('image/png');
42 my $stime = RT->Config->Get('CalendarWeeklyStartMin');
43 $stime = 480 unless $stime =~ /^\d+$/; #8am
44 my $etime = RT->Config->Get('CalendarWeeklyEndMin');
45 $etime = 1080 unless $etime =~ /^\d+$/; #6pm
47 my $width = int( ( $etime - $stime ) / 10 );
48 my $height = 12; #Elements/CalendarDaySchedule