Revision 6f205006
Von Moritz Bunkus vor fast 17 Jahren hinzugefügt
SL/ReportGenerator.pm | ||
---|---|---|
7 | 7 |
|
8 | 8 |
use SL::Form; |
9 | 9 |
|
10 |
# Cause locales.pl to parse these files: |
|
11 |
# parse_html_template('report_generator/html_report') |
|
12 |
# parse_html_template('report_generator/pdf_report') |
|
13 |
|
|
10 | 14 |
sub new { |
11 | 15 |
my $type = shift; |
12 | 16 |
|
... | ... | |
21 | 25 |
'output_format' => 'HTML', |
22 | 26 |
'allow_pdf_export' => 1, |
23 | 27 |
'allow_csv_export' => 1, |
28 |
'html_template' => 'report_generator/html_report', |
|
29 |
'pdf_template' => 'report_generator/pdf_report', |
|
24 | 30 |
'pdf_export' => { |
25 | 31 |
'paper_size' => 'A4', |
26 | 32 |
'orientation' => 'landscape', |
... | ... | |
390 | 396 |
sub generate_html_content { |
391 | 397 |
my $self = shift; |
392 | 398 |
my $variables = $self->prepare_html_content(); |
393 |
my $report_template = $self->{form}->{report_template} ? $self->{form}->{report_template} : 'report_generator/html_report'; |
|
394 |
# $form->parse_html_template('report_generator/html_report', $variables)); |
|
395 |
return $self->{form}->parse_html_template($report_template, $variables); |
|
399 |
|
|
400 |
return $self->{form}->parse_html_template($self->{options}->{html_template}, $variables); |
|
396 | 401 |
} |
397 | 402 |
|
398 | 403 |
sub verify_paper_size { |
... | ... | |
411 | 416 |
my $form = $self->{form}; |
412 | 417 |
my $myconfig = $self->{myconfig}; |
413 | 418 |
my $opt = $self->{options}->{pdf_export}; |
414 |
my $report_template = $form->{report_template} ? $form->{report_template} : 'report_generator/pdf_report'; |
|
415 | 419 |
|
416 | 420 |
my $opt_number = $opt->{number} ? 'number : 1' : ''; |
417 | 421 |
my $opt_landscape = $opt->{orientation} eq 'landscape' ? 'landscape : 1' : ''; |
... | ... | |
468 | 472 |
unlink $cfg_file_name; |
469 | 473 |
$form->error($locale->text('Could not write the temporary HTML file.')); |
470 | 474 |
} |
471 |
# $form->parse_html_template('report_generator/pdf_report', $variables)); |
|
472 |
$html_file->print($form->parse_html_template($report_template, $variables));
|
|
475 |
|
|
476 |
$html_file->print($form->parse_html_template($self->{options}->{pdf_template}, $variables));
|
|
473 | 477 |
$html_file->close(); |
474 | 478 |
|
475 | 479 |
my $cmdline = |
Auch abrufbar als: Unified diff
Übergabe des Templates an den ReportGenerator nicht über $form, sondern über ReportGenerator::set_options().