本文整理汇总了PHP中CRM_Core_PseudoConstant::phoneType方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_PseudoConstant::phoneType方法的具体用法?PHP CRM_Core_PseudoConstant::phoneType怎么用?PHP CRM_Core_PseudoConstant::phoneType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_PseudoConstant
的用法示例。
在下文中一共展示了CRM_Core_PseudoConstant::phoneType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the page.
*
* This method is called after the page is created.
*
* @return void
* @access public
*
*/
function run()
{
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
$locationTypes = CRM_Core_PseudoConstant::locationDisplayName();
$phoneTypes = CRM_Core_PseudoConstant::phoneType();
$entityBlock = array('contact_id' => $contactId);
$phones = CRM_Core_BAO_Phone::getValues($entityBlock);
if (!empty($phones)) {
foreach ($phones as $key => &$value) {
$value['location_type'] = $locationTypes[$value['location_type_id']];
$value['phone_type'] = $phoneTypes[$value['phone_type_id']];
}
}
$contact = new CRM_Contact_BAO_Contact();
$contact->id = $contactId;
$contact->find(true);
$privacy = array();
foreach (CRM_Contact_BAO_Contact::$_commPrefs as $name) {
if (isset($contact->{$name})) {
$privacy[$name] = $contact->{$name};
}
}
$this->assign('contactId', $contactId);
$this->assign('phone', $phones);
$this->assign('privacy', $privacy);
// check logged in user permission
CRM_Contact_Page_View::checkUserPermission($this, $contactId);
// finally call parent
parent::run();
}
示例2: buildQuickForm
/**
* build the form elements for a phone object
*
* @param CRM_Core_Form $form reference to the form object
* @param int $addressBlockCount block number to build
* @param boolean $blockEdit is it block edit
*
* @return void
* @access public
* @static
*/
static function buildQuickForm(&$form, $addressBlockCount = NULL, $blockEdit = FALSE)
{
// passing this via the session is AWFUL. we need to fix this
if (!$addressBlockCount) {
$blockId = $form->get('Phone_Block_Count') ? $form->get('Phone_Block_Count') : 1;
} else {
$blockId = $addressBlockCount;
}
$form->applyFilter('__ALL__', 'trim');
//phone type select
$form->addElement('select', "phone[{$blockId}][phone_type_id]", ts('Phone'), CRM_Core_PseudoConstant::phoneType());
//main phone number with crm_phone class
$form->addElement('text', "phone[{$blockId}][phone]", ts('Phone'), array_merge(CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone'), array('class' => 'crm_phone twelve')));
// phone extension
$form->addElement('text', "phone[{$blockId}][phone_ext]", ts('Extension'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone_ext'));
if (isset($form->_contactType) || $blockEdit) {
//Block type select
$form->addElement('select', "phone[{$blockId}][location_type_id]", '', CRM_Core_PseudoConstant::locationType());
//is_Primary radio
$js = array('id' => 'Phone_' . $blockId . '_IsPrimary', 'onClick' => 'singleSelect( this.id );');
$form->addElement('radio', "phone[{$blockId}][is_primary]", '', '', '1', $js);
}
// TODO: set this up as a group, we need a valid phone_type_id if we have a phone number
// $form->addRule( "location[$locationId][phone][$locationId][phone]", ts('Phone number is not valid.'), 'phone' );
}
示例3: buildQuickForm
/**
* build the form elements for a phone object
*
* @param CRM_Core_Form $form reference to the form object
* @param array $location the location object to store all the form elements in
* @param int $locationId the locationId we are dealing with
* @param int $count the number of blocks to create
*
* @return void
* @access public
* @static
*/
static function buildQuickForm(&$form)
{
$blockId = $form->get('Phone_Block_Count') ? $form->get('Phone_Block_Count') : 1;
$form->applyFilter('__ALL__', 'trim');
//phone type select
$form->addElement('select', "phone[{$blockId}][phone_type_id]", ts('Phone'), CRM_Core_PseudoConstant::phoneType());
//phone box
$form->addElement('text', "phone[{$blockId}][phone]", ts('Phone'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone'));
if (isset($form->_contactType)) {
//Block type select
$form->addElement('select', "phone[{$blockId}][location_type_id]", '', CRM_Core_PseudoConstant::locationType());
//is_Primary radio
$js = array('id' => "Phone_" . $blockId . "_IsPrimary", 'onClick' => 'singleSelect( this.id );');
$form->addElement('radio', "phone[{$blockId}][is_primary]", '', '', '1', $js);
}
// TODO: set this up as a group, we need a valid phone_type_id if we have a phone number
// $form->addRule( "location[$locationId][phone][$locationId][phone]", ts('Phone number is not valid.'), 'phone' );
}
示例4: postProcess
/**
* Process the mapped fields and map it into the uploaded file
* preview the file and extract some summary statistics
*
* @return void
* @access public
*/
public function postProcess()
{
$params = $this->controller->exportValues('MapField');
//reload the mapfield if load mapping is pressed
if (!empty($params['savedMapping'])) {
$this->set('savedMapping', $params['savedMapping']);
$this->controller->resetPage($this->_name);
return;
}
$mapper = array();
$mapperKeys = array();
$mapperKeys = $this->controller->exportValue($this->_name, 'mapper');
$mapperKeysMain = array();
$phoneTypes = CRM_Core_PseudoConstant::phoneType();
$imProviders = CRM_Core_PseudoConstant::IMProvider();
$websiteTypes = CRM_Core_PseudoConstant::websiteType();
$locationTypes = CRM_Core_PseudoConstant::locationType();
//these mapper params need to set key as array and val as null.
$mapperParams = array('related' => 'relatedVal', 'locations' => 'locationsVal', 'mapperLocType' => 'mapperLocTypeVal', 'mapperPhoneType' => 'mapperPhoneTypeVal', 'mapperImProvider' => 'mapperImProviderVal', 'mapperWebsiteType' => 'mapperWebsiteTypeVal', 'relatedContactType' => 'relatedContactTypeVal', 'relatedContactDetails' => 'relatedContactDetailsVal', 'relatedContactLocType' => 'relatedContactLocTypeVal', 'relatedContactPhoneType' => 'relatedContactPhoneTypeVal', 'relatedContactImProvider' => 'relatedContactImProviderVal', 'relatedContactWebsiteType' => 'relatedContactWebsiteTypeVal');
//set respective mapper params to array.
foreach (array_keys($mapperParams) as $mapperParam) {
${$mapperParam} = array();
}
for ($i = 0; $i < $this->_columnCount; $i++) {
//set respective mapper value to null
foreach (array_values($mapperParams) as $mapperParam) {
${$mapperParam} = NULL;
}
$fldName = CRM_Utils_Array::value(0, $mapperKeys[$i]);
$selOne = CRM_Utils_Array::value(1, $mapperKeys[$i]);
$selTwo = CRM_Utils_Array::value(2, $mapperKeys[$i]);
$selThree = CRM_Utils_Array::value(3, $mapperKeys[$i]);
$mapper[$i] = $this->_mapperFields[$mapperKeys[$i][0]];
$mapperKeysMain[$i] = $fldName;
//need to differentiate non location elements.
if ($selOne && is_numeric($selOne)) {
if ($fldName == 'url') {
$mapperWebsiteTypeVal = $websiteTypes[$selOne];
} else {
$locationsVal = $locationTypes[$selOne];
$mapperLocTypeVal = $selOne;
if ($selTwo && is_numeric($selTwo)) {
if ($fldName == 'phone') {
$mapperPhoneTypeVal = $phoneTypes[$selTwo];
} elseif ($fldName == 'im') {
$mapperImProviderVal = $imProviders[$selTwo];
}
}
}
}
//relationship contact mapper info.
list($id, $first, $second) = CRM_Utils_System::explode('_', $fldName, 3);
if ($first == 'a' && $second == 'b' || $first == 'b' && $second == 'a') {
$relatedVal = $this->_mapperFields[$fldName];
if ($selOne) {
if ($selOne == 'url') {
$relatedContactWebsiteTypeVal = $websiteTypes[$selTwo];
} else {
$relatedContactLocTypeVal = CRM_Utils_Array::value($selTwo, $locationTypes);
if ($selThree) {
if ($selOne == 'phone') {
$relatedContactPhoneTypeVal = $phoneTypes[$selThree];
} elseif ($selOne == 'im') {
$relatedContactImProviderVal = $imProviders[$selThree];
}
}
}
//get the related contact type.
$relationType = new CRM_Contact_DAO_RelationshipType();
$relationType->id = $id;
$relationType->find(TRUE);
$relatedContactTypeVal = $relationType->{"contact_type_{$second}"};
$relatedContactDetailsVal = $this->_formattedFieldNames[$relatedContactTypeVal][$selOne];
}
}
//set the respective mapper param array values.
foreach ($mapperParams as $mapperParamKey => $mapperParamVal) {
${$mapperParamKey}[$i] = ${$mapperParamVal};
}
}
$this->set('columnNames', $this->_columnNames);
//set main contact properties.
$properties = array('ims' => 'mapperImProvider', 'mapper' => 'mapper', 'phones' => 'mapperPhoneType', 'websites' => 'mapperWebsiteType', 'locations' => 'locations');
foreach ($properties as $propertyName => $propertyVal) {
$this->set($propertyName, ${$propertyVal});
}
//set related contact propeties.
$relProperties = array('related', 'relatedContactType', 'relatedContactDetails', 'relatedContactLocType', 'relatedContactPhoneType', 'relatedContactImProvider', 'relatedContactWebsiteType');
foreach ($relProperties as $relProperty) {
$this->set($relProperty, ${$relProperty});
}
// store mapping Id to display it in the preview page
$this->set('loadMappingId', CRM_Utils_Array::value('mappingId', $params));
//.........这里部分代码省略.........
示例5:
/**
* Get all phone type
* The static array phoneType is returned
*
* @access public
* @static
*
* @param boolean $all - get All phone type - default is to get
* only active ones.
*
* @return array - array reference of all phone types.
*
*/
public static function &phoneType()
{
if (!self::$phoneType) {
require_once 'CRM/Core/OptionGroup.php';
self::$phoneType = CRM_Core_OptionGroup::values('phone_type');
}
return self::$phoneType;
}
示例6: buildMappingForm
//.........这里部分代码省略.........
}
if (isset($value1['hasRelationType'])) {
$hasRelationTypes[$key][$key1] = $value1['hasRelationType'];
unset($relatedMapperFields[$key][$key1]);
}
}
if (array_key_exists('related', $relatedMapperFields[$key])) {
unset($relatedMapperFields[$key]['related']);
}
}
$mapperKeys = array_keys($mapperFields);
$locationTypes =& CRM_Core_PseudoConstant::locationType();
$defaultLocationType =& CRM_Core_BAO_LocationType::getDefault();
/* FIXME: dirty hack to make the default option show up first. This
* avoids a mozilla browser bug with defaults on dynamically constructed
* selector widgets. */
if ($defaultLocationType) {
$defaultLocation = $locationTypes[$defaultLocationType->id];
unset($locationTypes[$defaultLocationType->id]);
$locationTypes = array($defaultLocationType->id => $defaultLocation) + $locationTypes;
}
$locationTypes = array(' ' => ts('Primary')) + $locationTypes;
// since we need a hierarchical list to display contact types & subtypes,
// this is what we going to display in first selector
$contactTypes = CRM_Contact_BAO_ContactType::getSelectElements(false, false);
$sel1 = array('' => ts('- select record type -')) + $contactTypes + $compArray;
foreach ($sel1 as $key => $sel) {
if ($key) {
$sel2[$key] = $mapperFields[$key];
}
}
$sel3[''] = null;
$sel5[''] = null;
$phoneTypes = CRM_Core_PseudoConstant::phoneType();
$imProviders = CRM_Core_PseudoConstant::IMProvider();
asort($phoneTypes);
foreach ($sel1 as $k => $sel) {
if ($k) {
foreach ($locationTypes as $key => $value) {
if (trim($key) != '') {
$sel4[$k]['phone'][$key] =& $phoneTypes;
$sel4[$k]['im'][$key] =& $imProviders;
}
}
}
}
foreach ($sel1 as $k => $sel) {
if ($k) {
foreach ($mapperFields[$k] as $key => $value) {
if (isset($hasLocationTypes[$k][$key])) {
$sel3[$k][$key] = $locationTypes;
} else {
$sel3[$key] = null;
}
}
}
}
//Array for core fields and relationship custom data
$relationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(null, null, null, null, true);
if ($mappingType == 'Export') {
foreach ($sel1 as $k => $sel) {
if ($k) {
foreach ($mapperFields[$k] as $field => $dontCare) {
if (isset($hasRelationTypes[$k][$field])) {
list($id, $first, $second) = explode('_', $field);
$relationshipCustomFields = self::getRelationTypeCustomGroupData($id);
示例7: runImport
public function runImport(&$form, $timeout = 55)
{
$mapper = $this->_mapper;
$mapperFields = array();
$phoneTypes = CRM_Core_PseudoConstant::phoneType();
$imProviders = CRM_Core_PseudoConstant::IMProvider();
$websiteTypes = CRM_Core_PseudoConstant::websiteType();
$locationTypes = CRM_Core_PseudoConstant::locationType();
//initialize mapper perperty value.
$mapperPeroperties = array('mapperRelated' => 'mapperRelatedVal', 'mapperLocTypes' => 'mapperLocTypesVal', 'mapperPhoneTypes' => 'mapperPhoneTypesVal', 'mapperImProviders' => 'mapperImProvidersVal', 'mapperWebsiteTypes' => 'mapperWebsiteTypesVal', 'mapperRelatedContactType' => 'mapperRelatedContactTypeVal', 'mapperRelatedContactDetails' => 'mapperRelatedContactDetailsVal', 'mapperRelatedContactLocType' => 'mapperRelatedContactLocTypeVal', 'mapperRelatedContactPhoneType' => 'mapperRelatedContactPhoneTypeVal', 'mapperRelatedContactImProvider' => 'mapperRelatedContactImProviderVal', 'mapperRelatedContactWebsiteType' => 'mapperRelatedContactWebsiteTypeVal');
foreach ($mapper as $key => $value) {
//set respective mapper value to null.
foreach (array_values($mapperPeroperties) as $perpertyVal) {
${$perpertyVal} = NULL;
}
$header = array();
$fldName = CRM_Utils_Array::value(0, $mapper[$key]);
$selOne = CRM_Utils_Array::value(1, $mapper[$key]);
$selTwo = CRM_Utils_Array::value(2, $mapper[$key]);
$selThree = CRM_Utils_Array::value(3, $mapper[$key]);
$this->_mapperKeys[$key] = $fldName;
//need to differentiate non location elements.
if ($selOne && is_numeric($selOne)) {
if ($fldName == 'url') {
$header[] = $websiteTypes[$selOne];
$mapperWebsiteTypesVal = $selOne;
} else {
$header[] = $locationTypes[$selOne];
$mapperLocTypesVal = $selOne;
if ($selTwo && is_numeric($selTwo)) {
if ($fldName == 'phone') {
$header[] = $phoneTypes[$selTwo];
$mapperPhoneTypesVal = $selTwo;
} elseif ($fldName == 'im') {
$header[] = $imProviders[$selTwo];
$mapperImProvidersVal = $selTwo;
}
}
}
}
$fldNameParts = explode('_', $fldName, 3);
$id = $fldNameParts[0];
$first = isset($fldNameParts[1]) ? $fldNameParts[1] : NULL;
$second = isset($fldNameParts[2]) ? $fldNameParts[2] : NULL;
if ($first == 'a' && $second == 'b' || $first == 'b' && $second == 'a') {
$header[] = ucwords(str_replace("_", " ", $selOne));
$relationType = new CRM_Contact_DAO_RelationshipType();
$relationType->id = $id;
$relationType->find(TRUE);
$mapperRelatedContactTypeVal = $relationType->{"contact_type_{$second}"};
$mapperRelatedVal = $fldName;
if ($selOne) {
$mapperRelatedContactDetailsVal = $selOne;
if ($selTwo) {
if ($selOne == 'url') {
$header[] = $websiteTypes[$selTwo];
$mapperRelatedContactWebsiteTypeVal = $selTwo;
} else {
$header[] = $locationTypes[$selTwo];
$mapperRelatedContactLocTypeVal = $selTwo;
if ($selThree) {
if ($selOne == 'phone') {
$header[] = $phoneTypes[$selThree];
$mapperRelatedContactPhoneTypeVal = $selThree;
} elseif ($selOne == 'im') {
$header[] = $imProviders[$selThree];
$mapperRelatedContactImProviderVal = $selThree;
}
}
}
}
}
}
$mapperFields[] = implode(' - ', $header);
//set the respective mapper param array values.
foreach ($mapperPeroperties as $mapperProKey => $mapperProVal) {
$this->{"_{$mapperProKey}"}[$key] = ${$mapperProVal};
}
}
$this->_parser = new CRM_Import_Parser_Contact($this->_mapperKeys, $this->_mapperLocTypes, $this->_mapperPhoneTypes, $this->_mapperImProviders, $this->_mapperRelated, $this->_mapperRelatedContactType, $this->_mapperRelatedContactDetails, $this->_mapperRelatedContactLocType, $this->_mapperRelatedContactPhoneType, $this->_mapperRelatedContactImProvider, $this->_mapperWebsiteTypes, $this->_mapperRelatedContactWebsiteType);
$this->_parser->run($this->_tableName, $mapperFields, CRM_Import_Parser::MODE_IMPORT, $this->_contactType, $this->_primaryKeyName, $this->_statusFieldName, $this->_onDuplicate, $this->_statusID, $this->_totalRowCount, $this->_doGeocodeAddress, CRM_Import_Parser::DEFAULT_TIMEOUT, $this->_contactSubType, $this->_dedupe);
$contactIds = $this->_parser->getImportedContacts();
//get the related contactIds. CRM-2926
$relatedContactIds = $this->_parser->getRelatedImportedContacts();
if ($relatedContactIds) {
$contactIds = array_merge($contactIds, $relatedContactIds);
if ($form) {
$form->set('relatedCount', count($relatedContactIds));
}
}
if ($this->_newGroupName || count($this->_groups)) {
$groupAdditions = $this->_addImportedContactsToNewGroup($contactIds, $this->_newGroupName, $this->_newGroupDesc);
if ($form) {
$form->set('groupAdditions', $groupAdditions);
}
}
if ($this->_newTagName || count($this->_tag)) {
$tagAdditions = $this->_tagImportedContactsWithNewTag($contactIds, $this->_newTagName, $this->_newTagDesc);
if ($form) {
$form->set('tagAdditions', $tagAdditions);
//.........这里部分代码省略.........
示例8: resolveDefaults
/**
*
* Get the values for pseudoconstants for name->value and reverse.
*
* @param array $defaults (reference) the default values, some of which need to be resolved.
* @param boolean $reverse true if we want to resolve the values in the reverse direction (value -> name)
*
* @return none
* @access public
* @static
*/
static function resolveDefaults(&$defaults, $reverse = FALSE)
{
// hack for birth_date
if (CRM_Utils_Array::value('birth_date', $defaults)) {
if (is_array($defaults['birth_date'])) {
$defaults['birth_date'] = CRM_Utils_Date::format($defaults['birth_date'], '-');
}
}
CRM_Utils_Array::lookupValue($defaults, 'prefix', CRM_Core_PseudoConstant::individualPrefix(), $reverse);
CRM_Utils_Array::lookupValue($defaults, 'suffix', CRM_Core_PseudoConstant::individualSuffix(), $reverse);
CRM_Utils_Array::lookupValue($defaults, 'gender', CRM_Core_PseudoConstant::gender(), $reverse);
//lookup value of email/postal greeting, addressee, CRM-4575
foreach (self::$_greetingTypes as $greeting) {
$filterCondition = array('contact_type' => CRM_Utils_Array::value('contact_type', $defaults), 'greeting_type' => $greeting);
CRM_Utils_Array::lookupValue($defaults, $greeting, CRM_Core_PseudoConstant::greeting($filterCondition), $reverse);
}
$blocks = array('address', 'im', 'phone');
foreach ($blocks as $name) {
if (!array_key_exists($name, $defaults) || !is_array($defaults[$name])) {
continue;
}
foreach ($defaults[$name] as $count => &$values) {
//get location type id.
CRM_Utils_Array::lookupValue($values, 'location_type', CRM_Core_PseudoConstant::locationType(), $reverse);
if ($name == 'address') {
// FIXME: lookupValue doesn't work for vcard_name
if (CRM_Utils_Array::value('location_type_id', $values)) {
$vcardNames = CRM_Core_PseudoConstant::locationVcardName();
$values['vcard_name'] = $vcardNames[$values['location_type_id']];
}
if (!CRM_Utils_Array::lookupValue($values, 'country', CRM_Core_PseudoConstant::country(), $reverse) && $reverse) {
CRM_Utils_Array::lookupValue($values, 'country', CRM_Core_PseudoConstant::countryIsoCode(), $reverse);
}
// CRM-7597
// if we find a country id above, we need to restrict it to that country
// rather than the list of all countries
if (!empty($values['country_id'])) {
$stateProvinceList = CRM_Core_PseudoConstant::stateProvinceForCountry($values['country_id']);
} else {
$stateProvinceList = CRM_Core_PseudoConstant::stateProvince();
}
if (!CRM_Utils_Array::lookupValue($values, 'state_province', $stateProvinceList, $reverse) && $reverse) {
if (!empty($values['country_id'])) {
$stateProvinceList = CRM_Core_PseudoConstant::stateProvinceForCountry($values['country_id'], 'abbreviation');
} else {
$stateProvinceList = CRM_Core_PseudoConstant::stateProvinceAbbreviation();
}
CRM_Utils_Array::lookupValue($values, 'state_province', $stateProvinceList, $reverse);
}
if (!empty($values['state_province_id'])) {
$countyList = CRM_Core_PseudoConstant::countyForState($values['state_province_id']);
} else {
$countyList = CRM_Core_PseudoConstant::county();
}
CRM_Utils_Array::lookupValue($values, 'county', $countyList, $reverse);
}
if ($name == 'im') {
CRM_Utils_Array::lookupValue($values, 'provider', CRM_Core_PseudoConstant::IMProvider(), $reverse);
}
if ($name == 'phone') {
CRM_Utils_Array::lookupValue($values, 'phone_type', CRM_Core_PseudoConstant::phoneType(), $reverse);
}
//kill the reference.
unset($values);
}
}
}
示例9: postProcess
/**
* Process the mapped fields and map it into the uploaded file
* preview the file and extract some summary statistics
*
* @return void
* @access public
*/
public function postProcess()
{
$params = $this->controller->exportValues('MapField');
//reload the mapfield if load mapping is pressed
if (!empty($params['savedMapping'])) {
$this->set('savedMapping', $params['savedMapping']);
$this->controller->resetPage($this->_name);
return;
}
$mapperKeys = array();
$mapper = array();
$mapperKeys = $this->controller->exportValue($this->_name, 'mapper');
$mapperKeysMain = array();
$mapperLocType = array();
$mapperPhoneType = array();
$mapperImProvider = array();
$locations = array();
$phoneTypes = CRM_Core_PseudoConstant::phoneType();
$imProviders = CRM_Core_PseudoConstant::IMProvider();
for ($i = 0; $i < $this->_columnCount; $i++) {
$mapper[$i] = $this->_mapperFields[$mapperKeys[$i][0]];
$mapperKeysMain[$i] = $mapperKeys[$i][0];
if (isset($mapperKeys[$i][1]) && is_numeric($mapperKeys[$i][1])) {
$mapperLocType[$i] = $mapperKeys[$i][1];
} else {
$mapperLocType[$i] = null;
}
$locations[$i] = isset($mapperLocType[$i]) ? $this->_location_types[$mapperLocType[$i]] : null;
// to store phone_type id and provider id seperately, CRM-3140
if (CRM_Utils_Array::value($i, $mapperKeysMain) == 'phone') {
$mapperPhoneType[$i] = $phoneTypes[$mapperKeys[$i][2]];
$mapperImProvider[$i] = null;
} else {
if (CRM_Utils_Array::value($i, $mapperKeysMain) == 'im') {
$mapperImProvider[$i] = $imProviders[$mapperKeys[$i][2]];
$mapperPhoneType[$i] = null;
} else {
$mapperPhoneType[$i] = null;
$mapperImProvider[$i] = null;
}
}
//relationship info
if (isset($mapperKeys[$i]) && isset($mapperKeys[$i][0])) {
list($id, $first, $second) = CRM_Utils_System::explode('_', $mapperKeys[$i][0], 3);
} else {
list($id, $first, $second) = array(null, null, null);
}
if ($first == 'a' && $second == 'b' || $first == 'b' && $second == 'a') {
$related[$i] = $this->_mapperFields[$mapperKeys[$i][0]];
$relatedContactLocType[$i] = isset($mapperKeys[$i][1]) ? $this->_location_types[$mapperKeys[$i][2]] : null;
//$relatedContactPhoneType[$i] = !is_numeric($mapperKeys[$i][2]) ? $mapperKeys[$i][3] : null;
// to store phoneType id and provider id seperately for ralated contact, CRM-3140
if (CRM_Utils_Array::value('1', $mapperKeys[$i]) == 'phone') {
$relatedContactPhoneType[$i] = isset($mapperKeys[$i][3]) ? $phoneTypes[$mapperKeys[$i][3]] : null;
$relatedContactImProvider[$i] = null;
} else {
if (CRM_Utils_Array::value('1', $mapperKeys[$i]) == 'im') {
$relatedContactImProvider[$i] = isset($mapperKeys[$i][3]) ? $imProviders[$mapperKeys[$i][3]] : null;
$relatedContactPhoneType[$i] = null;
}
}
$relationType =& new CRM_Contact_DAO_RelationshipType();
$relationType->id = $id;
$relationType->find(true);
eval('$relatedContactType[$i] = $relationType->contact_type_' . $second . ';');
$relatedContactDetails[$i] = $this->_formattedFieldNames[$relatedContactType[$i]][$mapperKeys[$i][1]];
} else {
$related[$i] = null;
$relatedContactType[$i] = null;
$relatedContactDetails[$i] = null;
$relatedContactLocType[$i] = null;
$relatedContactPhoneType[$i] = null;
$relatedContactImProvider[$i] = null;
}
}
$this->set('mapper', $mapper);
$this->set('locations', $locations);
$this->set('phones', $mapperPhoneType);
$this->set('ims', $mapperImProvider);
$this->set('columnNames', $this->_columnNames);
//relationship info
$this->set('related', $related);
$this->set('relatedContactType', $relatedContactType);
$this->set('relatedContactDetails', $relatedContactDetails);
$this->set('relatedContactLocType', $relatedContactLocType);
$this->set('relatedContactPhoneType', $relatedContactPhoneType);
$this->set('relatedContactImProvider', $relatedContactImProvider);
// store mapping Id to display it in the preview page
$this->set('loadMappingId', CRM_Utils_Array::value('mappingId', $params));
//Updating Mapping Records
if (CRM_Utils_Array::value('updateMapping', $params)) {
$locationTypes =& CRM_Core_PseudoConstant::locationType();
$mappingFields =& new CRM_Core_DAO_MappingField();
//.........这里部分代码省略.........
示例10: postProcessOld
/**
* Process the mapped fields and map it into the uploaded file
* preview the file and extract some summary statistics
*
* @return void
* @access public
*/
public function postProcessOld()
{
$doGeocodeAddress = $this->controller->exportValue('DataSource', 'doGeocodeAddress');
$invalidRowCount = $this->get('invalidRowCount');
$conflictRowCount = $this->get('conflictRowCount');
$onDuplicate = $this->get('onDuplicate');
$newGroupName = $this->controller->exportValue($this->_name, 'newGroupName');
$newGroupDesc = $this->controller->exportValue($this->_name, 'newGroupDesc');
$groups = $this->controller->exportValue($this->_name, 'groups');
$allGroups = $this->get('groups');
$newTagName = $this->controller->exportValue($this->_name, 'newTagName');
$newTagDesc = $this->controller->exportValue($this->_name, 'newTagDesc');
$tag = $this->controller->exportValue($this->_name, 'tag');
$allTags = $this->get('tag');
$mapper = $this->controller->exportValue('MapField', 'mapper');
$mapperKeys = array();
$mapperLocTypes = array();
$mapperPhoneTypes = array();
$mapperRelated = array();
$mapperRelatedContactType = array();
$mapperRelatedContactDetails = array();
$mapperRelatedContactLocType = array();
$mapperRelatedContactPhoneType = array();
foreach ($mapper as $key => $value) {
$mapperKeys[$key] = $mapper[$key][0];
if (is_numeric($mapper[$key][1])) {
$mapperLocTypes[$key] = $mapper[$key][1];
} else {
$mapperLocTypes[$key] = null;
}
if (CRM_Utils_Array::value($key, $mapperKeys) == 'phone') {
$mapperPhoneTypes[$key] = $mapper[$key][2];
} else {
$mapperPhoneTypes[$key] = null;
}
list($id, $first, $second) = explode('_', $mapper[$key][0]);
if ($first == 'a' && $second == 'b' || $first == 'b' && $second == 'a') {
$relationType =& new CRM_Contact_DAO_RelationshipType();
$relationType->id = $id;
$relationType->find(true);
eval('$mapperRelatedContactType[$key] = $relationType->contact_type_' . $second . ';');
$mapperRelated[$key] = $mapper[$key][0];
$mapperRelatedContactDetails[$key] = $mapper[$key][1];
$mapperRelatedContactLocType[$key] = $mapper[$key][2];
$mapperRelatedContactPhoneType[$key] = $mapper[$key][3];
} else {
$mapperRelated[$key] = null;
$mapperRelatedContactType[$key] = null;
$mapperRelatedContactDetails[$key] = null;
$mapperRelatedContactLocType[$key] = null;
$mapperRelatedContactPhoneType[$key] = null;
}
}
$parser =& new CRM_Import_Parser_Contact($mapperKeys, $mapperLocTypes, $mapperPhoneTypes, $mapperRelated, $mapperRelatedContactType, $mapperRelatedContactDetails, $mapperRelatedContactLocType, $mapperRelatedContactPhoneType);
$mapFields = $this->get('fields');
$locationTypes = CRM_Core_PseudoConstant::locationType();
$phoneTypes = CRM_Core_PseudoConstant::phoneType();
foreach ($mapper as $key => $value) {
$header = array();
list($id, $first, $second) = explode('_', $mapper[$key][0]);
if ($first == 'a' && $second == 'b' || $first == 'b' && $second == 'a') {
$relationType =& new CRM_Contact_DAO_RelationshipType();
$relationType->id = $id;
$relationType->find(true);
$header[] = $relationType->name_a_b;
$header[] = ucwords(str_replace("_", " ", $mapper[$key][1]));
if (isset($mapper[$key][2])) {
$header[] = $locationTypes[$mapper[$key][2]];
}
if (isset($mapper[$key][3])) {
$header[] = $phoneTypes[$mapper[$key][3]];
}
} else {
if (isset($mapFields[$mapper[$key][0]])) {
$header[] = $mapFields[$mapper[$key][0]];
if (isset($mapper[$key][1])) {
$header[] = $locationTypes[$mapper[$key][1]];
}
if (isset($mapper[$key][2])) {
$header[] = $phoneTypes[$mapper[$key][2]];
}
}
}
$mapperFields[] = implode(' - ', $header);
}
$tableName = $this->get('importTableName');
//print "Running parser on table: $tableName<br/>";
$parser->run($tableName, $mapperFields, CRM_Import_Parser::MODE_IMPORT, $this->get('contactType'), $this->get('primaryKeyName'), $this->get('statusFieldName'), $onDuplicate, $this->get('statusID'), $this->get('totalRowCount'), $doGeocodeAddress, CRM_Import_Parser::DEFAULT_TIMEOUT, $this->get('contactSubType'));
// add the new contacts to selected groups
$contactIds =& $parser->getImportedContacts();
// add the new related contacts to selected groups
$relatedContactIds =& $parser->getRelatedImportedContacts();
$this->set('relatedCount', count($relatedContactIds));
//.........这里部分代码省略.........
示例11: runImport
public function runImport(&$form, $timeout = 55)
{
$mapper = $this->_mapper;
foreach ($mapper as $key => $value) {
$this->_mapperKeys[$key] = $mapper[$key][0];
if (is_numeric($mapper[$key][1])) {
$this->_mapperLocTypes[$key] = $mapper[$key][1];
} else {
$this->_mapperLocTypes[$key] = null;
}
//to store phoneType id and provider id separately for contact
if (is_numeric($mapper[$key][2])) {
if (CRM_Utils_Array::value('0', $mapper[$key]) == 'phone') {
$this->_mapperPhoneTypes[$key] = $mapper[$key][2];
$this->_mapperImProviders[$key] = null;
} else {
if (CRM_Utils_Array::value('0', $mapper[$key]) == 'im') {
$this->_mapperImProviders[$key] = $mapper[$key][2];
$this->_mapperPhoneTypes[$key] = null;
}
}
} else {
$this->_mapperPhoneTypes[$key] = null;
$this->_mapperImProviders[$key] = null;
}
list($id, $first, $second) = explode('_', $mapper[$key][0]);
if ($first == 'a' && $second == 'b' || $first == 'b' && $second == 'a') {
$relationType =& new CRM_Contact_DAO_RelationshipType();
$relationType->id = $id;
$relationType->find(true);
eval('$this->_mapperRelatedContactType[$key] = $relationType->contact_type_' . $second . ';');
$this->_mapperRelated[$key] = $mapper[$key][0];
$this->_mapperRelatedContactDetails[$key] = $mapper[$key][1];
$this->_mapperRelatedContactLocType[$key] = $mapper[$key][2];
//to store phoneType id and provider id separately for related contact
if (CRM_Utils_Array::value('1', $mapper[$key]) == 'phone') {
$this->_mapperRelatedContactPhoneType[$key] = $mapper[$key][3];
$this->_mapperRelatedContactImProvider[$key] = null;
} else {
if (CRM_Utils_Array::value('1', $mapper[$key]) == 'im') {
$this->_mapperRelatedContactImProvider[$key] = $mapper[$key][3];
$this->_mapperRelatedContactPhoneType[$key] = null;
} else {
$this->_mapperRelatedContactPhoneType[$key] = null;
$this->_mapperRelatedContactImProvider[$key] = null;
}
}
} else {
$this->_mapperRelated[$key] = null;
$this->_mapperRelatedContactType[$key] = null;
$this->_mapperRelatedContactDetails[$key] = null;
$this->_mapperRelatedContactLocType[$key] = null;
$this->_mapperRelatedContactPhoneType[$key] = null;
$this->_mapperRelatedContactImProvider[$key] = null;
}
}
require_once 'CRM/Import/Parser/Contact.php';
$this->_parser = new CRM_Import_Parser_Contact($this->_mapperKeys, $this->_mapperLocTypes, $this->_mapperPhoneTypes, $this->_mapperImProviders, $this->_mapperRelated, $this->_mapperRelatedContactType, $this->_mapperRelatedContactDetails, $this->_mapperRelatedContactLocType, $this->_mapperRelatedContactPhoneType, $this->_mapperRelatedContactImProvider);
$locationTypes = CRM_Core_PseudoConstant::locationType();
$phoneTypes = CRM_Core_PseudoConstant::phoneType();
$imProviders = CRM_Core_PseudoConstant::IMProvider();
foreach ($mapper as $key => $value) {
$header = array();
list($id, $first, $second) = explode('_', $mapper[$key][0]);
if ($first == 'a' && $second == 'b' || $first == 'b' && $second == 'a') {
$relationType =& new CRM_Contact_DAO_RelationshipType();
$relationType->id = $id;
$relationType->find(true);
$header[] = $relationType->name_a_b;
$header[] = ucwords(str_replace("_", " ", $mapper[$key][1]));
if (isset($mapper[$key][2])) {
$header[] = $locationTypes[$mapper[$key][2]];
}
if (isset($mapper[$key][3])) {
if (CRM_Utils_Array::value('1', $mapper[$key]) == 'phone') {
$header[] = $phoneTypes[$mapper[$key][3]];
} else {
if (CRM_Utils_Array::value('1', $mapper[$key]) == 'im') {
$header[] = $imProviders[$mapper[$key][3]];
}
}
}
} else {
if (isset($this->_mapFields[$mapper[$key][0]])) {
$header[] = $this->_mapFields[$mapper[$key][0]];
if (isset($mapper[$key][1])) {
$header[] = $locationTypes[$mapper[$key][1]];
}
if (isset($mapper[$key][2])) {
if (CRM_Utils_Array::value('0', $mapper[$key]) == 'phone') {
$header[] = $phoneTypes[$mapper[$key][2]];
} else {
if (CRM_Utils_Array::value('0', $mapper[$key]) == 'im') {
$header[] = $imProviders[$mapper[$key][2]];
}
}
}
}
}
$mapperFields[] = implode(' - ', $header);
//.........这里部分代码省略.........
示例12: exportComponents
/**
* Function to get the list the export fields
*
* @param int $selectAll user preference while export
* @param array $ids contact ids
* @param array $params associated array of fields
* @param string $order order by clause
* @param array $associated array of fields
* @param array $moreReturnProperties additional return fields
* @param int $exportMode export mode
* @param string $componentClause component clause
*
* @static
* @access public
*/
static function exportComponents($selectAll, $ids, $params, $order = null, $fields = null, $moreReturnProperties = null, $exportMode = CRM_Export_Form_Select::CONTACT_EXPORT, $componentClause = null)
{
$headerRows = array();
$primary = false;
$returnProperties = array();
$origFields = $fields;
$queryMode = null;
$paymentFields = false;
$phoneTypes = CRM_Core_PseudoConstant::phoneType();
$imProviders = CRM_Core_PseudoConstant::IMProvider();
$contactRelationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(null, null, null, null, true, 'label', false);
$queryMode = CRM_Contact_BAO_Query::MODE_CONTACTS;
switch ($exportMode) {
case CRM_Export_Form_Select::CONTRIBUTE_EXPORT:
$queryMode = CRM_Contact_BAO_Query::MODE_CONTRIBUTE;
break;
case CRM_Export_Form_Select::EVENT_EXPORT:
$queryMode = CRM_Contact_BAO_Query::MODE_EVENT;
break;
case CRM_Export_Form_Select::MEMBER_EXPORT:
$queryMode = CRM_Contact_BAO_Query::MODE_MEMBER;
break;
case CRM_Export_Form_Select::PLEDGE_EXPORT:
$queryMode = CRM_Contact_BAO_Query::MODE_PLEDGE;
break;
case CRM_Export_Form_Select::CASE_EXPORT:
$queryMode = CRM_Contact_BAO_Query::MODE_CASE;
break;
}
require_once 'CRM/Core/BAO/CustomField.php';
if ($fields) {
//construct return properties
$locationTypes =& CRM_Core_PseudoConstant::locationType();
$locationTypeFields = array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'postal_code', 'postal_code_suffix', 'geo_code_1', 'geo_code_2', 'state_province', 'country', 'phone', 'email', 'im');
foreach ($fields as $key => $value) {
$phoneTypeId = null;
$imProviderId = null;
$relationshipTypes = $fieldName = CRM_Utils_Array::value(1, $value);
if (!$fieldName) {
continue;
}
// get phoneType id and IM service provider id seperately
if ($fieldName == 'phone') {
$phoneTypeId = CRM_Utils_Array::value(3, $value);
} else {
if ($fieldName == 'im') {
$imProviderId = CRM_Utils_Array::value(3, $value);
}
}
if (array_key_exists($relationshipTypes, $contactRelationshipTypes)) {
if (CRM_Utils_Array::value(2, $value)) {
$relationField = CRM_Utils_Array::value(2, $value);
if (trim(CRM_Utils_Array::value(3, $value))) {
$relLocTypeId = CRM_Utils_Array::value(3, $value);
} else {
$relLocTypeId = 1;
}
if ($relationField == 'phone') {
$relPhoneTypeId = CRM_Utils_Array::value(4, $value);
} else {
if ($relationField == 'im') {
$relIMProviderId = CRM_Utils_Array::value(4, $value);
}
}
} else {
if (CRM_Utils_Array::value(4, $value)) {
$relationField = CRM_Utils_Array::value(4, $value);
$relLocTypeId = CRM_Utils_Array::value(5, $value);
if ($relationField == 'phone') {
$relPhoneTypeId = CRM_Utils_Array::value(6, $value);
} else {
if ($relationField == 'im') {
$relIMProviderId = CRM_Utils_Array::value(6, $value);
}
}
}
}
}
$contactType = CRM_Utils_Array::value(0, $value);
$locTypeId = CRM_Utils_Array::value(2, $value);
$phoneTypeId = CRM_Utils_Array::value(3, $value);
if ($relationField) {
if (in_array($relationField, $locationTypeFields)) {
if ($relPhoneTypeId) {
$returnProperties[$relationshipTypes]['location'][$locationTypes[$relLocTypeId]]['phone-' . $relPhoneTypeId] = 1;
//.........这里部分代码省略.........
示例13: resolveDefaults
/**
*
* Get the values for pseudoconstants for name->value and reverse.
*
* @param array $defaults (reference) the default values, some of which need to be resolved.
* @param boolean $reverse true if we want to resolve the values in the reverse direction (value -> name)
*
* @return none
* @access public
* @static
*/
static function resolveDefaults(&$defaults, $reverse = false)
{
// hack for birth_date
if (CRM_Utils_Array::value('birth_date', $defaults)) {
if (is_array($defaults['birth_date'])) {
$defaults['birth_date'] = CRM_Utils_Date::format($defaults['birth_date'], '-');
}
}
CRM_Utils_Array::lookupValue($defaults, 'prefix', CRM_Core_PseudoConstant::individualPrefix(), $reverse);
CRM_Utils_Array::lookupValue($defaults, 'suffix', CRM_Core_PseudoConstant::individualSuffix(), $reverse);
CRM_Utils_Array::lookupValue($defaults, 'gender', CRM_Core_PseudoConstant::gender(), $reverse);
//lookup value of email/postal greeting, addressee, CRM-4575
$filterCondition = array('contact_type' => CRM_Utils_Array::value('contact_type', $defaults), 'greeting_type' => 'email_greeting');
CRM_Utils_Array::lookupValue($defaults, 'email_greeting', CRM_Core_PseudoConstant::greeting($filterCondition), $reverse);
$filterCondition = array('contact_type' => CRM_Utils_Array::value('contact_type', $defaults), 'greeting_type' => 'postal_greeting');
CRM_Utils_Array::lookupValue($defaults, 'postal_greeting', CRM_Core_PseudoConstant::greeting($filterCondition), $reverse);
$filterCondition = array('contact_type' => CRM_Utils_Array::value('contact_type', $defaults), 'greeting_type' => 'addressee');
CRM_Utils_Array::lookupValue($defaults, 'addressee', CRM_Core_PseudoConstant::greeting($filterCondition), $reverse);
$blocks = array('address', 'im', 'phone');
foreach ($blocks as $name) {
if (!array_key_exists($name, $defaults) || !is_array($defaults[$name])) {
continue;
}
foreach ($defaults[$name] as $count => &$values) {
//get location type id.
CRM_Utils_Array::lookupValue($values, 'location_type', CRM_Core_PseudoConstant::locationType(), $reverse);
if ($name == 'address') {
// FIXME: lookupValue doesn't work for vcard_name
if (CRM_Utils_Array::value('location_type_id', $values)) {
$vcardNames =& CRM_Core_PseudoConstant::locationVcardName();
$values['vcard_name'] = $vcardNames[$values['location_type_id']];
}
if (!CRM_Utils_Array::lookupValue($values, 'state_province', CRM_Core_PseudoConstant::stateProvince(), $reverse) && $reverse) {
CRM_Utils_Array::lookupValue($values, 'state_province', CRM_Core_PseudoConstant::stateProvinceAbbreviation(), $reverse);
}
if (!CRM_Utils_Array::lookupValue($values, 'country', CRM_Core_PseudoConstant::country(), $reverse) && $reverse) {
CRM_Utils_Array::lookupValue($values, 'country', CRM_Core_PseudoConstant::countryIsoCode(), $reverse);
}
CRM_Utils_Array::lookupValue($values, 'county', CRM_Core_PseudoConstant::county(), $reverse);
}
if ($name == 'im') {
CRM_Utils_Array::lookupValue($values, 'provider', CRM_Core_PseudoConstant::IMProvider(), $reverse);
}
if ($name == 'phone') {
CRM_Utils_Array::lookupValue($values, 'phone_type', CRM_Core_PseudoConstant::phoneType(), $reverse);
}
//kill the reference.
unset($values);
}
}
}
示例14: exportComponents
/**
* Function to get the list the export fields
*
* @param int $selectAll user preference while export
* @param array $ids contact ids
* @param array $params associated array of fields
* @param string $order order by clause
* @param array $fields associated array of fields
* @param array $moreReturnProperties additional return fields
* @param int $exportMode export mode
* @param string $componentClause component clause
* @param string $componentTable component table
* @param bool $mergeSameAddress merge records if they have same address
* @param bool $mergeSameHousehold merge records if they belong to the same household
*
* @static
* @access public
*/
static function exportComponents($selectAll, $ids, $params, $order = null, $fields = null, $moreReturnProperties = null, $exportMode = CRM_Export_Form_Select::CONTACT_EXPORT, $componentClause = null, $componentTable = null, $mergeSameAddress = false, $mergeSameHousehold = false)
{
$headerRows = $returnProperties = array();
$primary = $paymentFields = false;
$origFields = $fields;
$queryMode = null;
$phoneTypes = CRM_Core_PseudoConstant::phoneType();
$imProviders = CRM_Core_PseudoConstant::IMProvider();
$contactRelationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(null, null, null, null, true, 'label', false);
$queryMode = CRM_Contact_BAO_Query::MODE_CONTACTS;
switch ($exportMode) {
case CRM_Export_Form_Select::CONTRIBUTE_EXPORT:
$queryMode = CRM_Contact_BAO_Query::MODE_CONTRIBUTE;
break;
case CRM_Export_Form_Select::EVENT_EXPORT:
$queryMode = CRM_Contact_BAO_Query::MODE_EVENT;
break;
case CRM_Export_Form_Select::MEMBER_EXPORT:
$queryMode = CRM_Contact_BAO_Query::MODE_MEMBER;
break;
case CRM_Export_Form_Select::PLEDGE_EXPORT:
$queryMode = CRM_Contact_BAO_Query::MODE_PLEDGE;
break;
case CRM_Export_Form_Select::CASE_EXPORT:
$queryMode = CRM_Contact_BAO_Query::MODE_CASE;
break;
case CRM_Export_Form_Select::GRANT_EXPORT:
$queryMode = CRM_Contact_BAO_Query::MODE_GRANT;
break;
case CRM_Export_Form_Select::ACTIVITY_EXPORT:
$queryMode = CRM_Contact_BAO_Query::MODE_ACTIVITY;
break;
}
require_once 'CRM/Core/BAO/CustomField.php';
if ($fields) {
//construct return properties
$locationTypes = CRM_Core_PseudoConstant::locationType();
$locationTypeFields = array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'postal_code', 'postal_code_suffix', 'geo_code_1', 'geo_code_2', 'state_province', 'country', 'phone', 'email', 'im');
foreach ($fields as $key => $value) {
$phoneTypeId = $imProviderId = null;
$relationshipTypes = $fieldName = CRM_Utils_Array::value(1, $value);
if (!$fieldName) {
continue;
}
// get phoneType id and IM service provider id seperately
if ($fieldName == 'phone') {
$phoneTypeId = CRM_Utils_Array::value(3, $value);
} else {
if ($fieldName == 'im') {
$imProviderId = CRM_Utils_Array::value(3, $value);
}
}
if (array_key_exists($relationshipTypes, $contactRelationshipTypes)) {
if (CRM_Utils_Array::value(2, $value)) {
$relationField = CRM_Utils_Array::value(2, $value);
if (trim(CRM_Utils_Array::value(3, $value))) {
$relLocTypeId = CRM_Utils_Array::value(3, $value);
} else {
$relLocTypeId = 'Primary';
}
if ($relationField == 'phone') {
$relPhoneTypeId = CRM_Utils_Array::value(4, $value);
} else {
if ($relationField == 'im') {
$relIMProviderId = CRM_Utils_Array::value(4, $value);
}
}
} else {
if (CRM_Utils_Array::value(4, $value)) {
$relationField = CRM_Utils_Array::value(4, $value);
$relLocTypeId = CRM_Utils_Array::value(5, $value);
if ($relationField == 'phone') {
$relPhoneTypeId = CRM_Utils_Array::value(6, $value);
} else {
if ($relationField == 'im') {
$relIMProviderId = CRM_Utils_Array::value(6, $value);
}
}
}
}
}
$contactType = CRM_Utils_Array::value(0, $value);
//.........这里部分代码省略.........
示例15:
/**
* Get all phone type
* The static array phoneType is returned
*
* @access public
* @static
*
* @param boolean $all - get All phone type - default is to get
* only active ones.
*
* @return array - array reference of all phone types.
*
*/
public static function &phoneType()
{
if (!self::$phoneType) {
self::$phoneType = CRM_Core_OptionGroup::values('phone_type');
}
return self::$phoneType;
}