本文整理汇总了PHP中CRM_Pledge_BAO_Pledge类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Pledge_BAO_Pledge类的具体用法?PHP CRM_Pledge_BAO_Pledge怎么用?PHP CRM_Pledge_BAO_Pledge使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Pledge_BAO_Pledge类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: civicrm_api3_pledge_delete
/**
* Delete a pledge
*
* @param array $params array included 'pledge_id' of pledge to delete
*
* @return boolean true if success, else false
* @static void
* {@getfields pledge_delete}
* @example PledgeDelete.php
* @access public
*/
function civicrm_api3_pledge_delete($params)
{
if (CRM_Pledge_BAO_Pledge::deletePledge($params['id'])) {
return civicrm_api3_create_success(array('id' => $params['id']), $params, 'pledge', 'delete');
} else {
return civicrm_api3_create_error('Could not delete pledge');
}
}
示例2: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
*
* @return void
*/
public function postProcess()
{
$deletedPledges = 0;
foreach ($this->_pledgeIds as $pledgeId) {
if (CRM_Pledge_BAO_Pledge::deletePledge($pledgeId)) {
$deletedPledges++;
}
}
$status = ts('Deleted Pledge(s): %1 (Total Selected: %2) ', array(1 => $deletedPledges, 2 => count($this->_pledgeIds)));
CRM_Core_Session::setStatus($status, '', 'info');
}
示例3: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
* @return None
*/
public function postProcess()
{
$deletedPledges = 0;
require_once 'CRM/Pledge/BAO/Pledge.php';
foreach ($this->_pledgeIds as $pledgeId) {
if (CRM_Pledge_BAO_Pledge::deletePledge($pledgeId)) {
$deletedPledges++;
}
}
$status = array(ts('Deleted Pledge(s): %1', array(1 => $deletedPledges)), ts('Total Selected Pledge(s): %1', array(1 => count($this->_pledgeIds))));
CRM_Core_Session::setStatus($status);
}
示例4: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
$values = $ids = array();
$params = array('id' => $this->get('id'));
CRM_Pledge_BAO_Pledge::getValues($params, $values, $ids);
$values['frequencyUnit'] = ts('%1(s)', array(1 => $values['frequency_unit']));
if (isset($values["honor_contact_id"]) && $values["honor_contact_id"]) {
$sql = "SELECT display_name FROM civicrm_contact WHERE id = " . $values["honor_contact_id"];
$dao = new CRM_Core_DAO();
$dao->query($sql);
if ($dao->fetch()) {
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$values['honor_contact_id']}");
$values["honor_display"] = "<A href = {$url}>" . $dao->display_name . "</A>";
}
$honor = CRM_Core_PseudoConstant::get('CRM_Pledge_DAO_Pledge', 'honor_type_id');
$values['honor_type'] = $honor[$values['honor_type_id']];
}
//handle custom data.
$groupTree = CRM_Core_BAO_CustomGroup::getTree('Pledge', $this, $params['id']);
CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
if (!empty($values['contribution_page_id'])) {
$values['contribution_page'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $values['contribution_page_id'], 'title');
}
$values['financial_type'] = CRM_Utils_Array::value($values['financial_type_id'], CRM_Contribute_PseudoConstant::financialType());
if ($values['status_id']) {
$values['pledge_status'] = CRM_Utils_Array::value($values['status_id'], CRM_Contribute_PseudoConstant::contributionStatus());
}
$url = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=view&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
$recentOther = array();
if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::UPDATE)) {
$recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=update&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
}
if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::DELETE)) {
$recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=delete&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
}
$displayName = CRM_Contact_BAO_Contact::displayName($values['contact_id']);
$this->assign('displayName', $displayName);
$title = $displayName . ' - (' . ts('Pledged') . ' ' . CRM_Utils_Money::format($values['pledge_amount']) . ' - ' . $values['financial_type'] . ')';
// add Pledge to Recent Items
CRM_Utils_Recent::add($title, $url, $values['id'], 'Pledge', $values['contact_id'], NULL, $recentOther);
// Check if this is default domain contact CRM-10482
if (CRM_Contact_BAO_Contact::checkDomainContact($values['contact_id'])) {
$displayName .= ' (' . ts('default organization') . ')';
}
// omitting contactImage from title for now since the summary overlay css doesn't work outside of our crm-container
CRM_Utils_System::setTitle(ts('View Pledge by') . ' ' . $displayName);
//do check for campaigns
if ($campaignId = CRM_Utils_Array::value('campaign_id', $values)) {
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($campaignId);
$values['campaign'] = $campaigns[$campaignId];
}
$this->assign($values);
}
示例5: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
require_once 'CRM/Pledge/BAO/Pledge.php';
$values = $ids = array();
$params = array('id' => $this->get('id'));
CRM_Pledge_BAO_Pledge::getValues($params, $values, $ids);
$values['frequencyUnit'] = ts('%1(s)', array(1 => $values['frequency_unit']));
if (isset($values["honor_contact_id"]) && $values["honor_contact_id"]) {
$sql = "SELECT display_name FROM civicrm_contact WHERE id = " . $values["honor_contact_id"];
$dao = new CRM_Core_DAO();
$dao->query($sql);
if ($dao->fetch()) {
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$values['honor_contact_id']}");
$values["honor_display"] = "<A href = {$url}>" . $dao->display_name . "</A>";
}
$honor = CRM_Core_PseudoConstant::honor();
$values['honor_type'] = $honor[$values['honor_type_id']];
}
//handle custom data.
$groupTree =& CRM_Core_BAO_CustomGroup::getTree('Pledge', $this, $params['id']);
CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
if (CRM_Utils_Array::value('contribution_page_id', $values)) {
$values['contribution_page'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $values['contribution_page_id'], 'title');
}
$values['contribution_type'] = CRM_Utils_Array::value($values['contribution_type_id'], CRM_Contribute_PseudoConstant::contributionType());
if ($values['status_id']) {
$values['pledge_status'] = CRM_Utils_Array::value($values['status_id'], CRM_Contribute_PseudoConstant::contributionStatus());
}
require_once 'CRM/Utils/Recent.php';
require_once 'CRM/Contact/BAO/Contact.php';
$url = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=view&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
$recentOther = array();
if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::UPDATE)) {
$recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=update&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
}
if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::DELETE)) {
$recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=delete&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
}
require_once 'CRM/Utils/Money.php';
$displayName = CRM_Contact_BAO_Contact::displayName($values['contact_id']);
$this->assign('displayName', $displayName);
$title = $displayName . ' - (' . ts('Pledged') . ' ' . CRM_Utils_Money::format($values['pledge_amount']) . ' - ' . $values['contribution_type'] . ')';
// add Pledge to Recent Items
CRM_Utils_Recent::add($title, $url, $values['id'], 'Pledge', $values['contact_id'], null, $recentOther);
$this->assign($values);
}
示例6: postProcess
/**
* Process the form after the input has been submitted and validated.
*
*
* @return void
*/
public function postProcess()
{
$deleted = $failed = 0;
foreach ($this->_pledgeIds as $pledgeId) {
if (CRM_Pledge_BAO_Pledge::deletePledge($pledgeId)) {
$deleted++;
} else {
$failed++;
}
}
if ($deleted) {
$msg = ts('%count pledge deleted.', array('plural' => '%count pledges deleted.', 'count' => $deleted));
CRM_Core_Session::setStatus($msg, ts('Removed'), 'success');
}
if ($failed) {
CRM_Core_Session::setStatus(ts('1 could not be deleted.', array('plural' => '%count could not be deleted.', 'count' => $failed)), ts('Error'), 'error');
}
}
示例7: preProcess
/**
* Heart of the viewing process. The runner gets all the meta data for
* the contact and calls the appropriate type of page to view.
*
* @return void
* @access public
*
*/
function preProcess()
{
CRM_Utils_System::setTitle(ts('CiviPledge'));
$startToDate = array();
$yearToDate = array();
$monthToDate = array();
$previousToDate = array();
$prefixes = array('start', 'month', 'year', 'previous');
$status = array('Completed', 'Cancelled', 'Pending', 'In Progress', 'Overdue');
// cumulative (since inception) - prefix = 'start'
$startDate = null;
$startDateEnd = null;
// current year - prefix = 'year'
$config =& CRM_Core_Config::singleton();
$yearDate = $config->fiscalYearStart;
$year = array('Y' => date('Y'));
$this->assign('curYear', $year['Y']);
$yearDate = array_merge($year, $yearDate);
$yearDate = CRM_Utils_Date::format($yearDate);
$yearDate = $yearDate . '000000';
$yearDateEnd = $year['Y'] . '1231235959';
// current month - prefix = 'month'
$currentMonth = date("F Y", mktime(0, 0, 0, date("m"), 01, date("Y")));
$this->assign('currentMonthYear', $currentMonth);
$monthDate = date('Ym') . '01000000';
$monthDateEnd = CRM_Utils_Date::customFormat(date("Y-m-t", mktime(0, 0, 0, date("m"), 01, date("Y"))), '%Y%m%d') . '235959';
// previous month - prefix = 'previous'
$previousDate = CRM_Utils_Date::customFormat(date("Y-m-d", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))), '%Y%m%d') . '000000';
$previousDateEnd = CRM_Utils_Date::customFormat(date("Y-m-t", mktime(0, 0, 0, date("m") - 1, 01, date("Y"))), '%Y%m%d') . '235959';
$previousMonth = date("F Y", mktime(0, 0, 0, date("m") - 1, 01, date("Y")));
$this->assign('previousMonthYear', $previousMonth);
require_once 'CRM/Pledge/BAO/Pledge.php';
foreach ($prefixes as $prefix) {
$aName = $prefix . 'ToDate';
$startName = $prefix . 'Date';
$endName = $prefix . 'DateEnd';
foreach ($status as $s) {
${$aName}[str_replace(" ", "", $s)] = CRM_Pledge_BAO_Pledge::getTotalAmountAndCount($s, ${$startName}, ${$endName});
}
$this->assign($aName, ${$aName});
}
}
示例8: listPledges
/**
* This function is called when action is browse
*
* return null
* @access public
*/
function listPledges()
{
$controller =& new CRM_Core_Controller_Simple('CRM_Pledge_Form_Search', ts('Pledges'), null);
$controller->setEmbedded(true);
$controller->reset();
$controller->set('limit', 12);
$controller->set('cid', $this->_contactId);
$controller->set('context', 'user');
$controller->set('force', 1);
$controller->process();
$controller->run();
//add honor block.
require_once 'CRM/Pledge/BAO/Pledge.php';
$honorParams = array();
$honorParams = CRM_Pledge_BAO_Pledge::getHonorContacts($this->_contactId);
if (!empty($honorParams)) {
// assign vars to templates
$this->assign('pledgeHonorRows', $honorParams);
$this->assign('pledgeHonor', true);
}
}
示例9: listPledges
/**
* called when action is browse.
*/
public function listPledges()
{
$controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_Search', ts('Pledges'), NULL, FALSE, FALSE, TRUE, FALSE);
$controller->setEmbedded(TRUE);
$controller->reset();
$controller->set('limit', 12);
$controller->set('cid', $this->_contactId);
$controller->set('context', 'user');
$controller->set('force', 1);
$controller->process();
$controller->run();
// add honor block.
$honorParams = array();
$honorParams = CRM_Pledge_BAO_Pledge::getHonorContacts($this->_contactId);
if (!empty($honorParams)) {
// assign vars to templates
$this->assign('pledgeHonorRows', $honorParams);
$this->assign('pledgeHonor', TRUE);
}
$session = CRM_Core_Session::singleton();
$loggedUserID = $session->get('userID');
$this->assign('loggedUserID', $loggedUserID);
}
示例10: getCountComponent
/**
* Given the component name and returns the count of participation of contact.
*
* @param string $component
* Input component name.
* @param int $contactId
* Input contact id.
* @param string $tableName
* Optional tableName if component is custom group.
*
* @return int
* total number in database
*/
public static function getCountComponent($component, $contactId, $tableName = NULL)
{
$object = NULL;
switch ($component) {
case 'tag':
return CRM_Core_BAO_EntityTag::getContactTags($contactId, TRUE);
case 'rel':
$result = CRM_Contact_BAO_Relationship::getRelationship($contactId, CRM_Contact_BAO_Relationship::CURRENT, 0, 1);
return $result;
case 'group':
return CRM_Contact_BAO_GroupContact::getContactGroup($contactId, "Added", NULL, TRUE);
case 'log':
if (CRM_Core_BAO_Log::useLoggingReport()) {
return FALSE;
}
return CRM_Core_BAO_Log::getContactLogCount($contactId);
case 'note':
return CRM_Core_BAO_Note::getContactNoteCount($contactId);
case 'contribution':
return CRM_Contribute_BAO_Contribution::contributionCount($contactId);
case 'membership':
return CRM_Member_BAO_Membership::getContactMembershipCount($contactId, TRUE);
case 'participant':
return CRM_Event_BAO_Participant::getContactParticipantCount($contactId);
case 'pledge':
return CRM_Pledge_BAO_Pledge::getContactPledgeCount($contactId);
case 'case':
return CRM_Case_BAO_Case::caseCount($contactId);
case 'grant':
return CRM_Grant_BAO_Grant::getContactGrantCount($contactId);
case 'activity':
$input = array('contact_id' => $contactId, 'admin' => FALSE, 'caseId' => NULL, 'context' => 'activity');
return CRM_Activity_BAO_Activity::getActivitiesCount($input);
case 'mailing':
$params = array('contact_id' => $contactId);
return CRM_Mailing_BAO_Mailing::getContactMailingsCount($params);
default:
$custom = explode('_', $component);
if ($custom['0'] = 'custom') {
if (!$tableName) {
$tableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $custom['1'], 'table_name');
}
$queryString = "SELECT count(id) FROM {$tableName} WHERE entity_id = {$contactId}";
return CRM_Core_DAO::singleValueQuery($queryString);
}
}
}
示例11:
/**
* @return array
*/
public static function &getFields()
{
$fields = CRM_Pledge_BAO_Pledge::exportableFields();
return $fields;
}
示例12: civicrm_pledge_delete
/**
* Delete a pledge
*
* @param array $params array included 'pledge_id' of pledge to delete
*
* @return boolean true if success, else false
* @static void
* @access public
*/
function civicrm_pledge_delete(&$params)
{
if (!empty($params['id'])) {
//handle field name or unique db name
$params['pledge_id'] = $params['id'];
}
$pledgeID = CRM_Utils_Array::value('pledge_id', $params);
if (!$pledgeID) {
return civicrm_create_error('Could not find pledge_id in input parameters');
}
require_once 'CRM/Pledge/BAO/Pledge.php';
if (CRM_Pledge_BAO_Pledge::deletePledge($pledgeID)) {
return civicrm_create_success();
} else {
return civicrm_create_error('Could not delete pledge');
}
}
示例13: preProcessPledge
public function preProcessPledge()
{
//get the payment values associated with given pledge payment id OR check for payments due.
$this->_pledgeValues = array();
if ($this->_ppID) {
$payParams = array('id' => $this->_ppID);
CRM_Pledge_BAO_PledgePayment::retrieve($payParams, $this->_pledgeValues['pledgePayment']);
$this->_pledgeID = CRM_Utils_Array::value('pledge_id', $this->_pledgeValues['pledgePayment']);
$paymentStatusID = CRM_Utils_Array::value('status_id', $this->_pledgeValues['pledgePayment']);
$this->_id = CRM_Utils_Array::value('contribution_id', $this->_pledgeValues['pledgePayment']);
//get all status
$allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
if (!($paymentStatusID == array_search('Pending', $allStatus) || $paymentStatusID == array_search('Overdue', $allStatus))) {
CRM_Core_Error::fatal(ts("Pledge payment status should be 'Pending' or 'Overdue'."));
}
//get the pledge values associated with given pledge payment.
$ids = array();
$pledgeParams = array('id' => $this->_pledgeID);
CRM_Pledge_BAO_Pledge::getValues($pledgeParams, $this->_pledgeValues, $ids);
$this->assign('ppID', $this->_ppID);
} else {
// Not making a pledge payment, so if adding a new contribution we should check if pledge payment(s) are due for this contact so we can alert the user. CRM-5206
if (isset($this->_contactID)) {
$contactPledges = CRM_Pledge_BAO_Pledge::getContactPledges($this->_contactID);
if (!empty($contactPledges)) {
$payments = $paymentsDue = NULL;
$multipleDue = FALSE;
foreach ($contactPledges as $key => $pledgeId) {
$payments = CRM_Pledge_BAO_PledgePayment::getOldestPledgePayment($pledgeId);
if ($payments) {
if ($paymentsDue) {
$multipleDue = TRUE;
break;
} else {
$paymentsDue = $payments;
}
}
}
if ($multipleDue) {
// Show link to pledge tab since more than one pledge has a payment due
$pledgeTab = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$this->_contactID}&selectedChild=pledge");
CRM_Core_Session::setStatus(ts('This contact has pending or overdue pledge payments. <a href="%1">Click here to view their Pledges tab</a> and verify whether this contribution should be applied as a pledge payment.', array(1 => $pledgeTab)), ts('Notice'), 'alert');
} elseif ($paymentsDue) {
// Show user link to oldest Pending or Overdue pledge payment
$ppAmountDue = CRM_Utils_Money::format($payments['amount'], $payments['currency']);
$ppSchedDate = CRM_Utils_Date::customFormat(CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_PledgePayment', $payments['id'], 'scheduled_date'));
if ($this->_mode) {
$ppUrl = CRM_Utils_System::url('civicrm/contact/view/contribution', "reset=1&action=add&cid={$this->_contactID}&ppid={$payments['id']}&context=pledge&mode=live");
} else {
$ppUrl = CRM_Utils_System::url('civicrm/contact/view/contribution', "reset=1&action=add&cid={$this->_contactID}&ppid={$payments['id']}&context=pledge");
}
CRM_Core_Session::setStatus(ts('This contact has a pending or overdue pledge payment of %2 which is scheduled for %3. <a href="%1">Click here to enter a pledge payment</a>.', array(1 => $ppUrl, 2 => $ppAmountDue, 3 => $ppSchedDate)), ts('Notice'), 'alert');
}
}
}
}
}
示例14: flushCache
/**
* Reset the various system caches and some important static variables.
*/
public static function flushCache()
{
// flush out all cache entries so we can reload new data
// a bit aggressive, but livable for now
$cache = CRM_Utils_Cache::singleton();
$cache->flush();
// also reset the various static memory caches
// reset the memory or array cache
CRM_Core_BAO_Cache::deleteGroup('contact fields', NULL, FALSE);
// reset ACL cache
CRM_ACL_BAO_Cache::resetCache();
// reset various static arrays used here
CRM_Contact_BAO_Contact::$_importableFields = CRM_Contact_BAO_Contact::$_exportableFields = CRM_Contribute_BAO_Contribution::$_importableFields = CRM_Contribute_BAO_Contribution::$_exportableFields = CRM_Pledge_BAO_Pledge::$_exportableFields = CRM_Contribute_BAO_Query::$_contributionFields = CRM_Core_BAO_CustomField::$_importFields = CRM_Core_BAO_Cache::$_cache = CRM_Core_DAO::$_dbColumnValueCache = NULL;
CRM_Core_OptionGroup::flushAll();
CRM_Utils_PseudoConstant::flushAll();
}
示例15: buildMappingForm
//.........这里部分代码省略.........
}
if ($mappingType == 'Search Builder' || $exportMode == CRM_Export_Form_Select::CONTRIBUTE_EXPORT) {
if (CRM_Core_Permission::access('CiviContribute')) {
$fields['Contribution'] = CRM_Contribute_BAO_Contribution::exportableFields();
foreach (array('contribution_contact_id', 'contribution_soft_credit_name', 'contribution_soft_credit_amount', 'contribution_soft_credit_type', 'contribution_soft_credit_contribution_id') as $element) {
unset($fields['Contribution'][$element]);
}
$compArray['Contribution'] = ts('Contribution');
}
}
if ($mappingType == 'Search Builder' || $exportMode == CRM_Export_Form_Select::EVENT_EXPORT) {
if (CRM_Core_Permission::access('CiviEvent')) {
$fields['Participant'] = CRM_Event_BAO_Participant::exportableFields();
//get the component payment fields
if ($exportMode == CRM_Export_Form_Select::EVENT_EXPORT) {
$componentPaymentFields = array();
foreach (CRM_Export_BAO_Export::componentPaymentFields() as $payField => $payTitle) {
$componentPaymentFields[$payField] = array('title' => $payTitle);
}
$fields['Participant'] = array_merge($fields['Participant'], $componentPaymentFields);
}
$compArray['Participant'] = ts('Participant');
}
}
if ($mappingType == 'Search Builder' || $exportMode == CRM_Export_Form_Select::MEMBER_EXPORT) {
if (CRM_Core_Permission::access('CiviMember')) {
$fields['Membership'] = CRM_Member_BAO_Membership::getMembershipFields($exportMode);
unset($fields['Membership']['membership_contact_id']);
$compArray['Membership'] = ts('Membership');
}
}
if ($mappingType == 'Search Builder' || $exportMode == CRM_Export_Form_Select::PLEDGE_EXPORT) {
if (CRM_Core_Permission::access('CiviPledge')) {
$fields['Pledge'] = CRM_Pledge_BAO_Pledge::exportableFields();
unset($fields['Pledge']['pledge_contact_id']);
$compArray['Pledge'] = ts('Pledge');
}
}
if ($mappingType == 'Search Builder' || $exportMode == CRM_Export_Form_Select::CASE_EXPORT) {
if (CRM_Core_Permission::access('CiviCase')) {
$fields['Case'] = CRM_Case_BAO_Case::exportableFields();
$compArray['Case'] = ts('Case');
$fields['Activity'] = CRM_Activity_BAO_Activity::exportableFields('Case');
$compArray['Activity'] = ts('Case Activity');
unset($fields['Case']['case_contact_id']);
}
}
if ($mappingType == 'Search Builder' || $exportMode == CRM_Export_Form_Select::GRANT_EXPORT) {
if (CRM_Core_Permission::access('CiviGrant')) {
$fields['Grant'] = CRM_Grant_BAO_Grant::exportableFields();
unset($fields['Grant']['grant_contact_id']);
if ($mappingType == 'Search Builder') {
unset($fields['Grant']['grant_type_id']);
}
$compArray['Grant'] = ts('Grant');
}
}
if ($mappingType == 'Search Builder' || $exportMode == CRM_Export_Form_Select::ACTIVITY_EXPORT) {
$fields['Activity'] = CRM_Activity_BAO_Activity::exportableFields('Activity');
$compArray['Activity'] = ts('Activity');
}
//Contact Sub Type For export
$contactSubTypes = array();
$subTypes = CRM_Contact_BAO_ContactType::subTypeInfo();
foreach ($subTypes as $subType => $val) {
//adding subtype specific relationships CRM-5256