Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
0cf587a7 EM |
2 | |
3 | /** | |
4 | * Class CRM_Event_Badge_Logo | |
5 | */ | |
6a488035 | 6 | class CRM_Event_Badge_Logo extends CRM_Event_Badge { |
90b461f1 | 7 | |
0cf587a7 | 8 | /** |
0cf587a7 | 9 | */ |
00be9182 | 10 | public function __construct() { |
6a488035 TO |
11 | parent::__construct(); |
12 | // A4 | |
353ffa53 TO |
13 | $pw = 210; |
14 | $ph = 297; | |
15 | $h = 50; | |
16 | $w = 75; | |
be2fb01f | 17 | $this->format = [ |
0479b4c8 | 18 | 'name' => 'Sigel 3C', |
353ffa53 TO |
19 | 'paper-size' => 'A4', |
20 | 'metric' => 'mm', | |
21 | 'lMargin' => ($pw - $w * 2) / 2, | |
0479b4c8 | 22 | 'tMargin' => ($ph - $h * 5) / 2, |
353ffa53 TO |
23 | 'NX' => 2, |
24 | 'NY' => 5, | |
25 | 'SpaceX' => 0, | |
26 | 'SpaceY' => 0, | |
0479b4c8 | 27 | 'width' => $w, |
353ffa53 TO |
28 | 'height' => $h, |
29 | 'font-size' => 12, | |
be2fb01f | 30 | ]; |
6a488035 TO |
31 | $this->lMarginLogo = 20; |
32 | $this->tMarginName = 20; | |
33 | // $this->setDebug (); | |
34 | } | |
35 | ||
0cf587a7 EM |
36 | /** |
37 | * @param $participant | |
38 | */ | |
6a488035 TO |
39 | public function generateLabel($participant) { |
40 | $x = $this->pdf->GetAbsX(); | |
41 | $y = $this->pdf->GetY(); | |
42 | $this->printBackground(TRUE); | |
be2fb01f | 43 | $this->pdf->SetLineStyle([ |
90b461f1 SL |
44 | 'width' => 0.1, |
45 | 'cap' => 'round', | |
46 | 'join' => 'round', | |
47 | 'dash' => '2,2', | |
48 | 'color' => [0, 0, 200], | |
49 | ]); | |
6a488035 TO |
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 | } | |
96025800 | 63 | |
6a488035 | 64 | } |