$limit = '';
if (!empty($DTparams['rowCount']) && $DTparams['rowCount'] > 0) {
- $limit = " LIMIT {$DTparams['offset']}, {$DTparams['rowCount']} ";
+ $limit = " LIMIT " . CRM_Utils_Type::escape($DTparams['offset'], 'Integer') . ", " . CRM_Utils_Type::escape($DTparams['rowCount'], 'Integer');
}
$orderBy = '';
$fieldList = array();
foreach ($fields as $id => $value) {
$field = array();
- foreach ($value as $fieldId => $fieldName) {
+ foreach ($value as $fieldId => &$fieldName) {
+ if (!empty($attributes[$fieldId][$id]['class'])) {
+ $fieldName = array('data' => $fieldName, 'cssClass' => $attributes[$fieldId][$id]['class']);
+ }
if (is_numeric($fieldId)) {
- $fieldName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $fieldId, 'label');
- CRM_Utils_Array::crmReplaceKey($value, $fieldId, $fieldName);
+ $fName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $fieldId, 'label');
+ CRM_Utils_Array::crmReplaceKey($value, $fieldId, $fName);
}
}
$field = $value;
}
if ($editable) {
$fieldAttributes['class'] .= ' crm-editable';
- $headerAttr[$fieldId]['class'] = 'crm-editable';
}
$attributes[$fieldId][$recId] = $fieldAttributes;
$actionParams['cs'] = $pageCheckSum;
}
- $value['links'] = CRM_Core_Action::formLink(
+ $value['action'] = CRM_Core_Action::formLink(
$links,
$linkAction,
$actionParams,
<tr>
{if $pageViewType eq 'customDataView'}
{foreach from=$headers key=recId item=head}
- <th data-data={ts}'{$head}'{/ts} cell-class="{$headerAttr.$recId.class}"
+ <th data-data={ts}'{$head}'{/ts}
{if !empty($headerAttr.$recId.dataType)}cell-data-type="{$headerAttr.$recId.dataType}"{/if}
{if !empty($headerAttr.$recId.dataEmptyOption)}cell-data-empty-option="{$headerAttr.$recId.dataEmptyOption}"{/if}>{ts}{$head}{/ts}
</th>
{/foreach}
- <th data-data="links" data-orderable="false"> </th>
+ <th data-data="action" data-orderable="false"> </th>
</tr>
</thead>
{literal}
<script type="text/javascript">
(function($) {
+ var ZeroRecordText = {/literal}'{ts 1=$customGroupTitle}No records of type \'%1\' found.{/ts}'{literal};
$('table.crm-multifield-selector').data({
"ajax": {
"url": {/literal}'{crmURL p="civicrm/ajax/multirecordfieldlist" h=0 q="snippet=4&cid=$contactId&cgid=$customGroupId"}'{literal},
},
"aaSorting": [],
"pageLength": 10,
+ "language": {
+ "zeroRecords": ZeroRecordText,
+ },
+ //Add class attributes to cells
+ "fnRowCallback": function(nRow, aData) {
+ $('thead th').each( function( index ) {
+ var fName = $(this).attr('data-data');
+ var cell = $('td:eq(' + index + ')', nRow);
+ if (typeof aData[fName]=='object'){
+ if (typeof aData[fName].data != 'undefined') {
+ $(cell).html(aData[fName].data);
+ }
+ if (typeof aData[fName].cssClass != 'undefined') {
+ $(cell).attr('class', aData[fName].cssClass);
+ }
+ }
+ });
+ return nRow;
+ },
})
+
$(".crm-multifield-selector").on('click','.delete-custom-row', function (e) {
var $el = $(this);
CRM.confirm({