Merge pull request #19057 from ixiam/dev/core#2173
[civicrm-core.git] / CRM / Event / Badge / NameTent.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
bc77d7c0
TO
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12
13/*
e70a7fc0
TO
14 * Copyright (C) 2010 Tech To The People
15 * Licensed to CiviCRM under the Academic Free License version 3.0.
16 *
17 */
6a488035
TO
18
19/**
20 *
21 * @package CRM
22 *
23 */
24class CRM_Event_Badge_NameTent extends CRM_Event_Badge {
90b461f1 25
0cf587a7 26 /**
0cf587a7 27 */
00be9182 28 public function __construct() {
6a488035
TO
29 parent::__construct();
30 // A4
353ffa53
TO
31 $pw = 297;
32 $ph = 210;
6a488035
TO
33 $this->lMargin = 10;
34 $this->tMargin = 0;
353ffa53
TO
35 $w = $pw - 2 * $this->lMargin;
36 $h = $ph - 2 * $this->tMargin;
be2fb01f 37 $this->format = [
0479b4c8 38 'name' => 'A4 horiz',
353ffa53
TO
39 'paper-size' => 'A4',
40 'metric' => 'mm',
41 'lMargin' => 0,
0479b4c8 42 'tMargin' => 0,
353ffa53
TO
43 'NX' => 1,
44 'NY' => 1,
45 'SpaceX' => 0,
46 'SpaceY' => 0,
0479b4c8 47 'width' => $w,
353ffa53
TO
48 'height' => $h,
49 'font-size' => 36,
be2fb01f 50 ];
6a488035
TO
51 // $this->setDebug ();
52 }
53
00be9182 54 public function pdfExtraFormat() {
6a488035
TO
55 $this->pdf->setPageFormat('A4', 'L');
56 }
57
0cf587a7
EM
58 /**
59 * @param $participant
60 */
6a488035
TO
61 protected function writeOneSide(&$participant) {
62 $this->pdf->SetXY(0, $this->pdf->height / 2);
63 $this->printBackground(TRUE);
64 $txt = $participant['display_name'];
65 $this->pdf->SetXY(0, $this->pdf->height / 2 + 20);
66 $this->pdf->SetFontSize(54);
67 $this->pdf->Write(0, $txt, NULL, NULL, 'C');
68 $this->pdf->SetXY(0, $this->pdf->height / 2 + 50);
69 $this->pdf->SetFontSize(36);
70 $this->pdf->Write(0, $participant['current_employer'], NULL, NULL, 'C');
71 }
72
0cf587a7
EM
73 /**
74 * @param $participant
75 */
6a488035
TO
76 public function generateLabel($participant) {
77 $this->writeOneSide($participant);
78 $this->pdf->StartTransform();
79 $this->pdf->Rotate(180, $this->pdf->width / 2 + $this->pdf->marginLeft, $this->pdf->height / 2);
80 $this->writeOneSide($participant);
81 $this->pdf->StopTransform();
82 }
96025800 83
6a488035 84}