]>
iEval git - gruntmaster-page.git/blob - lib/Gruntmaster/Page/Pb.pm
1 package Gruntmaster
::Page
::Pb
;
6 use parent qw
/Exporter/;
7 our @EXPORT_OK = qw
/generate/;
8 our $VERSION = '0.001';
10 use constant TITLE
=> 'Problems';
13 use HTML
::Template
::Compiled
;
15 use POSIX qw
/strftime/;
16 use Gruntmaster
::Page
::Common qw
/header footer/;
17 use Gruntmaster
::Data qw
/problem_name problem_level problems/;
24 <tmpl_loop beginner><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
29 <tmpl_loop easy><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
34 <tmpl_loop medium><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
39 <tmpl_loop hard><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
44 <tmpl_loop problems><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
50 $templates{$_} = header
($_, TITLE
) . $templates{$_} for keys %templates;
51 $templates{$_} .= footer
$_ for keys %templates;
54 $_[0] =~ m
,^(?
:ct
/([^/]+)/)?pb/index
.html
$,;
55 local $Gruntmaster::Data
::contest
= $1;
57 my $htc = HTML
::Template
::Compiled
->new(scalarref
=> \
$templates{$_[1]});
58 my @problems = sort { $b->{name
} cmp $a->{name
} } map +{
61 level
=> problem_level
}, problems
;
62 for my $d (qw
/beginner easy medium advanced hard/) {
63 $htc->param($d => [grep {$_->{level
} and $_->{level
} eq $d} @problems]);
65 $htc->param(levels
=> grep { $_->{level
} } @problems);
66 $htc->param(problems
=> \
@problems);
This page took 0.052807 seconds and 4 git commands to generate.