<& /_elements/header, title => _('Calendar'_ &> <% _('Close window')%>
% foreach my $wday (@weekdays) { % } % foreach my $week (@cal) { % foreach my $day (@{$week}) { % } #foreach $day % } # foreach $week
<% $months[$DisplayedMonth-1] %> <% _($DisplayedYear) %>
<%_($wday)%>
% if ($day) { % my $datestr = sprintf('%04d-%02d-%02d', $DisplayedYear, $DisplayedMonth, $day); <% $day %> % } else {   % }
% my $datestr = sprintf('%04d-%02d-%02d', $today[5]+1900,$today[4]+1, $today[3]); Today % my @tomorrow = localtime(time()+86400); % $datestr = sprintf('%04d-%02d-%02d', $tomorrow[5]+1900,$tomorrow[4]+1, $tomorrow[3]); Tomorrow
% $m->abort(); <%init> my @today = localtime(time()); my @weekdays; push @weekdays, $_ for qw(Sun Mon Tue Wed Thu Fri Sat); my @months; push @months, $_ for qw(January February March April May June July August September October November December); unless ($DisplayedYear) { $DisplayedMonth = $today[4] + 1; $DisplayedYear = ($today[5] + 1900); } my ($prev_year, $next_year, $prev_month, $next_month); $prev_month = $next_month = $DisplayedMonth; $prev_year = $next_year = $DisplayedYear; $next_month++; $prev_month--; if ($DisplayedMonth == 12) { $next_year++; $next_month = 1; } elsif ($DisplayedMonth == 1) { $prev_month = 12; $prev_year--; } use Calendar::Simple; my @cal = Calendar::Simple::calendar($DisplayedMonth, $DisplayedYear); <%args> $field => 'none' $DisplayedMonth => undef $DisplayedYear => undef