本文整理汇总了PHP中CRM_Core_BAO_CustomGroup::hasReachedMaxLimit方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CustomGroup::hasReachedMaxLimit方法的具体用法?PHP CRM_Core_BAO_CustomGroup::hasReachedMaxLimit怎么用?PHP CRM_Core_BAO_CustomGroup::hasReachedMaxLimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_CustomGroup
的用法示例。
在下文中一共展示了CRM_Core_BAO_CustomGroup::hasReachedMaxLimit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
//.........这里部分代码省略.........
}
$dao->free();
if (!CRM_Utils_Array::value('is_active', $this->_ufGroup)) {
CRM_Core_Error::fatal(ts('The requested profile (gid=%1) is inactive or does not exist.', array(1 => $this->_gid)));
}
}
$this->assign('ufGroupName', $this->_ufGroup['name']);
$gids = empty($this->_profileIds) ? $this->_gid : $this->_profileIds;
// if we dont have a gid use the default, else just use that specific gid
if (($this->_mode == self::MODE_REGISTER || $this->_mode == self::MODE_CREATE) && !$this->_gid) {
$this->_ctype = CRM_Utils_Request::retrieve('ctype', 'String', $this, FALSE, 'Individual', 'REQUEST');
$this->_fields = CRM_Core_BAO_UFGroup::getRegistrationFields($this->_action, $this->_mode, $this->_ctype);
} elseif ($this->_mode == self::MODE_SEARCH) {
$this->_fields = CRM_Core_BAO_UFGroup::getListingFields($this->_action, CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY | CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY, FALSE, $gids, TRUE, NULL, $this->_skipPermission, CRM_Core_Permission::SEARCH);
} else {
$this->_fields = CRM_Core_BAO_UFGroup::getFields($gids, FALSE, NULL, NULL, NULL, FALSE, NULL, $this->_skipPermission, NULL, $this->_action == CRM_Core_Action::ADD ? CRM_Core_Permission::CREATE : CRM_Core_Permission::EDIT);
$multiRecordFieldListing = FALSE;
//using selector for listing of multirecord fields
if ($this->_mode == self::MODE_EDIT && $this->_gid) {
CRM_Core_BAO_UFGroup::shiftMultiRecordFields($this->_fields, $this->_multiRecordFields);
if ($this->_multiRecord) {
if ($this->_multiRecord != CRM_Core_Action::ADD) {
$this->_recordId = CRM_Utils_Request::retrieve('recordId', 'Positive', $this);
} else {
$this->_recordId = NULL;
$this->set('recordId', NULL);
}
//record id is necessary for _multiRecord view and update/edit action
if (!$this->_recordId && ($this->_multiRecord == CRM_Core_Action::UPDATE || $this->_multiRecord == CRM_Core_Action::DELETE)) {
CRM_Core_Error::fatal(ts('The requested Profile (gid=%1) requires record id while performing this action', array(1 => $this->_gid)));
} elseif (empty($this->_multiRecordFields)) {
CRM_Core_Error::fatal(ts('No Multi-Record Fields configured for this profile (gid=%1)', array(1 => $this->_gid)));
}
$fieldId = CRM_Core_BAO_CustomField::getKeyID(key($this->_multiRecordFields));
$customGroupDetails = CRM_Core_BAO_CustomGroup::getGroupTitles(array($fieldId));
$this->_customGroupTitle = $customGroupDetails[$fieldId]['groupTitle'];
$this->_customGroupId = $customGroupDetails[$fieldId]['groupID'];
if ($this->_multiRecord == CRM_Core_Action::UPDATE || $this->_multiRecord == CRM_Core_Action::DELETE) {
//record exists check
foreach ($this->_multiRecordFields as $key => $field) {
$fieldIds[] = CRM_Core_BAO_CustomField::getKeyID($key);
}
$getValues = CRM_Core_BAO_CustomValueTable::getEntityValues($this->_id, NULL, $fieldIds, TRUE);
if (array_key_exists($this->_recordId, $getValues)) {
$this->_recordExists = TRUE;
} else {
$this->_recordExists = FALSE;
if ($this->_multiRecord & CRM_Core_Action::UPDATE) {
CRM_Core_Session::setStatus(ts('Note: The record %1 doesnot exists. Upon save a new record will be create', array(1 => $this->_recordId)), ts('Record doesnot exist'), 'alert');
}
}
}
if ($this->_multiRecord & CRM_Core_Action::ADD) {
$this->_maxRecordLimit = CRM_Core_BAO_CustomGroup::hasReachedMaxLimit($customGroupDetails[$fieldId]['groupID'], $this->_id);
if ($this->_maxRecordLimit) {
CRM_Core_Session::setStatus(ts('You cannot add a new record as maximum allowed limit is reached'), ts('Sorry'), 'error');
}
}
} elseif (!empty($this->_multiRecordFields) && (!$this->_multiRecord || !in_array($this->_multiRecord, array(CRM_Core_Action::DELETE, CRM_Core_Action::UPDATE)))) {
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header');
//multirecord listing page
$multiRecordFieldListing = TRUE;
$page = new CRM_Profile_Page_MultipleRecordFieldsListing();
$cs = $this->get('cs');
$page->set('pageCheckSum', $cs);
$page->set('contactId', $this->_id);
$page->set('profileId', $this->_gid);
$page->set('action', CRM_Core_Action::BROWSE);
$page->set('multiRecordFieldListing', $multiRecordFieldListing);
$page->run();
}
}
$this->assign('multiRecordFieldListing', $multiRecordFieldListing);
// is profile double-opt in?
if (!empty($this->_fields['group']) && CRM_Core_BAO_UFGroup::isProfileDoubleOptin()) {
$emailField = FALSE;
foreach ($this->_fields as $name => $values) {
if (substr($name, 0, 6) == 'email-') {
$emailField = TRUE;
}
}
if (!$emailField) {
$status = ts("Email field should be included in profile if you want to use Group(s) when Profile double-opt in process is enabled.");
$this->_session->setStatus($status);
}
}
//transferring all the multi-record custom fields in _fields
if ($this->_multiRecord && !empty($this->_multiRecordFields)) {
$this->_fields = $this->_multiRecordFields;
$this->_multiRecordProfile = TRUE;
} elseif ($this->_multiRecord && empty($this->_multiRecordFields)) {
CRM_Core_Session::setStatus(ts('This feature is not currently available.'), ts('Sorry'), 'error');
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm', 'reset=1'));
}
}
if (!is_array($this->_fields)) {
CRM_Core_Session::setStatus(ts('This feature is not currently available.'), ts('Sorry'), 'error');
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm', 'reset=1'));
}
}
示例2: preProcess
/**
* Pre processing work done here.
*
* Gets session variables for table name, id of entity in table, type of entity and stores them.
*/
public function preProcess()
{
$this->_cdType = CRM_Utils_Array::value('type', $_GET);
$this->assign('cdType', FALSE);
$this->_multiRecordDisplay = CRM_Utils_Request::retrieve('multiRecordDisplay', 'String', $this);
if ($this->_cdType || $this->_multiRecordDisplay == 'single') {
if ($this->_cdType) {
$this->assign('cdType', TRUE);
}
// NOTE : group id is not stored in session from within CRM_Custom_Form_CustomData::preProcess func
// this is due to some condition inside it which restricts it from saving in session
// so doing this for multi record edit action
$entityId = CRM_Utils_Request::retrieve('entityID', 'Positive', $this);
if (!empty($entityId)) {
$subType = CRM_Contact_BAO_Contact::getContactSubType($entityId, ',');
}
CRM_Custom_Form_CustomData::preProcess($this, NULL, $subType, NULL, NULL, $entityId);
if ($this->_multiRecordDisplay) {
$this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive', $this);
$this->_tableID = $this->_entityId;
$this->_contactType = CRM_Contact_BAO_Contact::getContactType($this->_tableID);
$mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
$hasReachedMax = CRM_Core_BAO_CustomGroup::hasReachedMaxLimit($this->_groupID, $this->_tableID);
if ($hasReachedMax && $mode == 'add') {
CRM_Core_Error::statusBounce(ts('The maximum record limit is reached'));
}
$this->_copyValueId = CRM_Utils_Request::retrieve('copyValueId', 'Positive', $this);
$groupTitle = CRM_Core_BAO_CustomGroup::getTitle($this->_groupID);
$mode = CRM_Utils_Request::retrieve('mode', 'String', CRM_Core_DAO::$_nullObject, FALSE, NULL, 'GET');
$mode = ucfirst($mode);
CRM_Utils_System::setTitle(ts('%1 %2 Record', array(1 => $mode, 2 => $groupTitle)));
if (!empty($_POST['hidden_custom'])) {
$this->assign('postedInfo', TRUE);
}
}
return;
}
$this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive', $this, TRUE);
$this->_tableID = CRM_Utils_Request::retrieve('tableId', 'Positive', $this, TRUE);
$this->_contactType = CRM_Contact_BAO_Contact::getContactType($this->_tableID);
$this->_contactSubType = CRM_Contact_BAO_Contact::getContactSubType($this->_tableID, ',');
$this->assign('contact_type', $this->_contactType);
$this->assign('contact_subtype', $this->_contactSubType);
list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($this->_tableID);
CRM_Utils_System::setTitle($displayName, $contactImage . ' ' . $displayName);
// when custom data is included in this page
if (!empty($_POST['hidden_custom'])) {
for ($i = 1; $i <= $_POST['hidden_custom_group_count'][$this->_groupID]; $i++) {
CRM_Custom_Form_CustomData::preProcess($this, NULL, $this->_contactSubType, $i, $this->_contactType, $this->_tableID);
CRM_Custom_Form_CustomData::buildQuickForm($this);
CRM_Custom_Form_CustomData::setDefaultValues($this);
}
}
}
示例3: browse
/**
* Browse the listing
*
* @return void
* @access public
*/
function browse()
{
if ($this->_profileId) {
$fields = CRM_Core_BAO_UFGroup::getFields($this->_profileId, FALSE, NULL, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission::EDIT);
$multiRecordFields = array();
$fieldIDs = NULL;
$result = NULL;
$multiRecordFieldsWithSummaryListing = CRM_Core_BAO_UFGroup::shiftMultiRecordFields($fields, $multiRecordFields, TRUE);
$multiFieldId = CRM_Core_BAO_CustomField::getKeyID(key($multiRecordFields));
$customGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $multiFieldId, 'custom_group_id');
$reached = CRM_Core_BAO_CustomGroup::hasReachedMaxLimit($customGroupId, $this->_contactId);
if (!$reached) {
$this->assign('contactId', $this->_contactId);
$this->assign('gid', $this->_profileId);
}
$this->assign('reachedMax', $reached);
if ($multiRecordFieldsWithSummaryListing && !empty($multiRecordFieldsWithSummaryListing)) {
$fieldIDs = array_keys($multiRecordFieldsWithSummaryListing);
}
}
if ($fieldIDs && !empty($fieldIDs) && $this->_contactId) {
$options = array();
$returnProperities = array('html_type', 'data_type', 'date_format', 'time_format');
foreach ($fieldIDs as $key => $fieldID) {
$fieldIDs[$key] = CRM_Core_BAO_CustomField::getKeyID($fieldID);
$param = array('id' => $fieldIDs[$key]);
$returnValues = array();
CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $param, $returnValues, $returnProperities);
$optionValuePairs = CRM_Core_BAO_CustomOption::getCustomOption($fieldIDs[$key]);
if (!empty($optionValuePairs)) {
foreach ($optionValuePairs as $optionPairs) {
$options[$fieldIDs[$key]][$optionPairs['value']] = $optionPairs['label'];
}
}
$options[$fieldIDs[$key]]['attributes']['html_type'] = $returnValues['html_type'];
$options[$fieldIDs[$key]]['attributes']['data_type'] = $returnValues['data_type'];
$options[$fieldIDs[$key]]['attributes']['format'] = $options[$fieldIDs[$key]]['attributes']['date_format'] = CRM_Utils_Array::value('date_format', $returnValues);
$options[$fieldIDs[$key]]['attributes']['time_format'] = CRM_Utils_Array::value('time_format', $returnValues);
}
$result = CRM_Core_BAO_CustomValueTable::getEntityValues($this->_contactId, NULL, $fieldIDs, TRUE);
if (!empty($fieldIDs)) {
//get the group info of multi rec fields in listing view
$fieldInput = $fieldIDs;
$fieldIdInput = $fieldIDs[0];
} else {
//if no listing fields exist, take the group title for display
$nonListingFieldIds = array_keys($multiRecordFields);
$singleField = CRM_Core_BAO_CustomField::getKeyID($nonListingFieldIds[0]);
$fieldIdInput = $singleField;
$singleField = array($singleField);
$fieldInput = $singleField;
}
$customGroupInfo = CRM_Core_BAO_CustomGroup::getGroupTitles($fieldInput);
$this->_customGroupTitle = $customGroupInfo[$fieldIdInput]['groupTitle'];
if ($result && !empty($result)) {
$links = self::links();
$pageCheckSum = $this->get('pageCheckSum');
if ($pageCheckSum) {
foreach ($links as $key => $link) {
$links[$key] = $link['qs'] . "&cs=%%cs%%";
}
}
$linkAction = array_sum(array_keys($this->links()));
foreach ($result as $recId => &$value) {
foreach ($value as $fieldId => &$val) {
if (is_numeric($fieldId)) {
$customValue =& $val;
$customValue = CRM_Core_BAO_CustomField::getDisplayValue($customValue, $fieldId, $options);
if (!$customValue) {
$customValue = "";
}
$actionParams = array('recordId' => $recId, 'gid' => $this->_profileId, 'id' => $this->_contactId, 'onPopupClose' => $this->_onPopupClose);
if ($pageCheckSum) {
$actionParams['cs'] = $pageCheckSum;
}
$value['action'] = CRM_Core_Action::formLink($links, $linkAction, $actionParams, ts('more'), FALSE, 'profile.multiValue.row', 'customValue', $fieldId);
}
}
}
}
}
$headers = array();
if (!empty($fieldIDs)) {
foreach ($fieldIDs as $fieldID) {
$headers[$fieldID] = $customGroupInfo[$fieldID]['fieldLabel'];
}
}
$this->assign('customGroupTitle', $this->_customGroupTitle);
$this->assign('headers', $headers);
$this->assign('records', $result);
}
示例4: browse
/**
* Browse the listing.
*
* @return void
*/
public function browse()
{
$dateFields = NULL;
$cgcount = 0;
$attributes = array();
$dateFieldsVals = NULL;
if ($this->_pageViewType == 'profileDataView' && $this->_profileId) {
$fields = CRM_Core_BAO_UFGroup::getFields($this->_profileId, FALSE, NULL, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission::EDIT);
$multiRecordFields = array();
$fieldIDs = NULL;
$result = NULL;
$multiRecordFieldsWithSummaryListing = CRM_Core_BAO_UFGroup::shiftMultiRecordFields($fields, $multiRecordFields, TRUE);
$multiFieldId = CRM_Core_BAO_CustomField::getKeyID(key($multiRecordFields));
$customGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $multiFieldId, 'custom_group_id');
$reached = CRM_Core_BAO_CustomGroup::hasReachedMaxLimit($customGroupId, $this->_contactId);
if (!$reached) {
$this->assign('contactId', $this->_contactId);
$this->assign('gid', $this->_profileId);
}
$this->assign('reachedMax', $reached);
if ($multiRecordFieldsWithSummaryListing && !empty($multiRecordFieldsWithSummaryListing)) {
$fieldIDs = array_keys($multiRecordFieldsWithSummaryListing);
}
} elseif ($this->_pageViewType == 'customDataView') {
// require custom group id for _pageViewType of customDataView
$customGroupId = $this->_customGroupId;
$reached = CRM_Core_BAO_CustomGroup::hasReachedMaxLimit($customGroupId, $this->_contactId);
if (!$reached) {
$this->assign('contactId', $this->_contactId);
$this->assign('customGroupId', $customGroupId);
$this->assign('ctype', $this->_contactType);
}
$this->assign('reachedMax', $reached);
// custom group info : this consists of the field title of group fields
$groupDetail = CRM_Core_BAO_CustomGroup::getGroupDetail($customGroupId, NULL, CRM_Core_DAO::$_nullObject, TRUE);
// field ids of fields in_selector for the custom group id provided
$fieldIDs = array_keys($groupDetail[$customGroupId]['fields']);
// field labels for headers
$fieldLabels = $groupDetail[$customGroupId]['fields'];
// from the above customGroupInfo we can get $this->_customGroupTitle
$this->_customGroupTitle = $groupDetail[$customGroupId]['title'];
}
if ($fieldIDs && !empty($fieldIDs) && $this->_contactId) {
$options = array();
$returnProperities = array('html_type', 'data_type', 'date_format', 'time_format', 'default_value', 'is_required');
foreach ($fieldIDs as $key => $fieldID) {
$fieldIDs[$key] = !is_numeric($fieldID) ? CRM_Core_BAO_CustomField::getKeyID($fieldID) : $fieldID;
$param = array('id' => $fieldIDs[$key]);
$returnValues = array();
CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $param, $returnValues, $returnProperities);
if ($returnValues['data_type'] == 'Date') {
$dateFields[$fieldIDs[$key]] = 1;
$actualPHPFormats = CRM_Core_SelectValues::datePluginToPHPFormats();
$dateFormat = (array) CRM_Utils_Array::value($returnValues['date_format'], $actualPHPFormats);
$timeFormat = CRM_Utils_Array::value('time_format', $returnValues);
}
$optionValuePairs = CRM_Core_BAO_CustomOption::getCustomOption($fieldIDs[$key]);
if (!empty($optionValuePairs)) {
foreach ($optionValuePairs as $optionPairs) {
$options[$fieldIDs[$key]][$optionPairs['value']] = $optionPairs['label'];
}
}
$options[$fieldIDs[$key]]['attributes']['html_type'] = $returnValues['html_type'];
$options[$fieldIDs[$key]]['attributes']['data_type'] = $returnValues['data_type'];
$options[$fieldIDs[$key]]['attributes']['is_required'] = !empty($returnValues['is_required']);
$options[$fieldIDs[$key]]['attributes']['default_value'] = CRM_Utils_Array::value('default_value', $returnValues);
$options[$fieldIDs[$key]]['attributes']['format'] = $options[$fieldIDs[$key]]['attributes']['date_format'] = CRM_Utils_Array::value('date_format', $returnValues);
$options[$fieldIDs[$key]]['attributes']['time_format'] = CRM_Utils_Array::value('time_format', $returnValues);
}
// commonly used for both views i.e profile listing view (profileDataView) and custom data listing view (customDataView)
$result = CRM_Core_BAO_CustomValueTable::getEntityValues($this->_contactId, NULL, $fieldIDs, TRUE);
if ($this->_pageViewType == 'profileDataView') {
if (!empty($fieldIDs)) {
//get the group info of multi rec fields in listing view
$fieldInput = $fieldIDs;
$fieldIdInput = $fieldIDs[0];
} else {
//if no listing fields exist, take the group title for display
$nonListingFieldIds = array_keys($multiRecordFields);
$singleField = CRM_Core_BAO_CustomField::getKeyID($nonListingFieldIds[0]);
$fieldIdInput = $singleField;
$singleField = array($singleField);
$fieldInput = $singleField;
}
$customGroupInfo = CRM_Core_BAO_CustomGroup::getGroupTitles($fieldInput);
$this->_customGroupTitle = $customGroupInfo[$fieldIdInput]['groupTitle'];
}
// $cgcount is defined before 'if' condition as enitiy may have no record
// and $cgcount is used to build new record url
$cgcount = 1;
if ($result && !empty($result)) {
$links = self::links();
if ($this->_pageViewType == 'profileDataView') {
$pageCheckSum = $this->get('pageCheckSum');
if ($pageCheckSum) {
//.........这里部分代码省略.........
示例5: browse
/**
* Browse the listing
*
* @return void
* @access public
*/
function browse()
{
$dateFields = NULL;
$cgcount = 0;
$dateFieldsVals = NULL;
if ($this->_pageViewType == 'profileDataView' && $this->_profileId) {
$fields = CRM_Core_BAO_UFGroup::getFields($this->_profileId, FALSE, NULL, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission::EDIT);
$multiRecordFields = array();
$fieldIDs = NULL;
$result = NULL;
$multiRecordFieldsWithSummaryListing = CRM_Core_BAO_UFGroup::shiftMultiRecordFields($fields, $multiRecordFields, TRUE);
$multiFieldId = CRM_Core_BAO_CustomField::getKeyID(key($multiRecordFields));
$customGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $multiFieldId, 'custom_group_id');
$reached = CRM_Core_BAO_CustomGroup::hasReachedMaxLimit($customGroupId, $this->_contactId);
if (!$reached) {
$this->assign('contactId', $this->_contactId);
$this->assign('gid', $this->_profileId);
}
$this->assign('reachedMax', $reached);
if ($multiRecordFieldsWithSummaryListing && !empty($multiRecordFieldsWithSummaryListing)) {
$fieldIDs = array_keys($multiRecordFieldsWithSummaryListing);
}
} elseif ($this->_pageViewType == 'customDataView') {
// require custom group id for _pageViewType of customDataView
$customGroupId = $this->_customGroupId;
$reached = CRM_Core_BAO_CustomGroup::hasReachedMaxLimit($customGroupId, $this->_contactId);
if (!$reached) {
$this->assign('contactId', $this->_contactId);
$this->assign('customGroupId', $customGroupId);
$this->assign('ctype', $this->_contactType);
}
$this->assign('reachedMax', $reached);
// custom group info : this consists of the field title of group fields
$groupDetail = CRM_Core_BAO_CustomGroup::getGroupDetail($customGroupId, NULL, CRM_Core_DAO::$_nullObject, TRUE);
// field ids of fields in_selector for the custom group id provided
$fieldIDs = array_keys($groupDetail[$customGroupId]['fields']);
// field labels for headers
$fieldLabels = $groupDetail[$customGroupId]['fields'];
// from the above customGroupInfo we can get $this->_customGroupTitle
$this->_customGroupTitle = $groupDetail[$customGroupId]['title'];
}
if ($fieldIDs && !empty($fieldIDs) && $this->_contactId) {
$options = array();
$returnProperities = array('html_type', 'data_type', 'date_format', 'time_format');
foreach ($fieldIDs as $key => $fieldID) {
$fieldIDs[$key] = !is_numeric($fieldID) ? CRM_Core_BAO_CustomField::getKeyID($fieldID) : $fieldID;
$param = array('id' => $fieldIDs[$key]);
$returnValues = array();
CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $param, $returnValues, $returnProperities);
if ($returnValues['data_type'] == 'Date') {
$dateFields[$fieldIDs[$key]] = 1;
}
$optionValuePairs = CRM_Core_BAO_CustomOption::getCustomOption($fieldIDs[$key]);
if (!empty($optionValuePairs)) {
foreach ($optionValuePairs as $optionPairs) {
$options[$fieldIDs[$key]][$optionPairs['value']] = $optionPairs['label'];
}
}
$options[$fieldIDs[$key]]['attributes']['html_type'] = $returnValues['html_type'];
$options[$fieldIDs[$key]]['attributes']['data_type'] = $returnValues['data_type'];
$options[$fieldIDs[$key]]['attributes']['format'] = $options[$fieldIDs[$key]]['attributes']['date_format'] = CRM_Utils_Array::value('date_format', $returnValues);
$options[$fieldIDs[$key]]['attributes']['time_format'] = CRM_Utils_Array::value('time_format', $returnValues);
}
// commonly used for both views i.e profile listing view (profileDataView) and custom data listing view (customDataView)
$result = CRM_Core_BAO_CustomValueTable::getEntityValues($this->_contactId, NULL, $fieldIDs, TRUE);
if ($this->_pageViewType == 'profileDataView') {
if (!empty($fieldIDs)) {
//get the group info of multi rec fields in listing view
$fieldInput = $fieldIDs;
$fieldIdInput = $fieldIDs[0];
} else {
//if no listing fields exist, take the group title for display
$nonListingFieldIds = array_keys($multiRecordFields);
$singleField = CRM_Core_BAO_CustomField::getKeyID($nonListingFieldIds[0]);
$fieldIdInput = $singleField;
$singleField = array($singleField);
$fieldInput = $singleField;
}
$customGroupInfo = CRM_Core_BAO_CustomGroup::getGroupTitles($fieldInput);
$this->_customGroupTitle = $customGroupInfo[$fieldIdInput]['groupTitle'];
}
// $cgcount is defined before 'if' condition as enitiy may have no record
// and $cgcount is used to build new record url
$cgcount = 1;
if ($result && !empty($result)) {
$links = self::links();
if ($this->_pageViewType == 'profileDataView') {
$pageCheckSum = $this->get('pageCheckSum');
if ($pageCheckSum) {
foreach ($links as $key => $link) {
$links[$key] = $link['qs'] . "&cs=%%cs%%";
}
}
}
//.........这里部分代码省略.........