// if we're viewing, we're assigning different buttons than for adding/editing
if ($this->_action & CRM_Core_Action::VIEW) {
if (isset($this->_groupTree)) {
- CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $this->_groupTree);
+ CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $this->_groupTree, FALSE, NULL, NULL, NULL, $this->_activityId);
}
// form should be frozen for view mode
$this->freeze();
$groupTree = &CRM_Core_BAO_CustomGroup::getTree($entityType, $this, $contactId,
$cgId, $entitySubType
);
- $details = CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
+ $details = CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $contactId);
//get the fields of single custom group record
if ($customRecId == 1) {
$fields = reset($details[$cgId]);
$entitySubType
);
- CRM_Core_BAO_CustomGroup::buildCustomDataView($this,
- $groupTree
- );
+ CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $this->_contactId);
// also create the form element for the activity links box
$controller = new CRM_Core_Controller_Simple(
*
* @param string|array $value
* @param array $field
- * @param int|null $contactID
+ * @param int|null $entityId
*
* @return string
*/
- private static function formatDisplayValue($value, $field, $contactID = NULL) {
+ private static function formatDisplayValue($value, $field, $entityId = NULL) {
if (self::isSerialized($field) && !is_array($value)) {
$value = CRM_Utils_Array::explodePadded($value);
case 'File':
// In the context of displaying a profile, show file/image
- if ($contactID && $value) {
- $url = self::getFileURL($contactID, $field['id'], $value);
+ if ($entityId) {
+ $url = self::getFileURL($entityId, $field['id']);
if ($url) {
$display = $url['file_url'];
}
}
elseif ($value) {
// In other contexts show a paperclip icon
- if (is_numeric($value)) {
- $icons = CRM_Core_BAO_File::paperIconAttachment('*', $value);
- $display = $icons[$value];
- }
- // In the context of inline view, show file/image
- else {
- $fileId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_File', $value, 'id', 'uri');
- $results = CRM_Core_BAO_File::getEntityFile('*', $fileId);
- $display = $results[$fileId];
- }
+ $icons = CRM_Core_BAO_File::paperIconAttachment('*', $value);
+ $display = $icons[$value];
}
break;
* @param int $gID
* @param null $prefix
* @param int $customValueId
+ * @param int $entityId
*
* @return array|int
*/
- public static function buildCustomDataView(&$form, &$groupTree, $returnCount = FALSE, $gID = NULL, $prefix = NULL, $customValueId = NULL) {
+ public static function buildCustomDataView(&$form, &$groupTree, $returnCount = FALSE, $gID = NULL, $prefix = NULL, $customValueId = NULL, $entityId = NULL) {
$details = array();
foreach ($groupTree as $key => $group) {
if ($key === 'info') {
'field_title' => CRM_Utils_Array::value('label', $properties),
'field_type' => CRM_Utils_Array::value('html_type', $properties),
'field_data_type' => CRM_Utils_Array::value('data_type', $properties),
- 'field_value' => CRM_Core_BAO_CustomField::displayValue($values['data'], $properties['id']),
+ 'field_value' => CRM_Core_BAO_CustomField::displayValue($values['data'], $properties['id'], $entityId),
'options_per_line' => CRM_Utils_Array::value('options_per_line', $properties),
);
// also return contact reference contact id if user has view all or edit all contacts perm
$memType = CRM_Core_DAO::getFieldValue("CRM_Member_DAO_Membership", $id, "membership_type_id");
$groupTree = CRM_Core_BAO_CustomGroup::getTree('Membership', $this, $id, 0, $memType);
- CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
+ CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $id);
$isRecur = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $id, 'contribution_recur_id');
</div>
{else}
<div class="crm-label">{$element.field_title}</div>
- {if $element.field_type == 'File' && !empty($element.field_value)}
- {if $element.field_value.displayURL}
+ {if $element.field_type == 'File' && !empty($element.field_value.displayURL)}
<div class="crm-content crm-custom_data crm-displayURL">
<a href="{$element.field_value.displayURL}" class='crm-image-popup'>
<img src="{$element.field_value.displayURL}" height = "{$element.field_value.imageThumbHeight}"
width="{$element.field_value.imageThumbWidth}">
</a>
- </div>
- {else}
- <div class="crm-content crm-custom_data crm-fileURL">
- <a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a>
- </div>
- {/if}
+ </div>
{elseif $element.field_data_type EQ 'ContactReference' && $element.contact_ref_id}
{*Contact ref id passed if user has sufficient permissions - so make a link.*}
<div class="crm-content crm-custom-data crm-contact-reference">
{else}
<td class="label">{$element.field_title}</td>
{if $element.field_type == 'File'}
- {if $element.field_value.displayURL}
+ {if !empty($element.field_value.displayURL)}
<td class="html-adjust">
<a href="{$element.field_value.displayURL}" class='crm-image-popup'>
<img src="{$element.field_value.displayURL}" height="100" width="100">
</td>
{else}
<td class="html-adjust">
- <a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a>
+ {$element.field_value}
</td>
{/if}
{else}
{else}
<div class="label">{$element.field_title}</div>
{if $element.field_type == 'File'}
- {if $element.field_value.displayURL}
+ {if !empty($element.field_value.displayURL)}
<div class="content">
<a href="{$element.field_value.displayURL}" class='crm-image-popup'>
<img src="{$element.field_value.displayURL}" height="100" width="100">
{else}
<div class="content">
{if $element.field_value}
- <a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a>
+ {$element.field_value}
{else}
<br/>
{/if}