]>
iEval git - gruntmaster-page.git/blob - lib/Gruntmaster/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 constant TITLE
=> 'Contests';
12 use HTML
::Template
::Compiled
;
13 use POSIX qw
/strftime/;
14 use Gruntmaster
::Page
::Common qw
/header footer/;
15 use Gruntmaster
::Data qw
/contest_name contest_start contest_end contest_owner/;
20 <h1>Running contests</h1>
23 <tr><th>Name<th>Start date<th>End date<th>Owner
25 <tmpl_loop running><tr><td><a href="<tmpl_var id>"><tmpl_var name></a>
34 <h1>Pending contests</h1>
37 <tr><th>Name<th>Start date<th>End date<th>Owner
39 <tmpl_loop pending><tr><td><a href="<tmpl_var id>"><tmpl_var name></a>
48 <h1>Finished contests</h1>
51 <tr><th>Name<th>Start date<th>End date<th>Owner
53 <tmpl_loop finished><tr><td><a href="<tmpl_var id>"><tmpl_var name></a>
63 $templates{$_} = header
($_, TITLE
) . $templates{$_} for keys %templates;
64 $templates{$_} .= footer
$_ for keys %templates;
67 my $htc = HTML
::Template
::Compiled
->new(scalarref
=> \
$templates{$_[1]});
69 my (@running, @pending, @finished);
73 start
=> strftime
('%c', localtime contest_start
),
74 end
=> strftime
('%c', localtime contest_end
),
75 owner
=> contest_owner
};
78 push @pending, $ct if time < contest_start
;
79 push @running, $ct if time >= contest_start
&& time < contest_end
;
80 push @finished, $ct if time > contest_end
;
83 $htc->param(running
=> \
@running);
84 $htc->param(pending
=> \
@pending);
85 $htc->param(finished
=> \
@finished);
This page took 0.050699 seconds and 4 git commands to generate.