本文整理汇总了PHP中CRM_Core_BAO_CustomGroup::getGroupDetail方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CustomGroup::getGroupDetail方法的具体用法?PHP CRM_Core_BAO_CustomGroup::getGroupDetail怎么用?PHP CRM_Core_BAO_CustomGroup::getGroupDetail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_CustomGroup
的用法示例。
在下文中一共展示了CRM_Core_BAO_CustomGroup::getGroupDetail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* Pre processing work done here.
*
* gets session variables for group or field id
*
* @return void
*/
public function preProcess()
{
// get the controller vars
$this->_groupId = $this->get('groupId');
$this->_fieldId = $this->get('fieldId');
if ($this->_fieldId) {
// field preview
$defaults = array();
$params = array('id' => $this->_fieldId);
$fieldDAO = new CRM_Core_DAO_CustomField();
CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $defaults);
if (!empty($defaults['is_view'])) {
CRM_Core_Error::statusBounce(ts('This field is view only so it will not display on edit form.'));
} elseif (CRM_Utils_Array::value('is_active', $defaults) == 0) {
CRM_Core_Error::statusBounce(ts('This field is inactive so it will not display on edit form.'));
}
$groupTree = array();
$groupTree[$this->_groupId]['id'] = 0;
$groupTree[$this->_groupId]['fields'] = array();
$groupTree[$this->_groupId]['fields'][$this->_fieldId] = $defaults;
$this->_groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree, 1, $this);
$this->assign('preview_type', 'field');
} else {
$groupTree = CRM_Core_BAO_CustomGroup::getGroupDetail($this->_groupId);
$this->_groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree, TRUE, $this);
$this->assign('preview_type', 'group');
}
}
示例2: preProcess
/**
* pre processing work done here.
*
* gets session variables for group or field id
*
* @param null
*
* @return void
* @access public
*/
function preProcess()
{
// get the controller vars
$groupId = $this->get('groupId');
$fieldId = $this->get('fieldId');
if ($fieldId) {
// field preview
$defaults = array();
$params = array('id' => $fieldId);
$fieldDAO =& new CRM_Core_DAO_CustomField();
CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $defaults);
$this->_groupTree = array();
$this->_groupTree[0]['id'] = 0;
$this->_groupTree[0]['fields'] = array();
$this->_groupTree[0]['fields'][$fieldId] = $defaults;
$this->assign('preview_type', 'field');
} else {
// group preview
$this->_groupTree = CRM_Core_BAO_CustomGroup::getGroupDetail($groupId);
$this->assign('preview_type', 'group');
}
}
示例3: buildSearchForm
/**
* add all the elements shared between contribute search and advnaced search
*
* @access public
*
* @return void
* @static
*/
static function buildSearchForm(&$form)
{
//added contribution source
$form->addElement('text', 'contribution_source', ts('Contribution Source'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'source'));
CRM_Core_Form_Date::buildDateRange($form, 'contribution_date', 1, '_low', '_high', ts('From'), FALSE, FALSE);
$form->add('text', 'contribution_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addRule('contribution_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
$form->add('text', 'contribution_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('contribution_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
//adding select option for curreny type -- CRM-4711
$form->add('select', 'contribution_currency_type', ts('Currency Type'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::currencySymbols('name'));
$form->add('select', 'contribution_type_id', ts('Contribution Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType());
$form->add('select', 'contribution_page_id', ts('Contribution Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage());
$form->add('select', 'contribution_payment_instrument_id', ts('Payment Instrument'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument());
$form->add('select', 'contribution_pcp_made_through_id', ts('Personal Campaign Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::pcPage());
$status = array();
$statusValues = CRM_Core_OptionGroup::values("contribution_status");
// Remove status values that are only used for recurring contributions or pledges (In Progress, Overdue).
unset($statusValues['5']);
unset($statusValues['6']);
foreach ($statusValues as $key => $val) {
$status[] = $form->createElement('advcheckbox', $key, NULL, $val);
}
$form->addGroup($status, 'contribution_status_id', ts('Contribution Status'));
// add null checkboxes for thank you and receipt
$form->addElement('checkbox', 'contribution_thankyou_date_isnull', ts('Thank-you date not set?'));
$form->addElement('checkbox', 'contribution_receipt_date_isnull', ts('Receipt not sent?'));
//add fields for honor search
$form->addElement('text', 'contribution_in_honor_of', ts("In Honor Of"));
$form->addElement('checkbox', 'contribution_test', ts('Find Test Contributions?'));
$form->addElement('checkbox', 'contribution_pay_later', ts('Find Pay Later Contributions?'));
//add field for transaction ID search
$form->addElement('text', 'contribution_transaction_id', ts("Transaction ID"));
$form->addElement('checkbox', 'contribution_recurring', ts('Find Recurring Contributions?'));
$form->addElement('checkbox', 'contribution_recurring_isnull', ts('Find Non Recurring Contributions?'));
$form->addElement('text', 'contribution_check_number', ts('Check Number'));
//add field for pcp display in roll search
$form->addYesNo('contribution_pcp_display_in_roll', ts('Personal Campaign Page Honor Roll?'));
// add all the custom searchable fields
$contribution = array('Contribution');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $contribution);
if ($groupDetails) {
$form->assign('contributeGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'contribution_campaign_id');
// add batch select
$batches = CRM_Core_BAO_Batch::getBatches();
if (!empty($batches)) {
$form->add('select', 'contribution_batch_id', ts('Batch Name'), array('' => ts('- select -')) + $batches);
}
$form->assign('validCiviContribute', TRUE);
}
示例4: copyCustomValues
function copyCustomValues($recurId, $targetContributionId)
{
if ($recurId && $targetContributionId) {
// get the initial contribution id of recur id
$sourceContributionId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $recurId, 'id', 'contribution_recur_id');
// if the same contribution is being proccessed then return
if ($sourceContributionId == $targetContributionId) {
return;
}
// check if proper recurring contribution record is being processed
$targetConRecurId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $targetContributionId, 'contribution_recur_id');
if ($targetConRecurId != $recurId) {
return;
}
// copy custom data
$extends = array('Contribution');
$groupTree = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, NULL, $extends);
if ($groupTree) {
foreach ($groupTree as $groupID => $group) {
$table[$groupTree[$groupID]['table_name']] = array('entity_id');
foreach ($group['fields'] as $fieldID => $field) {
$table[$groupTree[$groupID]['table_name']][] = $groupTree[$groupID]['fields'][$fieldID]['column_name'];
}
}
foreach ($table as $tableName => $tableColumns) {
$insert = 'INSERT INTO ' . $tableName . ' (' . implode(', ', $tableColumns) . ') ';
$tableColumns[0] = $targetContributionId;
$select = 'SELECT ' . implode(', ', $tableColumns);
$from = ' FROM ' . $tableName;
$where = " WHERE {$tableName}.entity_id = {$sourceContributionId}";
$query = $insert . $select . $from . $where;
$dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
}
}
}
}
示例5: buildSearchForm
/**
* Build the search form.
*
* @param CRM_Core_Form $form
*/
public static function buildSearchForm(&$form)
{
$membershipStatus = CRM_Member_PseudoConstant::membershipStatus();
$form->add('select', 'membership_status_id', ts('Membership Status(s)'), $membershipStatus, FALSE, array('id' => 'membership_status_id', 'multiple' => 'multiple', 'class' => 'crm-select2'));
$form->addEntityRef('membership_type_id', ts('Membership Type(s)'), array('entity' => 'MembershipType', 'multiple' => TRUE, 'placeholder' => ts('- any -'), 'select' => array('minimumInputLength' => 0)));
$form->addElement('text', 'member_source', ts('Source'));
CRM_Core_Form_Date::buildDateRange($form, 'member_join_date', 1, '_low', '_high', ts('From'), FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'member_start_date', 1, '_low', '_high', ts('From'), FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'member_end_date', 1, '_low', '_high', ts('From'), FALSE);
$form->addYesNo('member_is_primary', ts('Primary Member?'), TRUE);
$form->addYesNo('member_pay_later', ts('Pay Later?'), TRUE);
$form->addYesNo('member_auto_renew', ts('Auto-Renew?'), TRUE);
$form->addYesNo('member_test', ts('Membership is a Test?'), TRUE);
$form->addYesNo('member_is_override', ts('Membership Status Is Override?'), TRUE);
// add all the custom searchable fields
$extends = array('Membership');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
if ($groupDetails) {
$form->assign('membershipGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'member_campaign_id');
$form->assign('validCiviMember', TRUE);
$form->setDefaults(array('member_test' => 0));
}
示例6: copy
/**
* This function is to make a copy of a Event, including
* all the fields in the event Wizard
*
* @param int $id the event id to copy
*
* @return void
* @access public
*/
static function copy($id)
{
$defaults = $eventValues = array();
//get the require event values.
$eventParams = array('id' => $id);
$returnProperties = array('loc_block_id', 'is_show_location', 'default_fee_id', 'default_discount_fee_id');
CRM_Core_DAO::commonRetrieve('CRM_Event_DAO_Event', $eventParams, $eventValues, $returnProperties);
// since the location is sharable, lets use the same loc_block_id.
$locBlockId = CRM_Utils_Array::value('loc_block_id', $eventValues);
$fieldsFix = array('prefix' => array('title' => ts('Copy of') . ' '));
if (!CRM_Utils_Array::value('is_show_location', $eventValues)) {
$fieldsFix['prefix']['is_show_location'] = 0;
}
$copyEvent =& CRM_Core_DAO::copyGeneric('CRM_Event_DAO_Event', array('id' => $id), array('loc_block_id' => $locBlockId ? $locBlockId : null), $fieldsFix);
$copyPriceSet =& CRM_Core_DAO::copyGeneric('CRM_Price_DAO_SetEntity', array('entity_id' => $id, 'entity_table' => 'civicrm_event'), array('entity_id' => $copyEvent->id));
$copyUF =& CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFJoin', array('entity_id' => $id, 'entity_table' => 'civicrm_event'), array('entity_id' => $copyEvent->id));
$copyTellFriend =& CRM_Core_DAO::copyGeneric('CRM_Friend_DAO_Friend', array('entity_id' => $id, 'entity_table' => 'civicrm_event'), array('entity_id' => $copyEvent->id));
require_once "CRM/Core/BAO/OptionGroup.php";
//copy option Group and values
$copyEvent->default_fee_id = CRM_Core_BAO_OptionGroup::copyValue('event', $id, $copyEvent->id, CRM_Utils_Array::value('default_fee_id', $eventValues));
//copy discounted fee levels
require_once 'CRM/Core/BAO/Discount.php';
$discount = CRM_Core_BAO_Discount::getOptionGroup($id, 'civicrm_event');
if (!empty($discount)) {
foreach ($discount as $discountOptionGroup) {
$name = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $discountOptionGroup);
$length = substr_compare($name, "civicrm_event.amount." . $id, 0);
$discountSuffix = substr($name, $length * -1);
$copyEvent->default_discount_fee_id = CRM_Core_BAO_OptionGroup::copyValue('event', $id, $copyEvent->id, CRM_Utils_Array::value('default_discount_fee_id', $eventValues), $discountSuffix);
}
}
//copy custom data
require_once 'CRM/Core/BAO/CustomGroup.php';
$extends = array('event');
$groupTree = CRM_Core_BAO_CustomGroup::getGroupDetail(null, null, $extends);
if ($groupTree) {
foreach ($groupTree as $groupID => $group) {
$table[$groupTree[$groupID]['table_name']] = array('entity_id');
foreach ($group['fields'] as $fieldID => $field) {
$table[$groupTree[$groupID]['table_name']][] = $groupTree[$groupID]['fields'][$fieldID]['column_name'];
}
}
foreach ($table as $tableName => $tableColumns) {
$insert = 'INSERT INTO ' . $tableName . ' (' . implode(', ', $tableColumns) . ') ';
$tableColumns[0] = $copyEvent->id;
$select = 'SELECT ' . implode(', ', $tableColumns);
$from = ' FROM ' . $tableName;
$where = " WHERE {$tableName}.entity_id = {$id}";
$query = $insert . $select . $from . $where;
$dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
}
}
$copyEvent->save();
require_once 'CRM/Utils/Hook.php';
CRM_Utils_Hook::copy('Event', $copyEvent);
return $copyEvent;
}
示例7: testGetGroupDetail
/**
* Function to test getGroupDetail()
*/
function testGetGroupDetail()
{
$customGrouptitle = 'My Custom Group';
$groupParams = array('title' => $customGrouptitle, 'name' => 'my_custom_group', 'extends' => 'Individual', 'help_pre' => 'Custom Group Help Pre', 'help_post' => 'Custom Group Help Post', 'is_active' => 1, 'collapse_display' => 1);
$customGroup = Custom::createGroup($groupParams);
$customGroupId = $customGroup->id;
$fieldParams = array('custom_group_id' => $customGroupId, 'label' => 'Test Custom Field', 'html_type' => 'Text', 'data_type' => 'String', 'is_required' => 1, 'is_searchable' => 0, 'is_active' => 1);
$customField = Custom::createField($fieldParams);
$customFieldId = $customField->id;
require_once 'CRM/Core/BAO/CustomGroup.php';
$groupTree = CRM_Core_BAO_CustomGroup::getGroupDetail($customGroupId);
$dbCustomGroupTitle = $this->assertDBNotNull('CRM_Core_DAO_CustomGroup', $customGroupId, 'title', 'id', 'Database check for custom group record.');
//check retieve values of custom group
unset($groupParams['is_active']);
$this->assertAttributesEquals($groupParams, $groupTree[$customGroupId]);
//check retieve values of custom field
unset($fieldParams['is_active']);
unset($fieldParams['custom_group_id']);
$this->assertAttributesEquals($fieldParams, $groupTree[$customGroupId]['fields'][$customFieldId]);
//cleanup DB by deleting customGroup
Custom::deleteField($customField);
Custom::deleteGroup($customGroup);
}
示例8: buildSearchForm
/**
* @param CRM_Core_Form $form
*/
public static function buildSearchForm(&$form)
{
// pledge related dates
CRM_Core_Form_Date::buildDateRange($form, 'pledge_start_date', 1, '_low', '_high', ts('From'), FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'pledge_end_date', 1, '_low', '_high', ts('From'), FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'pledge_create_date', 1, '_low', '_high', ts('From'), FALSE);
// pledge payment related dates
CRM_Core_Form_Date::buildDateRange($form, 'pledge_payment_date', 1, '_low', '_high', ts('From'), FALSE);
$form->addYesNo('pledge_test', ts('Pledge is a Test?'), TRUE);
$form->add('text', 'pledge_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addRule('pledge_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
$form->add('text', 'pledge_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('pledge_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
$statusValues = CRM_Contribute_PseudoConstant::contributionStatus();
// Remove status values that are only used for recurring contributions for now (Failed and In Progress).
unset($statusValues['4']);
$form->add('select', 'pledge_status_id', ts('Pledge Status'), $statusValues, FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple'));
//unset in progress for payment
unset($statusValues['5']);
$form->add('select', 'pledge_payment_status_id', ts('Pledge Payment Status'), $statusValues, FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple'));
$form->add('select', 'pledge_financial_type_id', ts('Financial Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType(), FALSE, array('class' => 'crm-select2'));
$form->add('select', 'pledge_contribution_page_id', ts('Contribution Page'), array('' => ts('- any -')) + CRM_Contribute_PseudoConstant::contributionPage(), FALSE, array('class' => 'crm-select2'));
//add fields for pledge frequency
$form->add('text', 'pledge_frequency_interval', ts('Every'), array('size' => 8, 'maxlength' => 8));
$form->addRule('pledge_frequency_interval', ts('Please enter valid Pledge Frequency Interval'), 'integer');
$frequencies = CRM_Core_OptionGroup::values('recur_frequency_units');
foreach ($frequencies as $val => $label) {
$freqUnitsDisplay["'{$val}'"] = ts('%1(s)', array(1 => $label));
}
$form->add('select', 'pledge_frequency_unit', ts('Pledge Frequency'), array('' => ts('- any -')) + $freqUnitsDisplay);
// add all the custom searchable fields
$pledge = array('Pledge');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $pledge);
if ($groupDetails) {
$form->assign('pledgeGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'pledge_campaign_id');
$form->assign('validCiviPledge', TRUE);
$form->setDefaults(array('pledge_test' => 0));
}
示例9: custom
/**
* Generate the custom Data Fields based
* on the is_searchable
*
*
* @param $form
*
* @return void
*/
public static function custom(&$form)
{
$form->add('hidden', 'hidden_custom', 1);
$extends = array_merge(array('Contact', 'Individual', 'Household', 'Organization'), CRM_Contact_BAO_ContactType::subTypes());
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
$form->assign('groupTree', $groupDetails);
foreach ($groupDetails as $key => $group) {
$_groupTitle[$key] = $group['name'];
CRM_Core_ShowHideBlocks::links($form, $group['name'], '', '');
$groupId = $group['id'];
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
if ($field['data_type'] == 'Date' && $field['is_search_range']) {
CRM_Core_Form_Date::buildDateRange($form, $elementName, 1, '_from', '_to', ts('From:'), FALSE);
} else {
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
//TODO: validate for only one state if prox_distance isset
}
示例10: custom
/**
* Generate the custom Data Fields based
* on the is_searchable
*
* @access private
* @return void
*/
static function custom(&$form)
{
$form->add('hidden', 'hidden_custom', 1);
$extends = array_merge(array('Contact', 'Individual', 'Household', 'Organization'), CRM_Contact_BAO_ContactType::subTypes());
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(null, true, $extends);
$form->assign('groupTree', $groupDetails);
foreach ($groupDetails as $key => $group) {
$_groupTitle[$key] = $group['name'];
CRM_Core_ShowHideBlocks::links($form, $group['name'], '', '');
$groupId = $group['id'];
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, false, false, true);
}
}
}
示例11: 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) {
//.........这里部分代码省略.........
示例12: printCaseReport
//.........这里部分代码省略.........
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($value['name'] => 'name_' . rand(10000, 100000)));
}
$value['name'] = self::redact($value['name'], TRUE, $report->_redactionStringRules);
if (!empty($value['email']) && !array_key_exists($value['email'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($value['email'] => 'email_' . rand(10000, 100000)));
}
$value['email'] = self::redact($value['email'], TRUE, $report->_redactionStringRules);
if (!empty($value['phone']) && !array_key_exists($value['phone'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($value['phone'] => 'phone_' . rand(10000, 100000)));
}
$value['phone'] = self::redact($value['phone'], TRUE, $report->_redactionStringRules);
}
}
$caseRoles['client'] = CRM_Case_BAO_Case::getContactNames($caseID);
if ($isRedact) {
if (!array_key_exists($caseRoles['client']['sort_name'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($caseRoles['client']['sort_name'] => 'name_' . rand(10000, 100000)));
}
if (!array_key_exists($caseRoles['client']['display_name'], $report->_redactionStringRules)) {
$report->_redactionStringRules[$caseRoles['client']['display_name']] = $report->_redactionStringRules[$caseRoles['client']['sort_name']];
}
$caseRoles['client']['sort_name'] = self::redact($caseRoles['client']['sort_name'], TRUE, $report->_redactionStringRules);
if (!empty($caseRoles['client']['email']) && !array_key_exists($caseRoles['client']['email'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($caseRoles['client']['email'] => 'email_' . rand(10000, 100000)));
}
$caseRoles['client']['email'] = self::redact($caseRoles['client']['email'], TRUE, $report->_redactionStringRules);
if (!empty($caseRoles['client']['phone']) && !array_key_exists($caseRoles['client']['phone'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($caseRoles['client']['phone'] => 'phone_' . rand(10000, 100000)));
}
$caseRoles['client']['phone'] = self::redact($caseRoles['client']['phone'], TRUE, $report->_redactionStringRules);
}
// Retrieve ALL client relationships
$relClient = CRM_Contact_BAO_Relationship::getRelationship($clientID, CRM_Contact_BAO_Relationship::CURRENT, 0, 0, 0, NULL, NULL, FALSE);
foreach ($relClient as $r) {
if ($isRedact) {
if (!array_key_exists($r['name'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($r['name'] => 'name_' . rand(10000, 100000)));
}
if (!array_key_exists($r['display_name'], $report->_redactionStringRules)) {
$report->_redactionStringRules[$r['display_name']] = $report->_redactionStringRules[$r['name']];
}
$r['name'] = self::redact($r['name'], TRUE, $report->_redactionStringRules);
if (!empty($r['phone']) && !array_key_exists($r['phone'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($r['phone'] => 'phone_' . rand(10000, 100000)));
}
$r['phone'] = self::redact($r['phone'], TRUE, $report->_redactionStringRules);
if (!empty($r['email']) && !array_key_exists($r['email'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($r['email'] => 'email_' . rand(10000, 100000)));
}
$r['email'] = self::redact($r['email'], TRUE, $report->_redactionStringRules);
}
if (!array_key_exists($r['id'], $caseRelationships)) {
$otherRelationships[] = $r;
}
}
// Now global contact list that appears on all cases.
$relGlobal = CRM_Case_BAO_Case::getGlobalContacts($globalGroupInfo);
foreach ($relGlobal as &$r) {
if ($isRedact) {
if (!array_key_exists($r['sort_name'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($r['sort_name'] => 'name_' . rand(10000, 100000)));
}
if (!array_key_exists($r['display_name'], $report->_redactionStringRules)) {
$report->_redactionStringRules[$r['display_name']] = $report->_redactionStringRules[$r['sort_name']];
}
$r['sort_name'] = self::redact($r['sort_name'], TRUE, $report->_redactionStringRules);
if (!empty($r['phone']) && !array_key_exists($r['phone'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($r['phone'] => 'phone_' . rand(10000, 100000)));
}
$r['phone'] = self::redact($r['phone'], TRUE, $report->_redactionStringRules);
if (!empty($r['email']) && !array_key_exists($r['email'], $report->_redactionStringRules)) {
$report->_redactionStringRules = CRM_Utils_Array::crmArrayMerge($report->_redactionStringRules, array($r['email'] => 'email_' . rand(10000, 100000)));
}
$r['email'] = self::redact($r['email'], TRUE, $report->_redactionStringRules);
}
}
// Retrieve custom values for cases.
$customValues = CRM_Core_BAO_CustomValueTable::getEntityValues($caseID, 'Case');
$extends = array('case');
$groupTree = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, NULL, $extends);
$caseCustomFields = array();
while (list($gid, $group_values) = each($groupTree)) {
while (list($id, $field_values) = each($group_values['fields'])) {
if (array_key_exists($id, $customValues)) {
$caseCustomFields[$gid]['title'] = $group_values['title'];
$caseCustomFields[$gid]['values'][$id] = array('label' => $field_values['label'], 'value' => $customValues[$id]);
}
}
}
$template->assign('caseRelationships', $caseRelationships);
$template->assign('caseRoles', $caseRoles);
$template->assign('otherRelationships', $otherRelationships);
$template->assign('globalRelationships', $relGlobal);
$template->assign('globalGroupInfo', $globalGroupInfo);
$template->assign('caseCustomFields', $caseCustomFields);
$contents = self::getCaseReport($clientID, $caseID, $activitySetName, $params, $report);
$printReport = CRM_Case_Audit_Audit::run($contents, $clientID, $caseID, TRUE);
echo $printReport;
CRM_Utils_System::civiExit();
}
示例13: buildSearchForm
static function buildSearchForm(&$form)
{
// pledge related dates
$form->addDate('pledge_start_date_low', ts('Payments Start Date - From'), false, array('formatType' => 'relative'));
$form->addDate('pledge_start_date_high', ts('To'), false, array('formatType' => 'relative'));
$form->addDate('pledge_end_date_low', ts('Payments Ended Date - From'), false, array('formatType' => 'relative'));
$form->addDate('pledge_end_date_high', ts('To'), false, array('formatType' => 'relative'));
$form->addDate('pledge_create_date_low', ts('Pledge Made - From'), false, array('formatType' => 'relative'));
$form->addDate('pledge_create_date_high', ts('To'), false, array('formatType' => 'relative'));
// pledge payment related dates
$form->addDate('pledge_payment_date_low', ts('Payment Scheduled - From'), false, array('formatType' => 'relative'));
$form->addDate('pledge_payment_date_high', ts('To'), false, array('formatType' => 'relative'));
$form->addElement('checkbox', 'pledge_test', ts('Find Test Pledges?'));
require_once 'CRM/Utils/Money.php';
$form->add('text', 'pledge_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addRule('pledge_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
$form->add('text', 'pledge_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('pledge_amount_high', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
require_once 'CRM/Contribute/PseudoConstant.php';
$statusValues = CRM_Contribute_PseudoConstant::contributionStatus();
// Remove status values that are only used for recurring contributions for now (Failed and In Progress).
unset($statusValues['4']);
foreach ($statusValues as $key => $val) {
$status[] = $form->createElement('advcheckbox', $key, null, $val);
}
$form->addGroup($status, 'pledge_status_id', ts('Pledge Status'));
//unset in progress for payment
unset($statusValues['5']);
foreach ($statusValues as $key => $val) {
$paymentStatus[] = $form->createElement('advcheckbox', $key, null, $val);
}
$form->addGroup($paymentStatus, 'pledge_payment_status_id', ts('Pledge Payment Status'));
require_once 'CRM/Contribute/PseudoConstant.php';
$form->add('select', 'pledge_contribution_type_id', ts('Contribution Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType());
$form->add('select', 'pledge_contribution_page_id', ts('Contribution Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage());
//add fields for honor search
$form->addElement('text', 'pledge_in_honor_of', ts("In Honor Of"));
// add all the custom searchable fields
require_once 'CRM/Core/BAO/CustomGroup.php';
$pledge = array('Pledge');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(null, true, $pledge);
if ($groupDetails) {
require_once 'CRM/Core/BAO/CustomField.php';
$form->assign('pledgeGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, false, false, true);
}
}
}
$form->assign('validCiviPledge', true);
}
示例14: buildSearchForm
static function buildSearchForm(&$form)
{
$dataURLEvent = CRM_Utils_System::url('civicrm/ajax/event', "reset=1", false, null, false);
$dataURLEventType = CRM_Utils_System::url('civicrm/ajax/eventType', "reset=1", false, null, false);
$dataURLEventFee = CRM_Utils_System::url('civicrm/ajax/eventFee', "reset=1", false, null, false);
$form->assign('dataURLEvent', $dataURLEvent);
$form->assign('dataURLEventType', $dataURLEventType);
$form->assign('dataURLEventFee', $dataURLEventFee);
$eventId =& $form->add('text', 'event_name', ts('Event Name'));
$eventType =& $form->add('text', 'event_type', ts('Event Type'));
$participantFee =& $form->add('text', 'participant_fee_level', ts('Fee Level'));
//elements for assigning value operation
$eventNameId =& $form->add('hidden', 'event_id', '', array('id' => 'event_id'));
$eventTypeId =& $form->add('hidden', 'event_type_id', '', array('id' => 'event_type_id'));
$participantFeeId =& $form->add('hidden', 'participant_fee_id', '', array('id' => 'participant_fee_id'));
$form->addDate('event_start_date_low', ts('Event Dates - From'), false, array('formatType' => 'searchDate'));
$form->addDate('event_end_date_high', ts('To'), false, array('formatType' => 'searchDate'));
require_once 'CRM/Event/PseudoConstant.php';
$status = CRM_Event_PseudoConstant::participantStatus(null, null, 'label');
asort($status);
foreach ($status as $id => $Name) {
$form->_participantStatus =& $form->addElement('checkbox', "participant_status_id[{$id}]", null, $Name);
}
foreach (CRM_Event_PseudoConstant::participantRole() as $rId => $rName) {
$form->_participantRole =& $form->addElement('checkbox', "participant_role_id[{$rId}]", null, $rName);
}
$form->addElement('checkbox', 'participant_test', ts('Find Test Participants?'));
$form->addElement('checkbox', 'participant_pay_later', ts('Find Pay Later Participants?'));
$form->addElement('text', 'participant_fee_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addElement('text', 'participant_fee_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('participant_fee_amount_low', ts('Please enter a valid money value.'), 'money');
$form->addRule('participant_fee_amount_high', ts('Please enter a valid money value.'), 'money');
// add all the custom searchable fields
require_once 'CRM/Core/BAO/CustomGroup.php';
$extends = array('Participant');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(null, true, $extends);
if ($groupDetails) {
require_once 'CRM/Core/BAO/CustomField.php';
$form->assign('participantGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, false, false, true);
}
}
}
$form->assign('validCiviEvent', true);
}
示例15: buildSearchForm
static function buildSearchForm(&$form)
{
$dataURLEvent = CRM_Utils_System::url('civicrm/ajax/event', "reset=1", FALSE, NULL, FALSE);
$dataURLEventType = CRM_Utils_System::url('civicrm/ajax/eventType', "reset=1", FALSE, NULL, FALSE);
$dataURLEventFee = CRM_Utils_System::url('civicrm/ajax/eventFee', "reset=1", FALSE, NULL, FALSE);
$form->assign('dataURLEvent', $dataURLEvent);
$form->assign('dataURLEventType', $dataURLEventType);
$form->assign('dataURLEventFee', $dataURLEventFee);
$eventId =& $form->add('text', 'event_name', ts('Event Name'));
$eventType =& $form->add('text', 'event_type', ts('Event Type'));
$participantFee =& $form->add('text', 'participant_fee_level', ts('Fee Level'));
//elements for assigning value operation
$eventNameId =& $form->add('hidden', 'event_id', '', array('id' => 'event_id'));
$eventTypeId =& $form->add('hidden', 'event_type_id', '', array('id' => 'event_type_id'));
$participantFeeId =& $form->add('hidden', 'participant_fee_id', '', array('id' => 'participant_fee_id'));
CRM_Core_Form_Date::buildDateRange($form, 'event', 1, '_start_date_low', '_end_date_high', ts('From'), FALSE, FALSE);
$status = CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label');
asort($status);
foreach ($status as $id => $Name) {
$form->_participantStatus =& $form->addElement('checkbox', "participant_status_id[{$id}]", NULL, $Name);
}
foreach (CRM_Event_PseudoConstant::participantRole() as $rId => $rName) {
$form->_participantRole =& $form->addElement('checkbox', "participant_role_id[{$rId}]", NULL, $rName);
}
$form->addElement('checkbox', 'participant_test', ts('Find Test Participants?'));
$form->addElement('checkbox', 'participant_pay_later', ts('Find Pay Later Participants?'));
$form->addElement('text', 'participant_fee_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addElement('text', 'participant_fee_amount_high', ts('To'), array('size' => 8, 'maxlength' => 8));
$form->addRule('participant_fee_amount_low', ts('Please enter a valid money value.'), 'money');
$form->addRule('participant_fee_amount_high', ts('Please enter a valid money value.'), 'money');
// add all the custom searchable fields
$extends = array('Participant');
$groupDetails = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, TRUE, $extends);
if ($groupDetails) {
$form->assign('participantGroupTree', $groupDetails);
foreach ($groupDetails as $group) {
foreach ($group['fields'] as $field) {
$fieldId = $field['id'];
$elementName = 'custom_' . $fieldId;
CRM_Core_BAO_CustomField::addQuickFormElement($form, $elementName, $fieldId, FALSE, FALSE, TRUE);
}
}
}
CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'participant_campaign_id');
$form->assign('validCiviEvent', TRUE);
}