Fix caption inclusion

This commit is contained in:
Romain Neutron
2012-09-14 11:53:04 +02:00
parent a8209d8c1c
commit b2f0c701ea

View File

@@ -91,19 +91,19 @@ class PDF
$this->pdf = $pdf; $this->pdf = $pdf;
switch ($layout) { switch ($layout) {
case "preview": case self::LAYOUT_PREVIEW:
$this->print_preview(false); $this->print_preview(false, false);
break; break;
case "previewCaption": case self::LAYOUT_PREVIEWCAPTION:
$this->print_preview(false); $this->print_preview(false, true);
break; break;
case "previewCaptionTdm": case self::LAYOUT_PREVIEWCAPTIONTDM:
$this->print_preview(true); $this->print_preview(true, true);
break; break;
case "thumbnailList": case self::LAYOUT_THUMBNAILLIST:
$this->print_thumbnailList(); $this->print_thumbnailList();
break; break;
case "thumbnailGrid": case self::LAYOUT_THUMBNAILGRID:
$this->print_thumbnailGrid(); $this->print_thumbnailGrid();
break; break;
} }
@@ -306,7 +306,7 @@ class PDF
$this->pdf->SetLeftMargin($lmargin); $this->pdf->SetLeftMargin($lmargin);
} }
protected function print_preview($withtdm) protected function print_preview($withtdm, $write_caption)
{ {
$core = \bootstrap::getCore(); $core = \bootstrap::getCore();
$appbox = \appbox::get_instance($core); $appbox = \appbox::get_instance($core);
@@ -454,10 +454,12 @@ class PDF
$this->pdf->SetXY($lmargin, $y += ( $himg + 5)); $this->pdf->SetXY($lmargin, $y += ( $himg + 5));
$nf = 0; $nf = 0;
if ($write_caption) {
foreach ($rec->get_caption()->get_fields() as $field) { foreach ($rec->get_caption()->get_fields() as $field) {
/* @var $field caption_field */ /* @var $field caption_field */
if ($nf > 0) if ($nf > 0) {
$this->pdf->Write(6, "\n"); $this->pdf->Write(6, "\n");
}
$this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12); $this->pdf->SetFont(PhraseaPDF::FONT, 'B', 12);
$this->pdf->Write(5, $field->get_name() . " : "); $this->pdf->Write(5, $field->get_name() . " : ");
@@ -475,6 +477,7 @@ class PDF
$nf++; $nf++;
} }
} }
}
return; return;
} }