本文整理汇总了PHP中CCrmFieldMulti::GetListEx方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmFieldMulti::GetListEx方法的具体用法?PHP CCrmFieldMulti::GetListEx怎么用?PHP CCrmFieldMulti::GetListEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmFieldMulti
的用法示例。
在下文中一共展示了CCrmFieldMulti::GetListEx方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContactInfo
protected static function getContactInfo($contactID)
{
if ($contactID <= 0) {
return array();
}
$result = array('FULL_NAME' => '', 'FULL_ADDRESS' => '', 'PHONE' => '', 'EMAIL' => '');
$dbRes = \CCrmContact::GetListEx(array(), array('=ID' => $contactID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('NAME', 'SECOND_NAME', 'LAST_NAME', 'ADDRESS', 'ADDRESS_2', 'ADDRESS_CITY', 'ADDRESS_POSTAL_CODE', 'ADDRESS_REGION', 'ADDRESS_PROVINCE', 'ADDRESS_COUNTRY'));
$fields = is_object($dbRes) ? $dbRes->Fetch() : null;
if (is_array($fields)) {
$result['FULL_NAME'] = \CCrmContact::PrepareFormattedName($fields);
$result['FULL_ADDRESS'] = Format\ContactAddressFormatter::format($fields, array('SEPARATOR' => Format\AddressSeparator::NewLine));
$dbRes = \CCrmFieldMulti::GetListEx(array('ID' => 'asc'), array('ENTITY_ID' => 'CONTACT', 'ELEMENT_ID' => $contactID, '@TYPE_ID' => array('PHONE', 'EMAIL')), false, false, array('TYPE_ID', 'VALUE'));
while ($multiFields = $dbRes->Fetch()) {
if ($result['PHONE'] === '' && $multiFields['TYPE_ID'] === 'PHONE') {
$result['PHONE'] = $multiFields['VALUE'];
} elseif ($result['EMAIL'] === '' && $multiFields['TYPE_ID'] === 'EMAIL') {
$result['EMAIL'] = $multiFields['VALUE'];
}
if ($result['PHONE'] !== '' && $result['EMAIL'] !== '') {
break;
}
}
}
return $result;
}
示例2: prepareEntityMultifieldsValues
public static function prepareEntityMultifieldsValues($entityTypeID, $entityID)
{
$dbResult = \CCrmFieldMulti::GetListEx(array(), array('=ENTITY_ID' => \CCrmOwnerType::ResolveName($entityTypeID), '=ELEMENT_ID' => $entityID, '@TYPE_ID' => array('PHONE', 'EMAIL')), false, false, array('TYPE_ID', 'VALUE', 'VALUE_TYPE'));
$results = array();
if (is_object($dbResult)) {
while ($fields = $dbResult->Fetch()) {
$typeID = isset($fields['TYPE_ID']) ? $fields['TYPE_ID'] : '';
$value = isset($fields['VALUE']) ? $fields['VALUE'] : '';
$valueType = isset($fields['VALUE_TYPE']) ? $fields['VALUE_TYPE'] : '';
if ($typeID === '' || $value === '') {
continue;
}
if (!isset($results[$typeID])) {
$results[$typeID] = array();
}
$results[$typeID][] = array('VALUE' => $value, 'VALUE_TYPE' => $valueType);
}
}
return $results;
}
示例3: prepareRecoveryData
public static function prepareRecoveryData($entityTypeID, $entityID, array $options = null)
{
if (!is_int($entityTypeID)) {
$entityTypeID = intval($entityTypeID);
}
if (!\CCrmOwnerType::IsDefined($entityTypeID)) {
throw new Main\ArgumentException('Is not defined', 'entityTypeID');
}
if (!is_int($entityID)) {
$entityID = intval($entityID);
}
if ($entityID <= 0) {
throw new Main\ArgumentException('Must be greater than zero', 'entityID');
}
if (!is_array($options)) {
$options = array();
}
$item = new EntityRecoveryData();
$item->setEntityTypeID($entityTypeID);
$item->setEntityID($entityID);
$userID = isset($options['USER_ID']) ? intval($options['USER_ID']) : 0;
if ($userID > 0) {
$item->setUserID($userID);
}
if ($entityTypeID === \CCrmOwnerType::Lead) {
$result = \CCrmLead::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('*', 'UF_*'));
$fields = is_object($result) ? $result->Fetch() : null;
if (!is_array($fields)) {
throw new Main\ObjectNotFoundException("The lead with ID '{$entityTypeID}' is not found");
}
$item->setDataItem('FIELDS', $fields);
if (isset($fields['TITLE'])) {
$item->setTitle($fields['TITLE']);
}
if (isset($fields['ASSIGNED_BY_ID'])) {
$item->setResponsibleID(intval($fields['ASSIGNED_BY_ID']));
}
} elseif ($entityTypeID === \CCrmOwnerType::Contact) {
$result = \CCrmContact::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('*', 'UF_*'));
$fields = is_object($result) ? $result->Fetch() : null;
if (!is_array($fields)) {
throw new Main\ObjectNotFoundException("The contact with ID '{$entityTypeID}' is not found");
}
$item->setDataItem('FIELDS', $fields);
$item->setTitle(\CCrmContact::GetFullName($fields, true));
if (isset($fields['ASSIGNED_BY_ID'])) {
$item->setResponsibleID(intval($fields['ASSIGNED_BY_ID']));
}
} elseif ($entityTypeID === \CCrmOwnerType::Company) {
$result = \CCrmCompany::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('*', 'UF_*'));
$fields = is_object($result) ? $result->Fetch() : null;
if (!is_array($fields)) {
throw new Main\ObjectNotFoundException("The company with ID '{$entityTypeID}' is not found");
}
$item->setDataItem('FIELDS', $fields);
if (isset($fields['TITLE'])) {
$item->setTitle($fields['TITLE']);
}
if (isset($fields['ASSIGNED_BY_ID'])) {
$item->setResponsibleID(intval($fields['ASSIGNED_BY_ID']));
}
} else {
throw new Main\NotSupportedException("The entity type '" . \CCrmOwnerType::ResolveName($entityTypeID) . "' is not supported in current context");
}
$entityTypeName = \CCrmOwnerType::ResolveName($entityTypeID);
//MULTI FIELDS -->
$multiFieldData = array();
$multiFieldTypes = array(\CCrmFieldMulti::PHONE, \CCrmFieldMulti::EMAIL, \CCrmFieldMulti::WEB, \CCrmFieldMulti::IM);
foreach ($multiFieldTypes as $multiFieldType) {
$result = \CCrmFieldMulti::GetListEx(array('ID' => 'ASC'), array('TYPE_ID' => $multiFieldType, 'ENTITY_ID' => $entityTypeName, 'ELEMENT_ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, array('nTopCount' => 50), array('VALUE_TYPE', 'VALUE'));
if (!is_object($result)) {
continue;
}
while ($multiFields = $result->Fetch()) {
$valueType = isset($multiFields['VALUE_TYPE']) ? $multiFields['VALUE_TYPE'] : '';
$value = isset($multiFields['VALUE']) ? $multiFields['VALUE'] : '';
if ($value === '') {
continue;
}
if (!isset($multiFieldData[$multiFieldType])) {
$multiFieldData[$multiFieldType] = array();
}
$multiFieldData[$multiFieldType][] = array('VALUE_TYPE' => $valueType, 'VALUE' => $value);
}
}
if (!empty($multiFieldData)) {
$item->setDataItem('MULTI_FIELDS', $multiFieldData);
}
//<-- MULTI FIELDS
//ACTIVITIES -->
$activityIDs = \CCrmActivity::GetBoundIDs($entityTypeID, $entityID);
if (!empty($activityIDs)) {
$item->setDataItem('ACTIVITY_IDS', $activityIDs);
}
//<-- ACTIVITIES
//EVENTS -->
$eventIDs = array();
$result = \CCrmEvent::GetListEx(array('EVENT_REL_ID' => 'ASC'), array('ENTITY_TYPE' => $entityTypeName, 'ENTITY_ID' => $entityID, 'EVENT_TYPE' => 0, 'CHECK_PERMISSIONS' => 'N'), false, false, array('EVENT_REL_ID'));
if (is_object($result)) {
while ($eventFields = $result->Fetch()) {
//.........这里部分代码省略.........
示例4: array
$entityTypeID = $entity->getEntityTypeID();
$entityID = $entity->getEntityID();
if (!isset($entityInfoByType[$entityTypeID])) {
$entityInfoByType[$entityTypeID] = array($entityID => array());
} elseif (count($entityInfoByType[$entityTypeID]) < 50 && !isset($entityInfoByType[$entityTypeID][$entityID])) {
$entityInfoByType[$entityTypeID][$entityID] = array();
}
}
}
unset($dup);
$totalEntities = 0;
$entityMultiFields = array();
foreach ($entityInfoByType as $entityTypeID => &$entityInfos) {
$totalEntities += count($entityInfos);
CCrmOwnerType::PrepareEntityInfoBatch($entityTypeID, $entityInfos, false, array('ENABLE_RESPONSIBLE' => true, 'ENABLE_EDIT_URL' => true, 'PHOTO_SIZE' => array('WIDTH' => 21, 'HEIGHT' => 21)));
$multiFieldResult = CCrmFieldMulti::GetListEx(array(), array('=ENTITY_ID' => CCrmOwnerType::ResolveName($entityTypeID), '@ELEMENT_ID' => array_keys($entityInfos), '@TYPE_ID' => array('PHONE', 'EMAIL')), false, false, array('ELEMENT_ID', 'TYPE_ID', 'VALUE'));
if (is_object($multiFieldResult)) {
$entityMultiFields[$entityTypeID] = array();
while ($multiFields = $multiFieldResult->Fetch()) {
$entityID = isset($multiFields['ELEMENT_ID']) ? intval($multiFields['ELEMENT_ID']) : 0;
if ($entityID <= 0) {
continue;
}
if (!isset($entityMultiFields[$entityTypeID][$entityID])) {
$entityMultiFields[$entityTypeID][$entityID] = array();
}
$typeID = isset($multiFields['TYPE_ID']) ? $multiFields['TYPE_ID'] : '';
$value = isset($multiFields['VALUE']) ? $multiFields['VALUE'] : '';
if ($typeID === '' || $value === '') {
continue;
}
示例5: prepareListItemMultiFields
protected function prepareListItemMultiFields(&$entityMap, $entityTypeID, $typeIDs)
{
$entityIDs = array_keys($entityMap);
if (empty($entityIDs)) {
return;
}
$entityTypeName = CCrmOwnerType::ResolveName($entityTypeID);
if ($entityTypeName === '') {
return;
}
$dbResult = CCrmFieldMulti::GetListEx(array(), array('=ENTITY_ID' => $entityTypeName, '@ELEMENT_ID' => $entityIDs, '@TYPE_ID' => $typeIDs));
while ($fm = $dbResult->Fetch()) {
$typeID = isset($fm['TYPE_ID']) ? $fm['TYPE_ID'] : '';
if (!in_array($typeID, $typeIDs, true)) {
continue;
}
$entityID = isset($fm['ELEMENT_ID']) ? intval($fm['ELEMENT_ID']) : 0;
if (!isset($entityMap[$entityID])) {
continue;
}
$entity =& $entityMap[$entityID];
if (!isset($entity['FM'])) {
$entity['FM'] = array();
}
if (!isset($entity['FM'][$typeID])) {
$entity['FM'][$typeID] = array();
}
$entity['FM'][$typeID][] = array('ID' => $fm['ID'], 'VALUE_TYPE' => $fm['VALUE_TYPE'], 'VALUE' => $fm['VALUE']);
unset($entity);
}
}