<&|/Widgets/TitleBox, title => loc("Calendar"), title_href => "Search/Calendar.html" &> % my $date = $begin->clone; % while ( $date <= $end ) { % $date = $set->next($date); % } % $date = $begin->clone; % while ($date <= $end) { % $date = $set->next($date); % }
<%$rtdate->GetWeekday($date->day_of_week % 7)%>

<%$date->day%>

% for my $t (@{ $Tickets{$date->strftime("%F")} }) { <& /Elements/CalendarEvent, Object => $t, Date => $date, DateTypes => \%DateTypes &> % }
<%INIT> use RTx::Calendar; my $title = loc("Calendar"); my $rtdate = RT::Date->new($session{'CurrentUser'}); my @DateTypes = qw/Created Starts Started Due LastUpdated Resolved/; my $today = DateTime->today; # this line is used to debug MyCalendar # $today = DateTime->new(year => 2007, month => 4, day => 11); my $begin = $today->clone->subtract( days => 3); my $end = $today->clone->add( days => 3); # use this to loop over days until $end my $set = DateTime::Set->from_recurrence( next => sub { $_[0]->truncate( to => 'day' )->add( days => 1 ) } ); my $Query = "( Status = 'new' OR Status = 'open' OR Status = 'stalled') AND ( Owner = '" . $session{CurrentUser}->Id ."' OR Owner = 'Nobody' ) AND ( Type = 'reminder' OR 'Type' = 'ticket' )"; my $Format = "__Starts__ __Due__"; if ( my $Search = RTx::Calendar::SearchDefaultCalendar($session{CurrentUser}) ) { $Format = $Search->SubValue('Format'); $Query = $Search->SubValue('Query'); } # we search all date types in Format string my @Dates = grep { $Format =~ m/__${_}(Relative)?__/ } @DateTypes; # used to display or not a date in Element/CalendarEvent my %DateTypes = map { $_ => 1 } @Dates; $Query .= RTx::Calendar::DatesClauses(\@Dates, $begin->strftime("%F"), $end->strftime("%F")); # print STDERR $Query, "\n"; my %Tickets = RTx::Calendar::FindTickets($session{'CurrentUser'}, $Query, \@Dates);