Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ef32afed

Von Moritz Bunkus vor etwa 12 Jahren hinzugefügt

  • ID ef32afedff7750a5ef937bad68d7fde5672d5d8a
  • Vorgänger 4a366d76
  • Nachfolger 07d65516

Controller-Helfer zum Paginaten von Listen

Unterschiede anzeigen:

SL/Template/Plugin/L.pm
605 605
  return '<a href="' . $controller->get_callback(%params) . '">' . _H($title) . $image . '</a>';
606 606
}
607 607

  
608
sub paginate_controls {
609
  my ($self)          = @_;
610

  
611
  my $controller      = $self->{CONTEXT}->stash->get('SELF');
612
  my $paginate_spec   = $controller->get_paginate_spec;
613
  my %paginate_params = $controller->get_current_paginate_params;
614

  
615
  my %template_params = (
616
    pages             => {
617
      cur             => $paginate_params{page},
618
      max             => $paginate_params{num_pages},
619
      common          => $paginate_params{common_pages},
620
    },
621
    url_maker         => sub {
622
      my %url_params                                    = _hashify(@_);
623
      $url_params{ $paginate_spec->{FORM_PARAMS}->[0] } = delete $url_params{page};
624
      $url_params{ $paginate_spec->{FORM_PARAMS}->[1] } = delete $url_params{per_page} if exists $url_params{per_page};
625

  
626
      return $controller->get_callback(%url_params);
627
    },
628
  );
629

  
630
  my $output;
631
  $controller->_template_obj->process('templates/webpages/common/paginate.html', \%template_params, \$output);
632
  return $output;
633
}
634

  
608 635
1;
609 636

  
610 637
__END__
......
903 930
See the documentation of L<SL::Controller::Helper::Sorted> for an
904 931
overview and further usage instructions.
905 932

  
933
=item C<paginate_controls>
934

  
935
Create a set of links used to paginate a list view.
936

  
937
See the documentation of L<SL::Controller::Helper::Paginated> for an
938
overview and further usage instructions.
939

  
906 940
=back
907 941

  
908 942
=head2 CONVERSION FUNCTIONS

Auch abrufbar als: Unified diff