Merge pull request #4629 from systopia/CRM-15665
[civicrm-core.git] / CRM / Badge / BAO / Badge.php
index 42da2026ce8b0e15aa85c25a14dba4bccfeb2084..cf0f1f97abd511ce2d461549dc14ca609d077737 100644 (file)
@@ -139,7 +139,7 @@ class CRM_Badge_BAO_Badge {
     }
     if (!empty($layout['data']['alignment_participant_image'])) {
       $formattedRow['alignment_participant_image'] = $layout['data']['alignment_participant_image'];
-    }    
+    }
 
     if (!empty($layout['data']['add_barcode'])) {
       $formattedRow['barcode'] = array(
@@ -154,6 +154,9 @@ class CRM_Badge_BAO_Badge {
     return $formattedRow;
   }
 
+  /**
+   * @param $formattedRow
+   */
   public function generateLabel($formattedRow) {
     switch ($formattedRow['labelFormat']) {
       case 'A6 Badge Portrait 150x106':
@@ -167,6 +170,10 @@ class CRM_Badge_BAO_Badge {
     }
   }
 
+  /**
+   * @param $formattedRow
+   * @param int $cellspacing
+   */
   public function labelCreator(&$formattedRow, $cellspacing = 0) {
     $this->lMarginLogo = 18;
     $this->tMarginName = 20;
@@ -228,8 +235,8 @@ class CRM_Badge_BAO_Badge {
         $value = '';
         if ($formattedRow['token'][$i]['token'] != 'spacer') {
           $value = $formattedRow['token'][$i]['value'];
-        }        
-        
+        }
+
         $xAlign = $x;
         $rowWidth = $this->pdf->width;
         if (!empty($formattedRow['participant_image']) && !empty($formattedRow['width_participant_image'])) {
@@ -370,6 +377,14 @@ class CRM_Badge_BAO_Badge {
     $this->pdf->SetXY($x, $y);
   }
 
+  /**
+   * @param $img
+   * @param int $imgRes
+   * @param null $w
+   * @param null $h
+   *
+   * @return array
+   */
   static function getImageProperties($img, $imgRes = 300, $w = NULL, $h = NULL) {
     $imgsize = getimagesize($img);
     $f = $imgRes / 25.4;
@@ -379,11 +394,10 @@ class CRM_Badge_BAO_Badge {
   }
 
   /**
-   * function to build badges parameters before actually creating badges.
+   * Build badges parameters before actually creating badges.
    *
    * @param  array $params associated array of submitted values
-   * @param $form
-   * @params object $form form/controller object
+   * @param CRM_Core_Form $form
    *
    * @return void
    * @access public
@@ -393,7 +407,7 @@ class CRM_Badge_BAO_Badge {
     // get name badge layout info
     $layoutInfo = CRM_Badge_BAO_Layout::buildLayout($params);
 
-    // spit / get actual field names from tokeni and individual contact image URLs
+    // split/get actual field names from token and individual contact image URLs
     $returnProperties = array();
     if (!empty($layoutInfo['data']['token'])) {
       foreach ($layoutInfo['data']['token'] as $index => $value) {
@@ -460,6 +474,7 @@ class CRM_Badge_BAO_Badge {
     $dao = CRM_Core_DAO::executeQuery($queryString);
     $rows = array();
     while ($dao->fetch()) {
+      $query->convertToPseudoNames($dao);
       $rows[$dao->participant_id] = array();
       foreach ($returnProperties as $key => $dontCare) {
         $rows[$dao->participant_id][$key] = isset($dao->$key) ? $dao->$key : NULL;