if (!empty($layout['data']['height_image_2'])) {
$formattedRow['height_image_2'] = $layout['data']['height_image_2'];
}
+ if (!empty($row['participant_image_URL'])) {
+ $formattedRow['participant_image'] = $row['participant_image_URL'];
+ }
+ if (!empty($layout['data']['width_participant_image'])) {
+ $formattedRow['width_participant_image'] = $layout['data']['width_participant_image'];
+ }
+ if (!empty($layout['data']['height_participant_image'])) {
+ $formattedRow['height_participant_image'] = $layout['data']['height_participant_image'];
+ }
+ 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(
$startOffset = CRM_Utils_Array::value('height_image_2', $formattedRow);
}
+ if (CRM_Utils_Array::value('participant_image', $formattedRow)){
+ $xAlign = 10;
+ switch (CRM_Utils_Array::value('alignment_participant_image', $formattedRow)){
+ case 'R':
+ $xAlign = 65;
+ break;
+ case 'L':
+ $xAlign = 10;
+ break;
+ case 'C':
+ $xAlign = 35;
+ break;
+ default:
+ break;
+ }
+ $this->pdf->Image($formattedRow['participant_image'], $x+$xAlign, $y + 18, CRM_Utils_Array::value('width_participant_image', $formattedRow), CRM_Utils_Array::value('height_participant_image', $formattedRow));
+ if ($startOffset == NULL && CRM_Utils_Array::value('height_participant_image', $formattedRow)){
+ $startOffset = CRM_Utils_Array::value('height_participant_image', $formattedRow);
+ }
+ }
+
$this->pdf->SetLineStyle(array(
'width' => 0.1,
'cap' => 'round',
// get name badge layout info
$layoutInfo = CRM_Badge_BAO_Layout::buildLayout($params);
- // spit / get actual field names from token
+ // spit / get actual field names from tokeni and individual contact image URLs
+ $participant_image_URLs = array();
+ if (CRM_Utils_Array::value('participant_image', $layoutInfo['data'])){
+ $layoutInfo['data']['participant_image_URL'] = '';
+ $queryString = "SELECT civicrm_participant.id as participant_id, civicrm_contact.image_URL FROM civicrm_contact LEFT JOIN civicrm_participant ON civicrm_contact.id = civicrm_participant.contact_id WHERE {$form->_componentClause};";
+ $dao = CRM_Core_DAO::executeQuery($queryString);
+ while ($dao->fetch()){
+ $participant_image_URLs[$dao->participant_id] = $dao->image_URL;
+ }
+ }
$returnProperties = array();
if (!empty($layoutInfo['data']['token'])) {
foreach ($layoutInfo['data']['token'] as $index => $value) {
$rows[$dao->participant_id][$key] = isset($dao->$key) ? $dao->$key : NULL;
}
}
-
+ foreach ($participant_image_URLs as $participantId => $participant_image_URL) {
+ $rows[$participantId]['participant_image_URL'] = $participant_image_URL;
+ }
$eventBadgeClass = new CRM_Badge_BAO_Badge();
$eventBadgeClass->createLabels($rows, $layoutInfo);
}
$this->add('text', 'width_image_2', ts('Width (mm)'), array('size' => 6));
$this->add('text', 'height_image_2', ts('Height (mm)'), array('size' => 6));
+
+ $this->add('checkbox', 'participant_image', ts('Use Participant Image?'));
+ $this->add('text', 'width_participant_image', ts('Width (mm)'), array('size' => 6));
+ $this->add('text', 'height_participant_image', ts('Height (mm)'), array('size' => 6));
+ $this->add('select', "alignment_participant_image", ts('Image Alignment'), $textAlignment);
+
$this->add('checkbox', 'is_default', ts('Default?'));
$this->add('checkbox', 'is_active', ts('Enabled?'));
$this->add('checkbox', 'is_reserved', ts('Reserved?'));
$this->addRule('width_image_2', ts('Enter valid width'), 'positiveInteger');
$this->addRule('height_image_1', ts('Enter valid height'), 'positiveInteger');
$this->addRule('height_image_2', ts('Enter valid height'), 'positiveInteger');
+ $this->addRule('height_participant_image', ts('Enter valid height'), 'positiveInteger');
+ $this->addRule('width_participant_image', ts('Enter valid height'), 'positiveInteger');
$this->addButtons(array(
array(
</table>
</td>
</tr>
+ <tr class="crm-badge-layout-form-block-participant_image">
+ <td class="label">{$form.participant_image.label}</td>
+ <td>
+ <table>
+ <tr>
+ <td>{$form.participant_image.html}
+ <br/>
+ <span class="description">{ts}Select this option if you want to use a contact's image on their name badge.{/ts}</span>
+ </td>
+ <td>
+ {$form.width_participant_image.html}<br/>{$form.width_participant_image.label}
+ </td>
+ <td>
+ {$form.height_participant_image.html}</br>{$form.height_participant_image.label}
+ </td>
+ <td>
+ {$form.alignment_participant_image.html}</br>{$form.alignment_participant_image.label}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
<tr class="crm-badge-layout-form-block-elements">
<td class="label">{ts}Elements{/ts}</td>
<td>