]>
iEval git - plack-app-gruntmaster.git/blob - Page/Ct.pm
1 package Gruntmaster
::Page
::Ct
;
6 use parent qw
/Exporter/;
7 our @EXPORT_OK = qw
/generate/;
8 our $VERSION = '0.001';
10 use HTML
::Template
::Compiled
;
11 use POSIX qw
/strftime/;
12 use Gruntmaster
::Page
::Common qw
/cook_templates reload_templates/;
13 use Gruntmaster
::Data qw
/contest_name contest_start contest_end contest_owner/;
15 my %orig_templates = (
18 <h1>Running contests</h1>
21 <tr><th>Name<th>Start date<th>End date<th>Owner
23 <tmpl_loop running><tr><td><a href="<tmpl_var id>"><tmpl_var name></a>
32 <h1>Pending contests</h1>
35 <tr><th>Name<th>Start date<th>End date<th>Owner
37 <tmpl_loop pending><tr><td><a href="<tmpl_var id>"><tmpl_var name></a>
46 <h1>Finished contests</h1>
49 <tr><th>Name<th>Start date<th>End date<th>Owner
51 <tmpl_loop finished><tr><td><a href="<tmpl_var id>"><tmpl_var name></a>
61 my %templates = cook_templates
%orig_templates, ct
=> 'Contests';
64 %templates = cook_templates
%orig_templates, ct
=> 'Contests' if reload_template
;
65 my $htc = HTML
::Template
::Compiled
->new(scalarref
=> \
$templates{$_[1]});
67 my (@running, @pending, @finished);
71 start
=> strftime
('%c', localtime contest_start
),
72 end
=> strftime
('%c', localtime contest_end
),
73 owner
=> contest_owner
};
76 push @pending, $ct if time < contest_start
;
77 push @running, $ct if time >= contest_start
&& time < contest_end
;
78 push @finished, $ct if time > contest_end
;
81 $htc->param(running
=> \
@running);
82 $htc->param(pending
=> \
@pending);
83 $htc->param(finished
=> \
@finished);
This page took 0.052627 seconds and 4 git commands to generate.