Merge pull request #1516 from cividesk/CRM-13293
[civicrm-core.git] / CRM / Event / Badge / Logo.php
CommitLineData
6a488035
TO
1<?php
2class CRM_Event_Badge_Logo extends CRM_Event_Badge {
3 function __construct() {
4 parent::__construct();
5 // A4
6 $pw = 210;
7 $ph = 297;
8 $h = 50;
9 $w = 75;
10 $this->format = array(
11 'name' => 'Sigel 3C', 'paper-size' => 'A4', 'metric' => 'mm', 'lMargin' => ($pw - $w * 2) / 2,
12 'tMargin' => ($ph - $h * 5) / 2, 'NX' => 2, 'NY' => 5, 'SpaceX' => 0, 'SpaceY' => 0,
13 'width' => $w, 'height' => $h, 'font-size' => 12,
14 );
15 $this->lMarginLogo = 20;
16 $this->tMarginName = 20;
17 // $this->setDebug ();
18 }
19
20 public function generateLabel($participant) {
21 $x = $this->pdf->GetAbsX();
22 $y = $this->pdf->GetY();
23 $this->printBackground(TRUE);
24 $this->pdf->SetLineStyle(array('width' => 0.1, 'cap' => 'round', 'join' => 'round', 'dash' => '2,2', 'color' => array(0, 0, 200)));
25
26 $this->pdf->SetFontSize(8);
27 $this->pdf->MultiCell($this->pdf->width - $this->lMarginLogo, 0, $participant['event_title'], $this->border, "L", 0, 1, $x + $this->lMarginLogo, $y);
28
29 $this->pdf->SetXY($x, $y + $this->pdf->height - 5);
30 $date = CRM_Utils_Date::customFormat($participant['event_start_date'], "%e %b");
31 $this->pdf->Cell($this->pdf->width, 0, $date, $this->border, 2, "R");
32
33 $this->pdf->SetFontSize(15);
34 $this->pdf->MultiCell($this->pdf->width, 10, $participant['display_name'], $this->border, "C", 0, 1, $x, $y + $this->tMarginName);
35 $this->pdf->SetFontSize(10);
36 $this->pdf->MultiCell($this->pdf->width, 0, $participant['current_employer'], $this->border, "C", 0, 1, $x, $this->pdf->getY());
37 }
38}
39