本文整理汇总了PHP中CRM_Event_BAO_Participant::exportableFields方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Event_BAO_Participant::exportableFields方法的具体用法?PHP CRM_Event_BAO_Participant::exportableFields怎么用?PHP CRM_Event_BAO_Participant::exportableFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Event_BAO_Participant
的用法示例。
在下文中一共展示了CRM_Event_BAO_Participant::exportableFields方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: whereClauseSingle
/**
* @param $values
* @param $query
*/
public static function whereClauseSingle(&$values, &$query)
{
list($name, $op, $value, $grouping, $wildcard) = $values;
$fields = array_merge(CRM_Event_BAO_Event::fields(), CRM_Event_BAO_Participant::exportableFields());
switch ($name) {
case 'event_start_date_low':
case 'event_start_date_high':
$query->dateQueryBuilder($values, 'civicrm_event', 'event_start_date', 'start_date', 'Start Date');
return;
case 'event_end_date_low':
case 'event_end_date_high':
$query->dateQueryBuilder($values, 'civicrm_event', 'event_end_date', 'end_date', 'End Date');
return;
case 'event_include_repeating_events':
/**
* Include Repeating Events
*/
//Get parent of this event
$exEventId = '';
if ($query->_where[$grouping]) {
foreach ($query->_where[$grouping] as $key => $val) {
if (strstr($val, 'civicrm_event.id =')) {
$exEventId = $val;
$extractEventId = explode(" ", $val);
$value = $extractEventId[2];
$where = $query->_where[$grouping][$key];
} else {
if (strstr($val, 'civicrm_event.id IN')) {
//extract the first event id if multiple events are selected
preg_match('/civicrm_event.id IN \\(\\"(\\d+)/', $val, $matches);
$value = $matches[1];
$where = $query->_where[$grouping][$key];
}
}
}
if ($exEventId) {
$extractEventId = explode(" ", $exEventId);
$value = $extractEventId[2];
} else {
if (!empty($matches[1])) {
$value = $matches[1];
}
}
$where = $query->_where[$grouping][$key];
}
$thisEventHasParent = CRM_Core_BAO_RecurringEntity::getParentFor($value, 'civicrm_event');
if ($thisEventHasParent) {
$getAllConnections = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($thisEventHasParent, 'civicrm_event');
$allEventIds = array();
foreach ($getAllConnections as $key => $val) {
$allEventIds[] = $val['id'];
}
if (!empty($allEventIds)) {
$op = "IN";
$value = "(" . implode(",", $allEventIds) . ")";
}
}
$query->_where[$grouping][] = "{$where} OR civicrm_event.id {$op} {$value}";
$query->_qill[$grouping][] = ts('Include Repeating Events');
$query->_tables['civicrm_event'] = $query->_whereTables['civicrm_event'] = 1;
return;
case 'participant_is_test':
$key = array_search('civicrm_participant.is_test = 0', $query->_where[$grouping]);
if (!empty($key)) {
unset($query->_where[$grouping][$key]);
}
case 'participant_test':
// We dont want to include all tests for sql OR CRM-7827
if (!$value || $query->getOperator() != 'OR') {
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_participant.is_test", $op, $value, "Boolean");
$isTest = $value ? 'a Test' : 'not a Test';
$query->_qill[$grouping][] = ts("Participant is %1", array(1 => $isTest));
$query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
}
return;
case 'participant_fee_id':
foreach ($value as $k => &$val) {
$val = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $val, 'label');
$val = CRM_Core_DAO::escapeString(trim($val));
}
$feeLabel = implode('|', $value);
$query->_where[$grouping][] = "civicrm_participant.fee_level REGEXP '{$feeLabel}'";
$query->_qill[$grouping][] = ts("Fee level") . " IN " . implode(', ', $value);
$query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
return;
case 'participant_fee_amount_high':
case 'participant_fee_amount_low':
$query->numberRangeBuilder($values, 'civicrm_participant', 'participant_fee_amount', 'fee_amount', 'Fee Amount');
return;
case 'participant_status_id':
if ($value && is_array($value) && strpos($op, 'IN') === FALSE) {
$op = 'IN';
}
case 'participant_status':
case 'participant_source':
case 'participant_id':
//.........这里部分代码省略.........
示例2: testexportableFields
/**
* ExportableFields() method ( Exportable Fields for Participant)
*/
public function testexportableFields()
{
$exportableFields = CRM_Event_BAO_Participant::exportableFields();
$this->assertNotEquals(count($exportableFields), 0, 'Checking array not to be empty.');
Contact::delete($this->_contactId);
Event::delete($this->_eventId);
}
示例3: participantTokens
/**
* Different type of Participant Tokens.
*
* @return array
*/
public static function participantTokens()
{
static $tokens = NULL;
if (!$tokens) {
$exportFields = CRM_Event_BAO_Participant::exportableFields();
$values = array_merge(array_keys($exportFields));
unset($values[0]);
// skipping some tokens for time being.
$skipTokens = array('event_id', 'participant_is_pay_later', 'participant_is_test', 'participant_contact_id', 'participant_fee_currency', 'participant_campaign_id', 'participant_status', 'participant_discount_name');
$customFields = CRM_Core_BAO_CustomField::getFields('Participant');
foreach ($values as $key => $val) {
if (in_array($val, $skipTokens)) {
continue;
}
//keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
if ($customFieldId = CRM_Core_BAO_CustomField::getKeyID($val)) {
$tokens["{participant.{$val}}"] = !empty($customFields[$customFieldId]) ? $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'] : '';
} else {
$tokens["{participant.{$val}}"] = $exportFields[$val]['title'];
}
}
}
return $tokens;
}
示例4: buildMappingForm
/**
* Build the mapping form.
*
* @param CRM_Core_Form $form
* @param string $mappingType
* (Export/Import/Search Builder).
* @param int $mappingId
* @param int $columnNo
* @param int $blockCount
* (no of blocks shown).
* @param NULL $exportMode
*
* @return void
*/
public static function buildMappingForm(&$form, $mappingType = 'Export', $mappingId = NULL, $columnNo, $blockCount = 3, $exportMode = NULL)
{
if ($mappingType == 'Export') {
$name = "Map";
$columnCount = array('1' => $columnNo);
} elseif ($mappingType == 'Search Builder') {
$name = "Builder";
$columnCount = $columnNo;
}
//get the saved mapping details
if ($mappingType == 'Export') {
$form->applyFilter('saveMappingName', 'trim');
//to save the current mappings
if (!isset($mappingId)) {
$saveDetailsName = ts('Save this field mapping');
$form->add('text', 'saveMappingName', ts('Name'));
$form->add('text', 'saveMappingDesc', ts('Description'));
} else {
$form->assign('loadedMapping', $mappingId);
$params = array('id' => $mappingId);
$temp = array();
$mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp);
$form->assign('savedName', $mappingDetails->name);
$form->add('hidden', 'mappingId', $mappingId);
$form->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), NULL);
$saveDetailsName = ts('Save as a new field mapping');
$form->add('text', 'saveMappingName', ts('Name'));
$form->add('text', 'saveMappingDesc', ts('Description'));
}
$form->addElement('checkbox', 'saveMapping', $saveDetailsName, NULL, array('onclick' => "showSaveDetails(this)"));
$form->addFormRule(array('CRM_Export_Form_Map', 'formRule'), $form->get('mappingTypeId'));
} elseif ($mappingType == 'Search Builder') {
$form->addElement('submit', 'addBlock', ts('Also include contacts where'), array('class' => 'submit-link'));
}
$defaults = array();
$hasLocationTypes = array();
$hasRelationTypes = array();
$fields = array();
if ($mappingType == 'Export') {
$required = TRUE;
} elseif ($mappingType == 'Search Builder') {
$required = FALSE;
}
$contactType = array('Individual', 'Household', 'Organization');
foreach ($contactType as $value) {
$contactFields = CRM_Contact_BAO_Contact::exportableFields($value, FALSE, $required);
$contactFields = array_merge($contactFields, CRM_Contact_BAO_Query_Hook::singleton()->getFields());
// exclude the address options disabled in the Address Settings
$fields[$value] = CRM_Core_BAO_Address::validateAddressOptions($contactFields);
ksort($fields[$value]);
if ($mappingType == 'Export') {
$relationships = array();
$relationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $value);
asort($relationshipTypes);
foreach ($relationshipTypes as $key => $var) {
list($type) = explode('_', $key);
$relationships[$key]['title'] = $var;
$relationships[$key]['headerPattern'] = '/' . preg_quote($var, '/') . '/';
$relationships[$key]['export'] = TRUE;
$relationships[$key]['relationship_type_id'] = $type;
$relationships[$key]['related'] = TRUE;
$relationships[$key]['hasRelationType'] = 1;
}
if (!empty($relationships)) {
$fields[$value] = array_merge($fields[$value], array('related' => array('title' => ts('- related contact info -'))), $relationships);
}
}
}
//get the current employer for mapping.
if ($required) {
$fields['Individual']['current_employer']['title'] = ts('Current Employer');
}
// add component fields
$compArray = array();
//we need to unset groups, tags, notes for component export
if ($exportMode != CRM_Export_Form_Select::CONTACT_EXPORT) {
foreach (array('groups', 'tags', 'notes') as $value) {
unset($fields['Individual'][$value]);
unset($fields['Household'][$value]);
unset($fields['Organization'][$value]);
}
}
if ($mappingType == 'Search Builder') {
//build the common contact fields array.
$fields['Contact'] = array();
foreach ($fields['Individual'] as $key => $value) {
//.........这里部分代码省略.........
示例5: whereClauseSingle
/**
* @param $values
* @param $query
*/
public static function whereClauseSingle(&$values, &$query)
{
list($name, $op, $value, $grouping, $wildcard) = $values;
$fields = array_merge(CRM_Event_BAO_Event::fields(), CRM_Event_BAO_Participant::exportableFields());
switch ($name) {
case 'event_start_date_low':
case 'event_start_date_high':
$query->dateQueryBuilder($values, 'civicrm_event', 'event_start_date', 'start_date', 'Start Date');
return;
case 'event_end_date_low':
case 'event_end_date_high':
$query->dateQueryBuilder($values, 'civicrm_event', 'event_end_date', 'end_date', 'End Date');
return;
case 'event_include_repeating_events':
/**
* Include Repeating Events
*/
//Get parent of this event
$exEventId = '';
if ($query->_where[$grouping]) {
foreach ($query->_where[$grouping] as $key => $val) {
if (strstr($val, 'civicrm_event.id =')) {
$exEventId = $val;
$extractEventId = explode(" ", $val);
$value = $extractEventId[2];
unset($query->_where[$grouping][$key]);
}
}
$extractEventId = explode(" ", $exEventId);
$value = $extractEventId[2];
unset($query->_where[$grouping][$key]);
}
$thisEventHasParent = CRM_Core_BAO_RecurringEntity::getParentFor($value, 'civicrm_event');
if ($thisEventHasParent) {
$getAllConnections = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($thisEventHasParent, 'civicrm_event');
$allEventIds = array();
foreach ($getAllConnections as $key => $val) {
$allEventIds[] = $val['id'];
}
if (!empty($allEventIds)) {
$op = "IN";
$value = "(" . implode(",", $allEventIds) . ")";
}
}
$query->_where[$grouping][] = "civicrm_event.id {$op} {$value}";
$query->_qill[$grouping][] = ts('Include Repeating Events');
$query->_tables['civicrm_event'] = $query->_whereTables['civicrm_event'] = 1;
return;
case 'participant_is_test':
$key = array_search('civicrm_participant.is_test = 0', $query->_where[$grouping]);
if (!empty($key)) {
unset($query->_where[$grouping][$key]);
}
case 'participant_test':
// We dont want to include all tests for sql OR CRM-7827
if (!$value || $query->getOperator() != 'OR') {
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_participant.is_test", $op, $value, "Boolean");
if ($value) {
$query->_qill[$grouping][] = ts("Participant is a Test");
}
$query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
}
return;
case 'participant_fee_id':
$feeLabel = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $value, 'label');
$feeLabel = CRM_Core_DAO::escapeString(trim($feeLabel));
if ($value) {
$query->_where[$grouping][] = "civicrm_participant.fee_level LIKE '%{$feeLabel}%'";
$query->_qill[$grouping][] = ts("Fee level") . " contains {$feeLabel}";
}
$query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
return;
case 'participant_fee_amount_high':
case 'participant_fee_amount_low':
$query->numberRangeBuilder($values, 'civicrm_participant', 'participant_fee_amount', 'fee_amount', 'Fee Amount');
return;
case 'participant_status_id':
case 'participant_role_id':
if ($value && is_array($value) && strpos($op, 'IN') === FALSE) {
$op = 'IN';
}
case 'participant_status':
case 'participant_role':
case 'participant_source':
case 'participant_id':
case 'participant_contact_id':
case 'participant_is_pay_later':
case 'participant_fee_amount':
case 'participant_fee_level':
$qillName = $name;
if (in_array($name, array('participant_status_id', 'participant_role_id', 'participant_source', 'participant_id', 'participant_contact_id', 'participant_fee_amount', 'participant_fee_level', 'participant_is_pay_later'))) {
$name = str_replace('participant_', '', $name);
if ($name == 'is_pay_later') {
$qillName = $name;
}
if ($name == 'role_id') {
//.........这里部分代码省略.........