X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FEvent%2FBadge.php;h=4f70438792cef00cdb56297b44377c651bb8d0af;hb=5671179aa7ec5fbfea415b2264c53537d6da7488;hp=487c6362485bb9f2254d556353ceb6de2d45ba2f;hpb=64e59809d10c3ff342718a28f42983ec217dc282;p=civicrm-core.git diff --git a/CRM/Event/Badge.php b/CRM/Event/Badge.php index 487c636248..4f70438792 100644 --- a/CRM/Event/Badge.php +++ b/CRM/Event/Badge.php @@ -21,13 +21,13 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ /* -* Copyright (C) 2010 Tech To The People -* Licensed to CiviCRM under the Academic Free License version 3.0. -* -*/ + * Copyright (C) 2010 Tech To The People + * Licensed to CiviCRM under the Academic Free License version 3.0. + * + */ /** * @@ -44,21 +44,26 @@ */ class CRM_Event_Badge { /** - * */ - function __construct() { - $this->style = array('width' => 0.1, 'cap' => 'round', 'join' => 'round', 'dash' => '2,2', 'color' => array(0, 0, 200)); - $this->format = '5160'; + public function __construct() { + $this->style = array( + 'width' => 0.1, + 'cap' => 'round', + 'join' => 'round', + 'dash' => '2,2', + 'color' => array(0, 0, 200), + ); + $this->format = '5160'; $this->imgExtension = 'png'; - $this->imgRes = 300; - $this->event = NULL; + $this->imgRes = 300; + $this->event = NULL; $this->setDebug(FALSE); } /** * @param bool $debug */ - function setDebug($debug = TRUE) { + public function setDebug($debug = TRUE) { if (!$debug) { $this->debug = FALSE; $this->border = 0; @@ -73,15 +78,14 @@ class CRM_Event_Badge { * Create the labels (pdf) * It assumes the participants are from the same event * - * @param array $participants + * @param array $participants * - * @return null - * @access public + * @return; */ public function run(&$participants) { // fetch the 1st participant, and take her event to retrieve its attributes $participant = reset($participants); - $eventID = $participant['event_id']; + $eventID = $participant['event_id']; $this->event = self::retrieveEvent($eventID); //call function to create labels self::createLabels($participants); @@ -107,7 +111,7 @@ class CRM_Event_Badge { * * @return string */ - function getImageFileName($eventID, $img = FALSE) { + public function getImageFileName($eventID, $img = FALSE) { global $civicrm_root; $path = "CRM/Event/Badge"; if ($img == FALSE) { @@ -120,15 +124,16 @@ class CRM_Event_Badge { // CRM-13235 - leverage the Smarty path to get all templates directories $template = CRM_Core_Smarty::singleton(); if (isset($template->template_dir) && $template->template_dir) { - $dirs = is_array( $template->template_dir ) ? $template->template_dir : array($template->template_dir); + $dirs = is_array($template->template_dir) ? $template->template_dir : array($template->template_dir); foreach ($dirs as $dir) { - foreach (array( "$dir/$path/$eventID/$img", "$dir/$path/$img") as $imgFile) { + foreach (array("$dir/$path/$eventID/$img", "$dir/$path/$img") as $imgFile) { if (file_exists($imgFile)) { return $imgFile; } } } - } else { + } + else { $imgFile = 'No template directories defined anywhere??'; } @@ -139,11 +144,19 @@ class CRM_Event_Badge { /** * @param bool $img */ - function printBackground($img = FALSE) { + public function printBackground($img = FALSE) { $x = $this->pdf->GetAbsX(); $y = $this->pdf->GetY(); if ($this->debug) { - $this->pdf->Rect($x, $y, $this->pdf->width, $this->pdf->height, 'D', array('all' => array('width' => 1, 'cap' => 'round', 'join' => 'round', 'dash' => '2,10', 'color' => array(255, 0, 0)))); + $this->pdf->Rect($x, $y, $this->pdf->width, $this->pdf->height, 'D', array( + 'all' => array( + 'width' => 1, + 'cap' => 'round', + 'join' => 'round', + 'dash' => '2,10', + 'color' => array(255, 0, 0), + ), + )); } $img = $this->getImageFileName($this->event->id, $img); if ($img) { @@ -158,8 +171,8 @@ class CRM_Event_Badge { } /** - * This is supposed to be overrided - **/ + * This is supposed to be overrided. + */ public function generateLabel($participant) { $txt = "{$this->event['title']} {$participant['display_name']} @@ -168,17 +181,17 @@ class CRM_Event_Badge { $this->pdf->MultiCell($this->pdf->width, $this->pdf->lineHeight, $txt); } - function pdfExtraFormat() {} + public function pdfExtraFormat() { + } /** * Create labels (pdf) * * @param array $participants * - * @return null - * @access public + * @return; */ - function createLabels(&$participants) { + public function createLabels(&$participants) { $this->pdf = new CRM_Utils_PDF_Label($this->format, 'mm'); $this->pdfExtraFormat(); @@ -195,5 +208,5 @@ class CRM_Event_Badge { } $this->pdf->Output($this->event->title . '.pdf', 'D'); } -} +}