Merge pull request #11629 from JMAConsulting/CRM-21675
[civicrm-core.git] / CRM / Event / Badge / Logo5395.php
1 <?php
2
3 /**
4 * Class CRM_Event_Badge_Logo5395
5 */
6 class CRM_Event_Badge_Logo5395 extends CRM_Event_Badge {
7 /**
8 */
9 public function __construct() {
10 parent::__construct();
11 // A4
12 $pw = 210;
13 $ph = 297;
14 $h = 59.2;
15 $w = 85.7;
16 $this->format = array(
17 'name' => 'Avery 5395',
18 'paper-size' => 'A4',
19 'metric' => 'mm',
20 'lMargin' => 13.5,
21 'tMargin' => 3,
22 'NX' => 2,
23 'NY' => 4,
24 'SpaceX' => 15,
25 'SpaceY' => 8.5,
26 'width' => $w,
27 'height' => $h,
28 'font-size' => 12,
29 );
30 $this->lMarginLogo = 20;
31 $this->tMarginName = 20;
32 // $this->setDebug ();
33 }
34
35 /**
36 * @param $participant
37 */
38 public function generateLabel($participant) {
39 $x = $this->pdf->GetAbsX();
40 $y = $this->pdf->GetY();
41 $this->printBackground(TRUE);
42 $this->pdf->SetLineStyle(array(
43 'width' => 0.1,
44 'cap' => 'round',
45 'join' => 'round',
46 'dash' => '2,2',
47 'color' => array(0, 0, 200),
48 ));
49
50 $this->pdf->SetFontSize(9);
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(20);
58 $this->pdf->MultiCell($this->pdf->width, 10, $participant['display_name'], $this->border, "C", 0, 1, $x, $y + $this->tMarginName);
59 $this->pdf->SetFontSize(15);
60 $this->pdf->MultiCell($this->pdf->width, 0, $participant['current_employer'], $this->border, "C", 0, 1, $x, $this->pdf->getY());
61 }
62
63 }