dbc170172f4e2ec72f0f7d5d5ef2c60b19706e6b
[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 = array(
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(array('width' => 0.1, 'cap' => 'round', 'join' => 'round', 'dash' => '2,2', 'color' => array(0, 0, 200)));
44
45 $this->pdf->SetFontSize(8);
46 $this->pdf->MultiCell($this->pdf->width - $this->lMarginLogo, 0, $participant['event_title'], $this->border, "L", 0, 1, $x + $this->lMarginLogo, $y);
47
48 $this->pdf->SetXY($x, $y + $this->pdf->height - 5);
49 $date = CRM_Utils_Date::customFormat($participant['event_start_date'], "%e %b");
50 $this->pdf->Cell($this->pdf->width, 0, $date, $this->border, 2, "R");
51
52 $this->pdf->SetFontSize(15);
53 $this->pdf->MultiCell($this->pdf->width, 10, $participant['display_name'], $this->border, "C", 0, 1, $x, $y + $this->tMarginName);
54 $this->pdf->SetFontSize(10);
55 $this->pdf->MultiCell($this->pdf->width, 0, $participant['current_employer'], $this->border, "C", 0, 1, $x, $this->pdf->getY());
56 }
57 }