本文整理汇总了PHP中CCrmOwnerType::ResolveUserFieldEntityID方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmOwnerType::ResolveUserFieldEntityID方法的具体用法?PHP CCrmOwnerType::ResolveUserFieldEntityID怎么用?PHP CCrmOwnerType::ResolveUserFieldEntityID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmOwnerType
的用法示例。
在下文中一共展示了CCrmOwnerType::ResolveUserFieldEntityID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserFields
public static function getUserFields($entityTypeID)
{
if (self::$userFields !== null && isset(self::$userFields[$entityTypeID])) {
return self::$userFields[$entityTypeID];
}
if (self::$userFields !== null) {
self::$userFields = array();
}
/** @var \CAllUserTypeManager $USER_FIELD_MANAGER */
global $USER_FIELD_MANAGER;
self::$userFields[$entityTypeID] = $USER_FIELD_MANAGER->GetUserFields(\CCrmOwnerType::ResolveUserFieldEntityID($entityTypeID));
return self::$userFields[$entityTypeID];
}
示例2: getIntersection
/**
* Compares source type fields with destination type fields.
* Matches are searched by comparing field labels.
* @static
* @param int $srcEntityTypeID Source Entity Type ID
* @param int $dstEntityTypeID Destination Entity Type ID
* @param string $languageID Language
* @return Array
*/
public static function getIntersection($srcEntityTypeID, $dstEntityTypeID, $languageID = '')
{
if (!is_string($languageID) || $languageID === '') {
$languageID = LANGUAGE_ID;
}
$srcUfEntityID = \CCrmOwnerType::ResolveUserFieldEntityID($srcEntityTypeID);
$dstUfEntityID = \CCrmOwnerType::ResolveUserFieldEntityID($dstEntityTypeID);
/** @var \CAllUserTypeManager $USER_FIELD_MANAGER */
global $USER_FIELD_MANAGER;
/** @var \CAllMain $APPLICATION */
global $APPLICATION;
$srcFields = $USER_FIELD_MANAGER->GetUserFields($srcUfEntityID, 0, $languageID);
$dstFields = $USER_FIELD_MANAGER->GetUserFields($dstUfEntityID, 0, $languageID);
$map = array();
foreach ($dstFields as $field) {
$label = self::getFieldComplianceCode($field);
if ($label === '') {
continue;
}
$typeID = $field['USER_TYPE_ID'];
if (!isset($map[$typeID])) {
$map[$typeID] = array();
}
if (!isset($map[$typeID][$label])) {
$map[$typeID][$label] = array('NAME' => $field['FIELD_NAME'], 'IS_BUSY' => false);
}
}
$results = array();
foreach ($srcFields as $field) {
$label = self::getFieldComplianceCode($field);
if ($label === '') {
continue;
}
if (isset($results[$label])) {
continue;
}
$typeID = $field['USER_TYPE_ID'];
if (isset($map[$typeID]) && isset($map[$typeID][$label]) && !$map[$typeID][$label]['IS_BUSY']) {
$results[$label] = array('LABEL' => $label, 'SRC_FIELD_NAME' => $field['FIELD_NAME'], 'DST_FIELD_NAME' => $map[$typeID][$label]['NAME']);
$map[$typeID][$label]['IS_BUSY'] = true;
}
}
return $results;
}
示例3: __construct
function __construct($ownerTypeID, \CUser $user = null)
{
$this->ownerTypeID = CCrmOwnerType::IsDefined($ownerTypeID) ? $ownerTypeID : CCrmOwnerType::Undefined;
parent::__construct(CCrmOwnerType::ResolveUserFieldEntityID($this->ownerTypeID), $user);
$this->setNamePrefix('crm');
}
示例4: WriteFileToResponse
public static function WriteFileToResponse($ownerTypeID, $ownerID, $fieldName, $fileID, &$errors, $options = array())
{
$ownerTypeID = intval($ownerTypeID);
$ownerTypeName = CCrmOwnerType::ResolveName($ownerTypeID);
$ownerID = intval($ownerID);
$fieldName = strval($fieldName);
$fileID = intval($fileID);
$options = is_array($options) ? $options : array();
if (!CCrmOwnerType::IsDefined($ownerTypeID) || $ownerID <= 0 || $fieldName === '' || $fileID <= 0) {
$errors[] = 'File not found';
return false;
}
$authToken = isset($options['oauth_token']) ? strval($options['oauth_token']) : '';
if ($authToken !== '') {
$authData = array();
if (!(CModule::IncludeModule('rest') && CRestUtil::checkAuth($authToken, CCrmRestService::SCOPE_NAME, $authData) && CRestUtil::makeAuth($authData))) {
$errors[] = 'Access denied.';
return false;
}
}
if (!CCrmPerms::IsAdmin()) {
$userPermissions = CCrmPerms::GetCurrentUserPermissions();
$attrs = $userPermissions->GetEntityAttr($ownerTypeName, $ownerID);
if ($userPermissions->HavePerm($ownerTypeName, BX_CRM_PERM_NONE, 'READ') || !$userPermissions->CheckEnityAccess($ownerTypeName, 'READ', isset($attrs[$ownerID]) ? $attrs[$ownerID] : array())) {
$errors[] = 'Access denied.';
return false;
}
}
$isDynamic = isset($options['is_dynamic']) ? (bool) $options['is_dynamic'] : true;
if ($isDynamic) {
$userFields = $GLOBALS['USER_FIELD_MANAGER']->GetUserFields(CCrmOwnerType::ResolveUserFieldEntityID($ownerTypeID), $ownerID, LANGUAGE_ID);
$field = is_array($userFields) && isset($userFields[$fieldName]) ? $userFields[$fieldName] : null;
if (!(is_array($field) && $field['USER_TYPE_ID'] === 'file')) {
$errors[] = 'File not found';
return false;
}
$fileIDs = isset($field['VALUE']) ? is_array($field['VALUE']) ? $field['VALUE'] : array($field['VALUE']) : array();
//The 'strict' flag must be 'false'. In MULTIPLE mode value is an array of integers. In SIGLE mode value is a string.
if (!in_array($fileID, $fileIDs, false)) {
$errors[] = 'File not found';
return false;
}
return self::InnerWriteFileToResponse($fileID, $errors, $options);
} else {
$fieldsInfo = isset($options['fields_info']) ? $options['fields_info'] : null;
if (!is_array($fieldsInfo)) {
$fieldsInfo = CCrmOwnerType::GetFieldsInfo($ownerTypeID);
}
$fieldInfo = is_array($fieldsInfo) && isset($fieldsInfo[$fieldName]) ? $fieldsInfo[$fieldName] : array();
$fieldInfoType = isset($fieldInfo['TYPE']) ? $fieldInfo['TYPE'] : '';
if ($fieldInfoType !== 'file') {
$errors[] = 'File not found';
return false;
}
if ($fileID !== CCrmOwnerType::GetFieldIntValue($ownerTypeID, $ownerID, $fieldName)) {
$errors[] = 'File not found';
return false;
}
return self::InnerWriteFileToResponse($fileID, $errors, $options);
}
}