Merge pull request #7889 from eileenmcnaughton/CRM-18124-index
[civicrm-core.git] / CRM / Event / Badge / Logo.php
CommitLineData
6a488035 1<?php
0cf587a7
EM
2
3/**
4 * Class CRM_Event_Badge_Logo
5 */
6a488035 6class CRM_Event_Badge_Logo extends CRM_Event_Badge {
0cf587a7 7 /**
0cf587a7 8 */
00be9182 9 public function __construct() {
6a488035
TO
10 parent::__construct();
11 // A4
353ffa53
TO
12 $pw = 210;
13 $ph = 297;
14 $h = 50;
15 $w = 75;
6a488035 16 $this->format = array(
0479b4c8 17 'name' => 'Sigel 3C',
353ffa53
TO
18 'paper-size' => 'A4',
19 'metric' => 'mm',
20 'lMargin' => ($pw - $w * 2) / 2,
0479b4c8 21 'tMargin' => ($ph - $h * 5) / 2,
353ffa53
TO
22 'NX' => 2,
23 'NY' => 5,
24 'SpaceX' => 0,
25 'SpaceY' => 0,
0479b4c8 26 'width' => $w,
353ffa53
TO
27 'height' => $h,
28 'font-size' => 12,
6a488035
TO
29 );
30 $this->lMarginLogo = 20;
31 $this->tMarginName = 20;
32 // $this->setDebug ();
33 }
34
0cf587a7
EM
35 /**
36 * @param $participant
37 */
6a488035
TO
38 public function generateLabel($participant) {
39 $x = $this->pdf->GetAbsX();
40 $y = $this->pdf->GetY();
41 $this->printBackground(TRUE);
353ffa53
TO
42 $this->pdf->SetLineStyle(array(
43 'width' => 0.1,
44 'cap' => 'round',
45 'join' => 'round',
46 'dash' => '2,2',
408b79bf 47 'color' => array(0, 0, 200),
353ffa53 48 ));
6a488035
TO
49
50 $this->pdf->SetFontSize(8);
51 $this->pdf->MultiCell($this->pdf->width - $this->lMarginLogo, 0, $participant['event_title'], $this->border, "L", 0, 1, $x + $this->lMarginLogo, $y);
52
53 $this->pdf->SetXY($x, $y + $this->pdf->height - 5);
54 $date = CRM_Utils_Date::customFormat($participant['event_start_date'], "%e %b");
55 $this->pdf->Cell($this->pdf->width, 0, $date, $this->border, 2, "R");
56
57 $this->pdf->SetFontSize(15);
58 $this->pdf->MultiCell($this->pdf->width, 10, $participant['display_name'], $this->border, "C", 0, 1, $x, $y + $this->tMarginName);
59 $this->pdf->SetFontSize(10);
60 $this->pdf->MultiCell($this->pdf->width, 0, $participant['current_employer'], $this->border, "C", 0, 1, $x, $this->pdf->getY());
61 }
96025800 62
6a488035 63}