本文整理汇总了PHP中CCrmOwnerType::ResolveID方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmOwnerType::ResolveID方法的具体用法?PHP CCrmOwnerType::ResolveID怎么用?PHP CCrmOwnerType::ResolveID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmOwnerType
的用法示例。
在下文中一共展示了CCrmOwnerType::ResolveID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: internalize
public function internalize(array $params)
{
$this->items = array();
foreach ($params as $k => $v) {
$entityTypeID = \CCrmOwnerType::ResolveID($k);
if ($entityTypeID !== \CCrmOwnerType::Undefined) {
$item = new EntityConversionConfigItem($entityTypeID);
$item->internalize($v);
$this->addItem($item);
}
}
}
示例2: ParseEntityKey
public static function ParseEntityKey($key, &$entityInfo)
{
if (preg_match(self::$ENTITY_KEY, strval($key), $match) !== 1) {
$entityInfo = array();
return false;
}
$entityTypeAbbr = strtoupper($match[1]);
$entityID = intval($match[2]);
$entityTypeID = CCrmOwnerType::ResolveID($entityTypeAbbr);
$entityTypeName = CCrmOwnerType::ResolveName($entityTypeID);
$entityInfo = array('ENTITY_TYPE_ABBR' => $entityTypeAbbr, 'ENTITY_TYPE_ID' => $entityTypeID, 'ENTITY_TYPE_NAME' => $entityTypeName, 'ENTITY_ID' => $entityID);
return true;
}
示例3: load
protected static function load()
{
if (self::$items !== null) {
return;
}
self::$items = array();
$s = Main\Config\Option::get('crm', 'crm_uf_history', '', '');
$ary = $s !== '' ? unserialize($s) : null;
if (is_array($ary)) {
foreach ($ary as $k => $v) {
if ($v === '') {
continue;
}
$entityTypeID = \CCrmOwnerType::ResolveID($k);
if ($entityTypeID !== \CCrmOwnerType::Undefined) {
self::$items[$entityTypeID] = new DateTime($v, \DateTime::ISO8601);
}
}
}
}
示例4: ShowError
$enablePermissionCheck = !$isAdminUser;
if (!CCrmContact::CheckReadPermission(0, $userPermissions) && !CCrmCompany::CheckReadPermission(0, $userPermissions) && !CCrmLead::CheckReadPermission(0, $userPermissions)) {
ShowError(GetMessage('CRM_PERMISSION_DENIED'));
return;
}
$arResult['USER_ID'] = $userID;
$listID = isset($arParams['LIST_ID']) ? $arParams['LIST_ID'] : '';
if ($listID === '') {
$listID = uniqid('dedupe_');
}
$arResult['LIST_ID'] = $listID;
$arResult['ERRORS'] = array();
$arResult['MESSAGES'] = array();
$entityTypeID = isset($arParams['ENTITY_TYPE_ID']) ? intval($arParams['ENTITY_TYPE_ID']) : CCrmOwnerType::Undefined;
if ($entityTypeID === CCrmOwnerType::Undefined && isset($arParams['ENTITY_TYPE'])) {
$entityTypeID = CCrmOwnerType::ResolveID($arParams['ENTITY_TYPE']);
}
if ($entityTypeID !== CCrmOwnerType::Contact && $entityTypeID !== CCrmOwnerType::Company && $entityTypeID !== CCrmOwnerType::Lead) {
ShowError(GetMessage('CRM_DEDUPE_LIST_INVALID_ENTITY_TYPE', array('#TYPE_NAME#' => CCrmOwnerType::ResolveName($entityTypeID))));
return;
}
$arResult['ENTITY_TYPE_ID'] = $entityTypeID;
$entityTypeName = $arResult['ENTITY_TYPE_NAME'] = \CCrmOwnerType::ResolveName($entityTypeID);
//TYPE INDEX INFO
$typeInfos = array();
$indexedTypes = $arResult['TYPES'] = Integrity\DuplicateIndexBuilder::getExistedTypes($entityTypeID, $userID);
$supportedTypes = $arResult['SUPPORTED_TYPES'] = Integrity\DuplicateIndexType::getSupportedTypes($entityTypeID);
$typeDescriptions = $arResult['TYPE_DESCRIPTIONS'] = Integrity\DuplicateIndexType::getAllDescriptions();
$selectedTypes = array();
$filterTypeID = isset($_GET['typeId']) ? (int) $_GET['typeId'] : Integrity\DuplicateIndexType::UNDEFINED;
$skippedTypeIDs = array();
示例5: GetDocumentAuthorID
public static function GetDocumentAuthorID($documentId)
{
if (!is_array($documentId) || count($documentId) < 3) {
return 0;
}
$documentInfo = self::GetDocumentInfo($documentId[2]);
$entityTypeName = isset($documentInfo['TYPE']) ? $documentInfo['TYPE'] : '';
$entityId = isset($documentInfo['ID']) ? intval($documentInfo['ID']) : 0;
return CCrmOwnerType::GetResponsibleID(CCrmOwnerType::ResolveID($entityTypeName), $entityId, false);
}
示例6: array
}
CCrmEntityHelper::PrepareMultiFieldFilter($arFilter);
$arImmutableFilters = array('FM', 'ID', 'ASSIGNED_BY_ID', 'CURRENCY_ID', 'CONTACT_ID', 'COMPANY_ID', 'LEAD_ID', 'DEAL_ID', 'CREATED_BY_ID', 'MODIFY_BY_ID', 'PRODUCT_ROW_PRODUCT_ID');
foreach ($arFilter as $k => $v) {
if (in_array($k, $arImmutableFilters, true)) {
continue;
}
$arMatch = array();
if (in_array($k, array('PRODUCT_ID', 'STATUS_ID', 'COMPANY_ID', 'LEAD_ID', 'DEAL_ID', 'CONTACT_ID'))) {
// Bugfix #23121 - to suppress comparison by LIKE
$arFilter['=' . $k] = $v;
unset($arFilter[$k]);
} elseif ($k === 'ENTITIES_LINKS') {
$ownerData = explode('_', $v);
if (count($ownerData) > 1) {
$ownerTypeName = CCrmOwnerType::ResolveName(CCrmOwnerType::ResolveID($ownerData[0]));
$ownerID = intval($ownerData[1]);
if (!empty($ownerTypeName) && $ownerID > 0) {
$arFilter[$ownerTypeName . '_ID'] = $ownerID;
}
}
unset($arFilter[$k]);
} elseif (preg_match('/(.*)_from$/i' . BX_UTF_PCRE_MODIFIER, $k, $arMatch)) {
if (strlen($v) > 0) {
$arFilter['>=' . $arMatch[1]] = $v;
}
unset($arFilter[$k]);
} elseif (preg_match('/(.*)_to$/i' . BX_UTF_PCRE_MODIFIER, $k, $arMatch)) {
if (strlen($v) > 0) {
if (($arMatch[1] == 'DATE_CREATE' || $arMatch[1] == 'DATE_MODIFY') && !preg_match('/\\d{1,2}:\\d{1,2}(:\\d{1,2})?$/' . BX_UTF_PCRE_MODIFIER, $v)) {
$v .= ' 23:59:59';
示例7: isset
if (!CModule::IncludeModule('crm') || !CCrmSecurityHelper::IsAuthorized() || !check_bitrix_sessid()) {
die;
}
$componentData = isset($_REQUEST['PARAMS']) && is_array($_REQUEST['PARAMS']) ? $_REQUEST['PARAMS'] : array();
$componentParams = isset($componentData['params']) && is_array($componentData['params']) ? $componentData['params'] : array();
//Sanitaizing of Bindings (Only one binding is allowed in current context)
$bindings = isset($componentParams['BINDINGS']) && is_array($componentParams['BINDINGS']) ? $componentParams['BINDINGS'] : array();
if (empty($bindings)) {
die;
}
$binding = $bindings[0];
if (!is_array($binding)) {
die;
}
$ownerTypeName = isset($binding['TYPE_NAME']) ? $binding['TYPE_NAME'] : '';
$ownerTypeID = CCrmOwnerType::ResolveID($ownerTypeName);
$ownerID = isset($binding['ID']) ? (int) $binding['ID'] : 0;
if ($ownerTypeID === CCrmOwnerType::Undefined || $ownerID <= 0) {
die;
}
$userPermissions = CCrmPerms::GetCurrentUserPermissions();
if (!CCrmActivity::CheckReadPermission($ownerTypeID, $ownerID, $userPermissions)) {
die;
}
if (count($bindings) > 1) {
array_splice($bindings, 1);
}
$componentParams['BINDINGS'] = $componentData['params']['BINDINGS'] = $bindings;
//Sanitaizing of Permission Type
$permissionType = isset($componentParams['PERMISSION_TYPE']) ? strtoupper($componentParams['PERMISSION_TYPE']) : 'READ';
if ($permissionType !== 'READ' && !CCrmActivity::CheckUpdatePermission($ownerTypeID, $ownerID, $userPermissions)) {
示例8: EmailMessageAdd
//.........这里部分代码省略.........
} else {
//It is email from unknown user
//Try to resolve bindings from addresser
$arCommData = self::ExtractCommsFromEmails($arCommEmails);
if (!empty($arCommData)) {
// Try to resolve responsible user
foreach ($arCommData as &$arComm) {
$userID = self::ResolveResponsibleID($arComm['ENTITY_TYPE_ID'], $arComm['ENTITY_ID']);
if ($userID > 0) {
break;
}
}
unset($arComm);
}
}
// Try to resolve owner by old-style method-->
$arACTION_VARS = explode('&', $ACTION_VARS);
for ($i = 0, $ic = count($arACTION_VARS); $i < $ic; $i++) {
$v = $arACTION_VARS[$i];
if ($pos = strpos($v, '=')) {
$name = substr($v, 0, $pos);
${$name} = urldecode(substr($v, $pos + 1));
}
}
$arTypeNames = CCrmOwnerType::GetNames(array(CCrmOwnerType::Lead, CCrmOwnerType::Deal, CCrmOwnerType::Contact, CCrmOwnerType::Company));
foreach ($arTypeNames as $typeName) {
$regexVar = 'W_CRM_ENTITY_REGEXP_' . $typeName;
if (empty(${$regexVar})) {
continue;
}
$match = array();
if (preg_match('/' . ${$regexVar} . '/i' . BX_UTF_PCRE_MODIFIER, $subject, $match) === 1) {
$ownerID = intval($match[1]);
$ownerTypeID = CCrmOwnerType::ResolveID($typeName);
break;
}
}
// <-- Try to resolve owner by old-style method
// Filter communications by owner
if ($ownerTypeID > 0 && $ownerID > 0) {
if (!empty($arCommData)) {
foreach ($arCommData as $commKey => $arComm) {
if ($arComm['ENTITY_TYPE_ID'] === $ownerTypeID && $arComm['ENTITY_ID'] === $ownerID) {
continue;
}
unset($arCommData[$commKey]);
}
$arCommData = array_values($arCommData);
}
if (empty($arCommData)) {
if ($addresserID > 0) {
foreach ($addresseeEmails as $email) {
if ($email === $crmEmail) {
continue;
}
$arCommData = array(self::CreateComm($ownerTypeID, $ownerID, $email));
}
} else {
$arCommData = array(self::CreateComm($ownerTypeID, $ownerID, $addresserInfo['EMAIL']));
}
}
}
}
$arBindingData = self::ConvertCommsToBindings($arCommData);
// Check bindings for converted leads -->
// Not Existed entities are ignored. Converted leads are ignored if their associated entities (contacts, companies, deals) are contained in bindings.
示例9: isset
$commType = isset($comm['TYPE']) ? strtoupper(strval($comm['TYPE'])) : '';
if ($commType === '') {
$commType = 'EMAIL';
}
$commValue = isset($comm['VALUE']) ? strval($comm['VALUE']) : '';
if ($commType === 'EMAIL' && $commValue !== '') {
if (!check_email($commValue)) {
__CrmMobileActivityEditEndResonse(array('ERROR' => GetMessage('CRM_ACTIVITY_EDIT_INVALID_EMAIL', array('#VALUE#' => $commValue))));
}
$to[] = strtolower(trim($commValue));
}
$comms[] = array('ID' => $commID, 'TYPE' => $commType, 'VALUE' => $commValue, 'ENTITY_ID' => $commEntityID, 'ENTITY_TYPE_ID' => CCrmOwnerType::ResolveID($commEntityType));
if ($commEntityType !== '') {
$bindingKey = $commEntityID > 0 ? "{$commEntityType}_{$commEntityID}" : uniqid("{$commEntityType}_");
if (!isset($bindings[$bindingKey])) {
$bindings[$bindingKey] = array('OWNER_TYPE_ID' => CCrmOwnerType::ResolveID($commEntityType), 'OWNER_ID' => $commEntityID);
}
}
}
unset($comm);
if (empty($bindings)) {
$bindings["{$ownerTypeName}_{$ownerID}"] = array('OWNER_TYPE_ID' => $ownerTypeID, 'OWNER_ID' => $ownerID);
}
// <-- Bindings & Communications
if (empty($to)) {
__CrmMobileActivityEditEndResonse(array('ERROR' => GetMessage('CRM_ACTIVITY_EDIT_EMAIL_EMPTY_TO_FIELD')));
}
$nowStr = ConvertTimeStamp($now, 'FULL', SITE_ID);
$subject = isset($data['SUBJECT']) ? strval($data['SUBJECT']) : '';
if ($subject === '') {
$subject = GetMessage('CRM_ACTIVITY_EDIT_EMAIL_ACTION_DEFAULT_SUBJECT', array('#DATE#' => $nowStr));
示例10: processMethodRequest
public function processMethodRequest($name, $nameDetails, $arParams, $nav, $server)
{
$userPerms = CCrmPerms::GetCurrentUserPermissions();
if (!CCrmLead::CheckReadPermission(0, $userPerms) && !CCrmContact::CheckReadPermission(0, $userPerms) && !CCrmCompany::CheckReadPermission(0, $userPerms)) {
throw new RestException('Access denied.');
}
if (strtoupper($name) === 'FINDBYCOMM') {
$type = strtoupper($this->resolveParam($arParams, 'type'));
if ($type !== 'EMAIL' && $type !== 'PHONE') {
if ($type === '') {
throw new RestException("Communication type is not defined.");
} else {
throw new RestException("Communication type '{$type}' is not supported in current context.");
}
}
$values = $this->resolveArrayParam($arParams, 'values');
if (!is_array($values) || count($values) === 0) {
throw new RestException("Communication values is not defined.");
}
$entityTypeID = CCrmOwnerType::ResolveID($this->resolveMultiPartParam($arParams, array('entity', 'type')));
if ($entityTypeID === CCrmOwnerType::Deal) {
throw new RestException("Deal is not supported in current context.");
}
$criterions = array();
$dups = array();
$qty = 0;
foreach ($values as $value) {
if (!is_string($value) || $value === '') {
continue;
}
$criterion = new \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion($type, $value);
$isExists = false;
foreach ($criterions as $curCriterion) {
/** @var \Bitrix\Crm\Integrity\DuplicateCriterion $curCriterion */
if ($criterion->equals($curCriterion)) {
$isExists = true;
break;
}
}
if ($isExists) {
continue;
}
$criterions[] = $criterion;
$duplicate = $criterion->find($entityTypeID, 20);
if ($duplicate !== null) {
$dups[] = $duplicate;
}
$qty++;
if ($qty >= 20) {
break;
}
}
$entityByType = array();
foreach ($dups as $dup) {
/** @var \Bitrix\Crm\Integrity\Duplicate $dup */
$entities = $dup->getEntities();
if (!(is_array($entities) && !empty($entities))) {
continue;
}
//Each entity type limited by 50 items
foreach ($entities as $entity) {
/** @var \Bitrix\Crm\Integrity\DuplicateEntity $entity */
$entityTypeID = $entity->getEntityTypeID();
$entityTypeName = CCrmOwnerType::ResolveName($entityTypeID);
$entityID = $entity->getEntityID();
if (!isset($entityByType[$entityTypeName])) {
$entityByType[$entityTypeName] = array($entityID);
} elseif (!in_array($entityID, $entityByType[$entityTypeName], true)) {
$entityByType[$entityTypeName][] = $entityID;
}
}
}
return $entityByType;
}
throw new RestException('Method not found!', RestException::ERROR_METHOD_NOT_FOUND, CRestServer::STATUS_NOT_FOUND);
}
示例11: ShowError
use Bitrix\Crm\Integration\StorageType;
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
die;
}
if (!CModule::IncludeModule('crm')) {
ShowError(GetMessage('CRM_MODULE_NOT_INSTALLED'));
return;
}
CModule::IncludeModule('fileman');
$arResult['CONTAINER_ID'] = isset($arParams['~CONTAINER_ID']) ? $arParams['~CONTAINER_ID'] : '';
$arResult['PREFIX'] = isset($arParams['~PREFIX']) ? $arParams['~PREFIX'] : 'crm_default';
$arResult['EDITOR_ID'] = isset($arParams['~EDITOR_ID']) ? $arParams['~EDITOR_ID'] : $arResult['PREFIX'] . '_activity_editor';
$arResult['EDITOR_TYPE'] = isset($arParams['~EDITOR_TYPE']) ? $arParams['~EDITOR_TYPE'] : 'MIXED';
$arResult['EDITOR_ITEMS'] = isset($arParams['~EDITOR_ITEMS']) ? $arParams['~EDITOR_ITEMS'] : array();
$arResult['OWNER_TYPE'] = isset($arParams['~OWNER_TYPE']) ? $arParams['~OWNER_TYPE'] : '';
$arResult['OWNER_TYPE_ID'] = CCrmOwnerType::ResolveID($arResult['OWNER_TYPE']);
$arResult['OWNER_ID'] = isset($arParams['~OWNER_ID']) ? $arParams['~OWNER_ID'] : 0;
$arResult['READ_ONLY'] = isset($arParams['~READ_ONLY']) ? (bool) $arParams['~READ_ONLY'] : false;
$arResult['ENABLE_UI'] = isset($arParams['~ENABLE_UI']) ? (bool) $arParams['~ENABLE_UI'] : true;
$arResult['ENABLE_TOOLBAR'] = isset($arParams['~ENABLE_TOOLBAR']) ? (bool) $arParams['~ENABLE_TOOLBAR'] : true;
$arResult['TOOLBAR_ID'] = isset($arParams['~TOOLBAR_ID']) ? $arParams['~TOOLBAR_ID'] : '';
$arResult['BUTTON_ID'] = isset($arParams['~BUTTON_ID']) ? $arParams['~BUTTON_ID'] : '';
$arResult['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
$arResult['ENABLE_TASK_ADD'] = isset($arParams['~ENABLE_TASK_ADD']) ? (bool) $arParams['~ENABLE_TASK_ADD'] : IsModuleInstalled('tasks');
$arResult['ENABLE_CALENDAR_EVENT_ADD'] = isset($arParams['~ENABLE_CALENDAR_EVENT_ADD']) ? (bool) $arParams['~ENABLE_CALENDAR_EVENT_ADD'] : IsModuleInstalled('calendar');
$arResult['ENABLE_EMAIL_ADD'] = isset($arParams['~ENABLE_EMAIL_ADD']) ? (bool) $arParams['~ENABLE_EMAIL_ADD'] : IsModuleInstalled('subscribe');
$arResult['EVENT_VIEW_TAB_ID'] = isset($arParams['~EVENT_VIEW_TAB_ID']) ? $arParams['~EVENT_VIEW_TAB_ID'] : 'tab_event';
$arResult['FORM_ID'] = isset($arParams['~FORM_ID']) ? $arParams['~FORM_ID'] : '';
$arResult['DISABLE_STORAGE_EDIT'] = isset($arParams['~DISABLE_STORAGE_EDIT']) ? (bool) $arParams['~DISABLE_STORAGE_EDIT'] : false;
$storageTypeID = $arResult['STORAGE_TYPE_ID'] = CCrmActivity::GetDefaultStorageTypeID();
$arResult['ENABLE_DISK'] = $storageTypeID === StorageType::Disk;
示例12: isset
$arResult['GADGET'] = isset($arParams['GADGET']) && $arParams['GADGET'] == 'Y' ? 'Y' : 'N';
$entityType = isset($arParams['ENTITY_TYPE']) ? $arParams['ENTITY_TYPE'] : '';
$entityTypeID = CCrmOwnerType::ResolveID($entityType);
$arFilter = array();
if ($entityType !== '') {
$arFilter['ENTITY_TYPE'] = $arResult['ENTITY_TYPE'] = $entityType;
}
if (isset($arParams['ENTITY_ID'])) {
if (is_array($arParams['ENTITY_ID'])) {
array_walk($arParams['ENTITY_ID'], create_function('&$v', '$v = (int)$v;'));
$arFilter['ENTITY_ID'] = $arResult['ENTITY_ID'] = $arParams['ENTITY_ID'];
} elseif ($arParams['ENTITY_ID'] > 0) {
$arFilter['ENTITY_ID'] = $arResult['ENTITY_ID'] = (int) $arParams['ENTITY_ID'];
}
} else {
$ownerTypeID = isset($arParams['OWNER_TYPE']) ? CCrmOwnerType::ResolveID($arParams['OWNER_TYPE']) : CCrmOwnerType::Undefined;
$ownerID = isset($arParams['OWNER_ID']) ? (int) $arParams['OWNER_ID'] : 0;
if ($ownerID > 0 && $ownerTypeID === CCrmOwnerType::Company && $entityTypeID === CCrmOwnerType::Contact) {
$dbRes = CCrmContact::GetList(array(), array('COMPANY_ID' => $ownerID), array('ID'));
$arContactID = array();
while ($arRow = $dbRes->Fetch()) {
$arContactID[] = (int) $arRow['ID'];
}
if (empty($arContactID)) {
return 0;
}
$arFilter['ENTITY_ID'] = $arResult['ENTITY_ID'] = $arContactID;
}
}
if (isset($arParams['EVENT_COUNT'])) {
$arResult['EVENT_COUNT'] = intval($arParams['EVENT_COUNT']) > 0 ? intval($arParams['EVENT_COUNT']) : 50;
示例13: getHistory
/**
* Get synchronization history.
* @return array
*/
protected static function getHistory()
{
if (self::$history !== null) {
return self::$history;
}
self::$history = array();
$s = Main\Config\Option::get('crm', 'crm_uf_sync_history', '', '');
$ary = $s !== '' ? unserialize($s) : null;
if (is_array($ary)) {
foreach ($ary as $item) {
if (!is_array($item)) {
continue;
}
$srcEntityTypeID = \CCrmOwnerType::ResolveID(isset($item['src']) ? $item['src'] : '');
$dstEntityTypeID = \CCrmOwnerType::ResolveID(isset($item['dst']) ? $item['dst'] : '');
if ($srcEntityTypeID === \CCrmOwnerType::Undefined || $dstEntityTypeID === \CCrmOwnerType::Undefined) {
continue;
}
$sync = isset($item['sync']) ? $item['sync'] : '';
$check = isset($item['check']) ? $item['check'] : '';
try {
self::$history["{$srcEntityTypeID}_{$dstEntityTypeID}"] = array('src' => $srcEntityTypeID, 'dst' => $dstEntityTypeID, 'sync' => $sync !== '' ? new DateTime($sync, \DateTime::ISO8601) : null, 'check' => $check !== '' ? new DateTime($check, \DateTime::ISO8601) : null, 'required' => isset($item['required']) ? $item['required'] : null);
} catch (Main\ObjectException $e) {
}
}
}
return self::$history;
}
示例14: GetMessage
case CTaskColumnList::COLUMN_STATUS:
echo GetMessage('TASKS_LIST_ITEMS_STATUS_' . $task['REAL_STATUS']);
break;
case CTaskColumnList::COLUMN_PRIORITY:
echo GetMessage('TASKS_LIST_ITEMS_PRIORITY_' . $task['PRIORITY']);
break;
case CTaskColumnList::COLUMN_UF_CRM:
if (empty($task['UF_CRM_TASK'])) {
break;
}
$collection = array();
sort($task['UF_CRM_TASK']);
foreach ($task['UF_CRM_TASK'] as $value) {
$crmElement = explode('_', $value);
$type = $crmElement[0];
$typeId = CCrmOwnerType::ResolveID(CCrmOwnerTypeAbbr::ResolveName($type));
$title = CCrmOwnerType::GetCaption($typeId, $crmElement[1]);
$url = CCrmOwnerType::GetShowUrl($typeId, $crmElement[1]);
if (!isset($collection[$type])) {
$collection[$type] = array();
}
$collection[$type][] = '<a href="' . $url . '">' . $title . '</a>';
}
if ($collection) {
echo '<div class="tasks-list-crm-div">';
$prevType = null;
foreach ($collection as $type => $items) {
if ($type !== $prevType) {
if ($prevType !== null) {
echo ' ';
}
示例15: OnBeforeSocNetLogEntryGetRights
public static function OnBeforeSocNetLogEntryGetRights($arEntryParams, &$arRights)
{
if ((!isset($arEntryParams["ENTITY_TYPE"]) || !isset($arEntryParams["ENTITY_ID"])) && isset($arEntryParams["LOG_ID"]) && intval($arEntryParams["LOG_ID"]) > 0) {
if ($arLog = CSocNetLog::GetByID($arEntryParams["LOG_ID"])) {
$arEntryParams["ENTITY_TYPE"] = $arLog["ENTITY_TYPE"];
$arEntryParams["ENTITY_ID"] = $arLog["ENTITY_ID"];
$arEntryParams["EVENT_ID"] = $arLog["EVENT_ID"];
}
}
if (!isset($arEntryParams["ENTITY_TYPE"]) || !in_array($arEntryParams["ENTITY_TYPE"], CCrmLiveFeedEntity::GetAll()) || !isset($arEntryParams["ENTITY_ID"])) {
return true;
}
if ($arEntryParams["ENTITY_TYPE"] == CCrmLiveFeedEntity::Activity) {
if (!isset($arEntryParams["ACTIVITY"])) {
$arActivity = CCrmActivity::GetByID($arEntryParams["ENTITY_ID"]);
if (!$arActivity) {
return true;
}
$arEntryParams["ACTIVITY"] = $arActivity;
$arEntryParams["ACTIVITY"]["COMMUNICATIONS"] = CCrmActivity::GetCommunications($arActivity["ID"]);
}
$arRights[] = CCrmLiveFeedEntity::GetByEntityTypeID($arEntryParams["ACTIVITY"]["OWNER_TYPE_ID"]) . $arEntryParams["ACTIVITY"]["OWNER_ID"];
$ownerEntityCode = $arEntryParams["ACTIVITY"]["OWNER_TYPE_ID"] . "_" . $arEntryParams["ACTIVITY"]["OWNER_ID"];
if (!empty($arEntryParams["ACTIVITY"]["COMMUNICATIONS"])) {
foreach ($arEntryParams["ACTIVITY"]["COMMUNICATIONS"] as $arActivityCommunication) {
if ($arActivityCommunication["ENTITY_TYPE_ID"] . "_" . $arActivityCommunication["ENTITY_ID"] == $ownerEntityCode) {
$arRights[] = CCrmLiveFeedEntity::GetByEntityTypeID($arActivityCommunication["ENTITY_TYPE_ID"]) . $arActivityCommunication["ENTITY_ID"];
}
}
}
if ($arEntryParams["ACTIVITY"]["TYPE_ID"] == CCrmActivityType::Task && intval($arEntryParams["ACTIVITY"]["ASSOCIATED_ENTITY_ID"]) > 0 && CModule::IncludeModule("tasks")) {
$dbTask = CTasks::GetByID($arEntryParams["ACTIVITY"]["ASSOCIATED_ENTITY_ID"], false);
if ($arTaskFields = $dbTask->Fetch()) {
$arTaskOwners = isset($arTaskFields['UF_CRM_TASK']) ? $arTaskFields['UF_CRM_TASK'] : array();
$arOwnerData = array();
if (!is_array($arTaskOwners)) {
$arTaskOwners = array($arTaskOwners);
}
$arFields['BINDINGS'] = array();
if (CCrmActivity::TryResolveUserFieldOwners($arTaskOwners, $arOwnerData, CCrmUserType::GetTaskBindingField())) {
foreach ($arOwnerData as $arOwnerInfo) {
$arRights[] = CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::ResolveID($arOwnerInfo['OWNER_TYPE_NAME'])) . $arOwnerInfo['OWNER_ID'];
}
}
}
}
} elseif ($arEntryParams["ENTITY_TYPE"] == CCrmLiveFeedEntity::Invoice) {
if (!isset($arEntryParams["INVOICE"])) {
$arInvoice = CCrmInvoice::GetByID($arEntryParams["ENTITY_ID"]);
if (!$arInvoice) {
return true;
}
$arEntryParams["INVOICE"] = $arInvoice;
}
if (intval($arEntryParams["INVOICE"]["UF_CONTACT_ID"]) > 0) {
$arRights[] = CCrmLiveFeedEntity::Contact . $arEntryParams["INVOICE"]["UF_CONTACT_ID"];
}
if (intval($arEntryParams["INVOICE"]["UF_COMPANY_ID"]) > 0) {
$arRights[] = CCrmLiveFeedEntity::Company . $arEntryParams["INVOICE"]["UF_COMPANY_ID"];
}
if (intval($arEntryParams["INVOICE"]["UF_DEAL_ID"]) > 0) {
$arRights[] = CCrmLiveFeedEntity::Deal . $arEntryParams["INVOICE"]["UF_DEAL_ID"];
}
} else {
$arRights[] = $arEntryParams["ENTITY_TYPE"] . $arEntryParams["ENTITY_ID"];
if (in_array($arEntryParams["EVENT_ID"], array("crm_lead_message", "crm_deal_message", "crm_contact_message", "crm_company_message"))) {
$dbRight = CSocNetLogRights::GetList(array(), array("LOG_ID" => $arEntryParams["LOG_ID"]));
while ($arRight = $dbRight->Fetch()) {
$arRights[] = $arRight["GROUP_CODE"];
}
}
}
return false;
}