Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e3d22623

Von Moritz Bunkus vor etwa 12 Jahren hinzugefügt

  • ID e3d226231a8cec1c598cf7fbef6710672cd2b6bf
  • Vorgänger ee932f3f
  • Nachfolger d08c706c

Sorted-Controller-Helper: Hilfsfunktion für ReportGenerator

Unterschiede anzeigen:

SL/Controller/Helper/Sorted.pm
3 3
use strict;
4 4

  
5 5
use Carp;
6
use List::MoreUtils qw(uniq);
6 7

  
7 8
use Exporter qw(import);
8 9
our @EXPORT = qw(make_sorted get_sort_spec get_current_sort_params set_report_generator_sort_options
......
90 91
  }
91 92

  
92 93
  $params{report}->set_sort_indicator($current_sort_params{by}, 1 - $current_sort_params{dir});
94

  
95
  if ($params{report}->{export}) {
96
    $params{report}->{export}->{variable_list} = [ uniq(
97
      @{ $params{report}->{export}->{variable_list} },
98
      @{ $self->get_sort_spec->{FORM_PARAMS} }
99
    )];
100
  }
93 101
}
94 102

  
95 103
#
......
342 350

  
343 351
=item C<set_report_generator_sort_options %params>
344 352

  
345
This function sets two things in an instance of
346
L<SL::ReportGenerator>: the sort indicator and the links for those
347
column headers that are sortable.
353
This function does three things with an instance of
354
L<SL::ReportGenerator>:
355

  
356
=over 4
357

  
358
=item 1. it sets the sort indicator,
359

  
360
=item 2. it sets the the links for those column headers that are
361
sortable and
362

  
363
=item 3. it adds the C<FORM_PARAMS> fields to the list of variables in
364
the report generator's export options.
365

  
366
=back
348 367

  
349 368
The report generator instance must be passed as the parameter
350 369
C<report>. The parameter C<sortable_columns> must be an array
351 370
reference of column names that are sortable.
352 371

  
353
The report generator instance must already have its columns set via a
354
call to its L<SL::ReportGenerator::set_columns> function.
372
The report generator instance must already have its columns and export
373
options set via calls to its L<SL::ReportGenerator::set_columns> and
374
L<SL::ReportGenerator::set_export_options> functions.
355 375

  
356 376
=back
357 377

  

Auch abrufbar als: Unified diff