further comment fixes
[civicrm-core.git] / CRM / Badge / BAO / Badge.php
index bfdc33568a839821579a03162f5e823e78b274c8..741b357f40a253ff7a626b25bfe62c38a9280b27 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Class CRM_Badge_Format_Badge
+ * Class CRM_Badge_Format_Badge.
  *
  * parent class for building name badges
  */
@@ -49,8 +47,6 @@ class CRM_Badge_BAO_Badge {
    *   Associated array with participant info.
    * @param array $layoutInfo
    *   Associated array which contains meta data about format/layout.
-   *
-   * @return void
    */
   public function createLabels(&$participants, &$layoutInfo) {
     $this->pdf = new CRM_Utils_PDF_Label($layoutInfo['format'], 'mm');
@@ -75,7 +71,7 @@ class CRM_Badge_BAO_Badge {
   }
 
   /**
-   * Funtion to create structure and add meta data according to layout.
+   * Function to create structure and add meta data according to layout.
    *
    * @param array $row
    *   Row element that needs to be formatted.
@@ -365,8 +361,6 @@ class CRM_Badge_BAO_Badge {
    * @param string $y
    * @param null $w
    * @param null $h
-   *
-   * @return void
    */
   public function printImage($img, $x = '', $y = '', $w = NULL, $h = NULL) {
     if (!$x) {
@@ -409,8 +403,6 @@ class CRM_Badge_BAO_Badge {
    * @param array $params
    *   Associated array of submitted values.
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function buildBadges(&$params, &$form) {
     // get name badge layout info
@@ -486,7 +478,12 @@ class CRM_Badge_BAO_Badge {
       $query->convertToPseudoNames($dao);
       $rows[$dao->participant_id] = array();
       foreach ($returnProperties as $key => $dontCare) {
-        $rows[$dao->participant_id][$key] = isset($dao->$key) ? $dao->$key : NULL;
+        $value = isset($dao->$key) ? $dao->$key : NULL;
+        // Format custom fields
+        if (strstr($key, 'custom_') && isset($value)) {
+          $value = CRM_Core_BAO_CustomField::getDisplayValue($value, substr($key, 7), $query->_options, $dao->contact_id);
+        }
+        $rows[$dao->participant_id][$key] = $value;
       }
     }