1 package SL::Controller::Helper::ReportGenerator::ControlRow::Data;
5 use parent qw(SL::Controller::Helper::ReportGenerator::ControlRow::Base);
12 push @errors, 'type "data" needs a parameter "row" as hash ref' if !$self->params->{row} || ('HASH' ne ref $self->params->{row});
18 my ($self, $report) = @_;
22 my $def = $self->params->{row}->{$_};
25 foreach my $attr (qw(raw_data data link class align)) {
26 $tmp->{$attr} = $def->{$attr} if defined $def->{$attr};
29 } keys %{ $self->params->{row} };
31 $report->add_data(\%data);
43 SL::Controller::Helper::ReportGenerator::ControlRow::Data - an
44 implementaion of a control row class to display data
48 This class implements a control row for the report generator helper to display
49 data. You can configure the way the data is displayed.
53 use SL::Controller::Helper::ReportGenerator;
54 use SL::Controller::Helper::ReportGenerator::ControlRow qw(make_control_row);
59 # Set up the report generator instance. In this example this is
60 # hidden in "prepare_report".
61 my $report = $self->prepare_report;
63 # Get objects from database.
64 my $objects = SL::DB::Manager::TimeRecording->get_all(...);
67 my $total = $self->get_total($objects);
68 push @$objects, make_control_row(
70 row => { duration => { data => $total,
72 link => '#info_for_total' } }
75 # Let report generator create the output.
76 $self->report_generator_list_objects(
84 This control row gets the paramter C<row>, which must a hash ref.
85 The keys are the column names for the fields you want to show your
86 data. The values are hash refs itself and can contain the keys
87 C<raw_data>, C<data>, C<link>, C<class> and C<align> which are passed
88 in the data added to the report.
92 Bernd Bleßmann E<lt>bernd@kivitendo-premium.deE<gt>