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