Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
fee14197 | 4 | | CiviCRM version 5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
f299f7db | 6 | | Copyright CiviCRM LLC (c) 2004-2020 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
d25dd0ee | 26 | */ |
6a488035 TO |
27 | |
28 | ||
29 | /* | |
e70a7fc0 TO |
30 | * Copyright (C) 2010 Tech To The People |
31 | * Licensed to CiviCRM under the Academic Free License version 3.0. | |
32 | * | |
33 | */ | |
6a488035 TO |
34 | |
35 | /** | |
36 | * | |
37 | * @package CRM | |
38 | * | |
39 | */ | |
40 | class CRM_Event_Badge_NameTent extends CRM_Event_Badge { | |
90b461f1 | 41 | |
0cf587a7 | 42 | /** |
0cf587a7 | 43 | */ |
00be9182 | 44 | public function __construct() { |
6a488035 TO |
45 | parent::__construct(); |
46 | // A4 | |
353ffa53 TO |
47 | $pw = 297; |
48 | $ph = 210; | |
6a488035 TO |
49 | $this->lMargin = 10; |
50 | $this->tMargin = 0; | |
353ffa53 TO |
51 | $w = $pw - 2 * $this->lMargin; |
52 | $h = $ph - 2 * $this->tMargin; | |
be2fb01f | 53 | $this->format = [ |
0479b4c8 | 54 | 'name' => 'A4 horiz', |
353ffa53 TO |
55 | 'paper-size' => 'A4', |
56 | 'metric' => 'mm', | |
57 | 'lMargin' => 0, | |
0479b4c8 | 58 | 'tMargin' => 0, |
353ffa53 TO |
59 | 'NX' => 1, |
60 | 'NY' => 1, | |
61 | 'SpaceX' => 0, | |
62 | 'SpaceY' => 0, | |
0479b4c8 | 63 | 'width' => $w, |
353ffa53 TO |
64 | 'height' => $h, |
65 | 'font-size' => 36, | |
be2fb01f | 66 | ]; |
6a488035 TO |
67 | // $this->setDebug (); |
68 | } | |
69 | ||
00be9182 | 70 | public function pdfExtraFormat() { |
6a488035 TO |
71 | $this->pdf->setPageFormat('A4', 'L'); |
72 | } | |
73 | ||
0cf587a7 EM |
74 | /** |
75 | * @param $participant | |
76 | */ | |
6a488035 TO |
77 | protected function writeOneSide(&$participant) { |
78 | $this->pdf->SetXY(0, $this->pdf->height / 2); | |
79 | $this->printBackground(TRUE); | |
80 | $txt = $participant['display_name']; | |
81 | $this->pdf->SetXY(0, $this->pdf->height / 2 + 20); | |
82 | $this->pdf->SetFontSize(54); | |
83 | $this->pdf->Write(0, $txt, NULL, NULL, 'C'); | |
84 | $this->pdf->SetXY(0, $this->pdf->height / 2 + 50); | |
85 | $this->pdf->SetFontSize(36); | |
86 | $this->pdf->Write(0, $participant['current_employer'], NULL, NULL, 'C'); | |
87 | } | |
88 | ||
0cf587a7 EM |
89 | /** |
90 | * @param $participant | |
91 | */ | |
6a488035 TO |
92 | public function generateLabel($participant) { |
93 | $this->writeOneSide($participant); | |
94 | $this->pdf->StartTransform(); | |
95 | $this->pdf->Rotate(180, $this->pdf->width / 2 + $this->pdf->marginLeft, $this->pdf->height / 2); | |
96 | $this->writeOneSide($participant); | |
97 | $this->pdf->StopTransform(); | |
98 | } | |
96025800 | 99 | |
6a488035 | 100 | } |