Will things ever be the same again?
[freeside.git] / httemplate / elements / pager.html
1 %
2 %
3 %  my %opt = @_;
4 %
5 %  my $pager = '';
6 %  if ( $opt{'total'} != $opt{'num_rows'} && $opt{'maxrecords'} ) {
7 %    unless ( $opt{'offset'} == 0 ) {
8 %      $cgi->param('offset', $opt{'offset'} - $opt{'maxrecords'});
9 %
10
11
12       <A HREF="<% $cgi->self_url %>"><B><FONT SIZE="+1">Previous</FONT></B></A>
13 %
14 %    }
15 %    my $page = 0;
16 %    for ( my $poff = 0; $poff < $opt{'total'}; $poff += $opt{'maxrecords'} ) {
17 %      $page++;
18 %      if ( $opt{'offset'} == $poff ) {
19 %
20
21
22         <FONT SIZE="+2"><% $page %></FONT>
23 %
24 %      } else {
25 %        $cgi->param('offset', $poff);
26 %
27
28
29         <A HREF="<% $cgi->self_url %>"><% $page %></A>
30 %
31 %      }
32 %    }
33 %    unless ( $opt{'offset'} + $opt{'maxrecords'} > $opt{'total'} ) {
34 %      $cgi->param('offset', $opt{'offset'} + $opt{'maxrecords'});
35 %
36
37
38       <A HREF="<% $cgi->self_url %>"><B><FONT SIZE="+1">Next</FONT></B></A>
39 %
40 %    }
41 %  }
42 %
43