]> iEval git - gruntmaster-page.git/blame_incremental - lib/Gruntmaster/Page/Pb.pm
Move Gruntmaster::Data and database tools to another repository
[gruntmaster-page.git] / lib / Gruntmaster / Page / Pb.pm
... / ...
CommitLineData
1package Gruntmaster::Page::Pb;
2
3use 5.014000;
4use strict;
5use warnings;
6use Gruntmaster::Page::Base pb => 'Problems';
7our @ISA = qw/Gruntmaster::Page::Base/;
8our $VERSION = '0.001';
9
10use constant TEMPLATES => {
11 en => <<'HTML',
12<tmpl_if levels>
13<h2>Beginner</h2>
14<ul>
15<tmpl_loop beginner><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
16</tmpl_loop></ul>
17
18<h2>Easy</h2>
19<ul>
20<tmpl_loop easy><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
21</tmpl_loop></ul>
22
23<h2>Medium</h2>
24<ul>
25<tmpl_loop medium><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
26</tmpl_loop></ul>
27
28<h2>Hard</h2>
29<ul>
30<tmpl_loop hard><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
31</tmpl_loop></ul>
32
33<tmpl_else>
34<ul>
35<tmpl_loop problems><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
36</tmpl_loop></ul>
37</tmpl_if>
38HTML
39};
40
41sub _generate{
42 my ($self, $htc, $path, $lang) = @_;
43
44 $path =~ m,^(?:ct/([^/]+)/)?pb/index.html$,;
45 local $Gruntmaster::Data::contest = $1;
46
47 my @problems = sort { $b->{name} cmp $a->{name} } map +{
48 id => $_,
49 name => problem_name,
50 level => problem_level}, problems;
51
52 for my $d (qw/beginner easy medium advanced hard/) {
53 $htc->param($d => [grep {$_->{level} and $_->{level} eq $d} @problems]);
54 }
55 $htc->param(levels => grep { $_->{level} } @problems);
56 $htc->param(problems => \@problems);
57}
58
591
This page took 0.024199 seconds and 4 git commands to generate.