本文整理汇总了PHP中CCrmPerms::IsAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmPerms::IsAdmin方法的具体用法?PHP CCrmPerms::IsAdmin怎么用?PHP CCrmPerms::IsAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmPerms
的用法示例。
在下文中一共展示了CCrmPerms::IsAdmin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preparePermissionSql
/**
* @return string|boolean
*/
protected function preparePermissionSql()
{
if ($this->permissionSql !== null) {
return $this->permissionSql;
}
if (\CCrmPerms::IsAdmin($this->userID)) {
$this->permissionSql = '';
} else {
$this->permissionSql = \CCrmPerms::BuildSql(\CCrmOwnerType::DealName, '', 'READ', array('RAW_QUERY' => true, 'PERMS' => \CCrmPerms::GetUserPermissions($this->userID)));
}
return $this->permissionSql;
}
示例2: preparePermissionSql
protected function preparePermissionSql()
{
if ($this->permissionSql !== null) {
return $this->permissionSql;
}
$userID = $this->getUserID();
if (\CCrmPerms::IsAdmin($userID)) {
$this->permissionSql = '';
} else {
$this->permissionSql = \CCrmPerms::BuildSql(\CCrmOwnerType::ResolveName($this->getEntityTypeID()), '', 'READ', array('RAW_QUERY' => true, 'PERMS' => \CCrmPerms::GetUserPermissions($userID)));
}
return $this->permissionSql;
}
示例3: setUserID
public function setUserID($userID)
{
if (!is_integer($userID)) {
$userID = intval($userID);
}
$userID = max($userID, 0);
if ($this->userID === $userID) {
return;
}
$this->userID = $userID;
$this->userPermissions = null;
$this->userName = null;
$this->userIsAdmin = \CCrmPerms::IsAdmin($userID);
}
示例4: array
$filterFieldInfo = array('typeName' => 'USER', 'id' => $filterID, 'params' => array('data' => array('paramName' => "{$filterID}", 'elementId' => "{$prefix}_{$filterID}"), 'search' => array('paramName' => "{$filterID}_name", 'elementId' => "{$prefix}_{$filterID}_NAME")));
$gridManagerCfg['filterFields'][] = $filterFieldInfo;
}
}
$arResult['GRID_DATA'] = array();
foreach ($arResult['EVENT'] as $arEvent) {
$arEvent['FILE_HTML'] = "";
if (!empty($arEvent['FILES'])) {
$arEvent['FILE_HTML'] = '<div class="event-detail-files"><label class="event-detail-files-title">' . GetMessage('CRM_EVENT_TABLE_FILES') . ':</label><div class="event-detail-files-list">';
foreach ($arEvent['FILES'] as $key => $value) {
$arEvent['FILE_HTML'] .= '<div class="event-detail-file"><span class="event-detail-file-number">' . $key . '.</span><span class="event-detail-file-info"><a href="' . htmlspecialcharsbx($value['PATH']) . '" target="_blank" class="event-detail-file-link">' . htmlspecialcharsbx($value['NAME']) . '</a><span class="event-detail-file-size">(' . htmlspecialcharsbx($value['SIZE']) . ')</span></span></div>';
}
$arEvent['FILE_HTML'] .= '</div></div>';
}
$arActions = array();
if (CCrmPerms::IsAdmin() || $arEvent['CREATED_BY_ID'] == CCrmPerms::GetCurrentUserID() && $arEvent['EVENT_TYPE'] == 0) {
$arActions[] = array('ICONCLASS' => 'delete', 'TITLE' => GetMessage('CRM_EVENT_DELETE_TITLE'), 'TEXT' => GetMessage('CRM_EVENT_DELETE'), 'ONCLICK' => "BX.CrmEventListManager.items[\"{$managerID}\"].deleteItem(\"{$arEvent['ID']}\")");
}
$eventColor = '';
if ($arEvent['EVENT_TYPE'] == '0') {
$eventColor = 'color: #208c0b';
} elseif ($arEvent['EVENT_TYPE'] == '2') {
$eventColor = 'color: #9c8000';
}
$arColumns = array('CREATED_BY_FULL_NAME' => $arEvent['CREATED_BY_FULL_NAME'] == '' ? '' : '<a href="' . $arEvent['CREATED_BY_LINK'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arEvent['ID'] . '">' . $arEvent['CREATED_BY_FULL_NAME'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arEvent['CREATED_BY_ID'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arEvent['ID'] . '", "");</script>', 'EVENT_NAME' => '<span style="' . $eventColor . '">' . $arEvent['EVENT_NAME'] . '</span>', 'EVENT_DESC' => $arEvent['EVENT_DESC'] . $arEvent['FILE_HTML'], 'DATE_CREATE' => FormatDate('x', MakeTimeStamp($arEvent['DATE_CREATE']), time() + CTimeZone::GetOffset()));
if ($arResult['EVENT_ENTITY_LINK'] == 'Y') {
$arColumns['ENTITY_TYPE'] = !empty($arEvent['ENTITY_TYPE']) ? GetMessage('CRM_EVENT_ENTITY_TYPE_' . $arEvent['ENTITY_TYPE']) : '';
$arColumns['ENTITY_TITLE'] = !empty($arEvent['ENTITY_TITLE']) ? '<a href="' . $arEvent['ENTITY_LINK'] . '" id="balloon_' . $arResult['GRID_ID'] . '_I_' . $arEvent['ID'] . '">' . $arEvent['ENTITY_TITLE'] . '</a>' . '<script type="text/javascript">BX.tooltip("' . $arEvent['ENTITY_TYPE'] . '_' . $arEvent['ENTITY_ID'] . '", "balloon_' . $arResult['GRID_ID'] . '_I_' . $arEvent['ID'] . '", "/bitrix/components/bitrix/crm.' . strtolower($arEvent['ENTITY_TYPE']) . '.show/card.ajax.php", "crm_balloon' . ($arEvent['ENTITY_TYPE'] == 'LEAD' || $arEvent['ENTITY_TYPE'] == 'DEAL' || $arEvent['ENTITY_TYPE'] == 'QUOTE' ? '_no_photo' : '_' . strtolower($arEvent['ENTITY_TYPE'])) . '", true);</script>' : '';
} else {
unset($arEvent['ENTITY_TYPE']);
unset($arEvent['ENTITY_TITLE']);
示例5: bitrix_sessid
$arBP['PATH_TO_BIZPROC_START'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_QUOTE_SHOW'],
array(
'quote_id' => $arResult['QUOTE'][$iQuoteId]['ID']
)),
array(
'workflow_template_id' => $arBP['ID'], 'bizproc_start' => 1, 'sessid' => bitrix_sessid(),
'CRM_QUOTE_SHOW_V12_active_tab' => 'tab_bizproc', 'backurl' => $arParams['PATH_TO_QUOTE_LIST'])
);
$arResult['QUOTE'][$iQuoteId]['BIZPROC_LIST'][] = $arBP;
}*/
}
}
if (!$isInExportMode) {
$arResult['NEED_FOR_REBUILD_QUOTE_ATTRS'] = false;
if (!$bInternal && CCrmPerms::IsAdmin() && COption::GetOptionString('crm', '~CRM_REBUILD_QUOTE_ATTR', 'N') === 'Y') {
$arResult['PATH_TO_PRM_LIST'] = CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_perm_list'));
$arResult['NEED_FOR_REBUILD_QUOTE_ATTRS'] = true;
}
$this->IncludeComponentTemplate();
include_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/components/bitrix/crm.quote/include/nav.php';
return $arResult['ROWS_COUNT'];
} else {
$APPLICATION->RestartBuffer();
// hack. any '.default' customized template should contain 'excel' page
$this->__templateName = '.default';
if ($sExportType === 'carddav') {
Header('Content-Type: text/vcard');
} elseif ($sExportType === 'csv') {
Header('Content-Type: text/csv');
Header('Content-Disposition: attachment;filename=quotes.csv');
示例6: GetMessage
}
if ($err_msg == "" && !CModule::IncludeModule('crm')) {
$err_msg = "failure\n" . GetMessage('CRM_MODULE_NOT_INSTALLED');
}
if ($err_msg == "" && !CModule::IncludeModule('catalog')) {
$err_msg = "failure\n" . GetMessage('CATALOG_MODULE_NOT_INSTALLED');
}
if ($err_msg == "" && !CModule::IncludeModule('sale')) {
$err_msg = "failure\n" . GetMessage('SALE_MODULE_NOT_INSTALLED');
}
$userPerms = CCrmPerms::GetCurrentUserPermissions();
if ($err_msg == "" && !CCrmPerms::IsAuthorized()) {
$err_msg = "failure.\n" . GetMessage('CRM_EXCH1C_AUTH_ERROR');
}
$crmPerms = new CCrmPerms($GLOBALS["USER"]->GetID());
if ($err_msg == "" && !CCrmPerms::IsAdmin() && !$crmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE')) {
$err_msg = "failure.\n" . GetMessage('CRM_EXCH1C_PERMISSION_DENIED');
}
$type = isset($_REQUEST["type"]) ? $_REQUEST["type"] : "";
if ($err_msg == "" && !in_array($type, array("sale", "catalog", "get_catalog"), true)) {
$err_msg = "failure.\n" . GetMessage('CRM_EXCH1C_UNKNOWN_COMMAND_TYPE');
}
if ($err_msg != "") {
$APPLICATION->RestartBuffer();
echo $err_msg;
return;
}
function OnCrmIblockXmlIdMiss(&$arFields)
{
global $APPLICATION;
$APPLICATION->throwException(GetMessage('CRM_EXCH1C_UNKNOWN_XML_ID'));
示例7: 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);
}
}
示例8: Prepare
public function Prepare($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array(), $arOptions = array())
{
global $DB;
if (!is_array($arOrder)) {
$arOrder = array();
}
if (!is_array($arFilter)) {
$arFilter = array();
}
// ID must present in select (If select is empty it will be filled by CSqlUtil::PrepareSql)
if (!is_array($arSelectFields)) {
$arSelectFields = array();
}
if (count($arSelectFields) > 0 && !in_array('*', $arSelectFields, true) && !in_array('ID', $arSelectFields, true)) {
$arSelectFields[] = 'ID';
}
if (!is_array($arOptions)) {
$arOptions = array();
}
$arOptions['DB_TYPE'] = $this->dbType;
$isExternalContext = isset($arOptions['IS_EXTERNAL_CONTEXT']) && ($arOptions['IS_EXTERNAL_CONTEXT'] === true || $arOptions['IS_EXTERNAL_CONTEXT'] === 'Y');
if ($isExternalContext) {
// Sanitizing of filter data
if (isset($arFilter['__JOINS'])) {
unset($arFilter['__JOINS']);
}
if (isset($arFilter['CHECK_PERMISSIONS'])) {
unset($arFilter['CHECK_PERMISSIONS']);
}
}
// Processing of special fields
if ($this->fmEntityID !== '' && isset($arFilter['FM'])) {
CCrmFieldMulti::PrepareExternalFilter($arFilter, array('ENTITY_ID' => $this->fmEntityID, 'MASTER_ALIAS' => $this->tableAlias, 'MASTER_IDENTITY' => 'ID'));
}
// Processing user fields
$ufSelectSql = null;
$ufFilterSql = null;
if ($this->ufEntityID !== '') {
$ufSelectSql = new CUserTypeSQL();
$ufSelectSql->SetEntity($this->ufEntityID, $this->tableAlias . '.ID');
$ufSelectSql->SetSelect($arSelectFields);
$ufSelectSql->SetOrder($arOrder);
$ufFilterSql = new CUserTypeSQL();
$ufFilterSql->SetEntity($this->ufEntityID, $this->tableAlias . '.ID');
$ufFilterSql->SetFilter($arFilter);
$userType = new CCrmUserType($GLOBALS['USER_FIELD_MANAGER'], $this->ufEntityID);
$userType->ListPrepareFilter($arFilter);
}
$this->sqlData = CSqlUtil::PrepareSql($this->fields, $arOrder, $arFilter, $arGroupBy, $arSelectFields, $arOptions);
$this->sqlData['SELECT'] = str_replace('%%_DISTINCT_%% ', '', $this->sqlData['SELECT']);
// 'Joins' implement custom filter logic
$joins = array();
if (isset($arFilter['__JOINS'])) {
if (is_array($arFilter['__JOINS'])) {
$joins = $arFilter['__JOINS'];
}
unset($arFilter['__JOINS']);
}
if (count($joins) > 0) {
foreach ($joins as &$join) {
// INNER JOINs will be added tostart
$this->Add2SqlData($join['SQL'], 'FROM', !isset($join['TYPE']) || $join['TYPE'] === 'INNER', isset($join['REPLACE']) ? $join['REPLACE'] : '');
}
unset($join);
}
// Apply user permission logic
if (count($this->permissionCallback) > 0) {
if ((!array_key_exists('CHECK_PERMISSIONS', $arFilter) || $arFilter['CHECK_PERMISSIONS'] !== 'N') && !CCrmPerms::IsAdmin()) {
$arPermType = !isset($arFilter['PERMISSION']) ? 'READ' : (is_array($arFilter['PERMISSION']) ? $arFilter['PERMISSION'] : array($arFilter['PERMISSION']));
$permissionSql = call_user_func_array($this->permissionCallback, array($this->tableAlias, $arPermType, $arOptions));
if (is_bool($permissionSql) && !$permissionSql) {
$CDBResult = new CDBResult();
$CDBResult->InitFromArray(array());
return $CDBResult;
}
if ($permissionSql !== '') {
$sqlType = isset($arOptions['PERMISSION_SQL_TYPE']) && $arOptions['PERMISSION_SQL_TYPE'] === 'FROM' ? 'FROM' : 'WHERE';
$this->Add2SqlData($permissionSql, $sqlType, $sqlType === 'FROM');
}
}
}
// Apply custom SQL logic
if (count($this->afterPrepareSqlCallback) > 0) {
$arUserSql = call_user_func_array($this->afterPrepareSqlCallback, array($this, $arOrder, $arFilter, $arGroupBy, $arSelectFields));
if (is_array($arUserSql)) {
if (isset($arUserSql['FROM'])) {
$this->Add2SqlData($arUserSql['FROM'], 'FROM');
}
if (isset($arUserSql['WHERE'])) {
$this->Add2SqlData($arUserSql['WHERE'], 'WHERE');
}
}
}
if ($ufSelectSql) {
// Adding user fields to SELECT
$this->Add2SqlData($ufSelectSql->GetSelect(), 'SELECT');
// Adding user fields to ORDER BY
if (is_array($arOrder)) {
foreach ($arOrder as $orderKey => $order) {
$orderSql = $ufSelectSql->GetOrder($orderKey);
//.........这里部分代码省略.........
示例9: BuildPermSql
public static function BuildPermSql($aliasPrefix = 'A', $permType = 'READ', $arOptions = array())
{
if (!is_array($arOptions)) {
$arOptions = array();
}
$userPermissions = isset($arOptions['PERMS']) ? $arOptions['PERMS'] : null;
$userID = $userPermissions !== null && is_object($userPermissions) ? $userPermissions->GetUserID() : 0;
if (CCrmPerms::IsAdmin($userID)) {
return '';
}
if (!CCrmPerms::IsAccessEnabled($userPermissions)) {
// User does not have permissions at all.
return false;
}
$entitiesSql = array();
$permOptions = array_merge(array('IDENTITY_COLUMN' => 'OWNER_ID'), $arOptions);
$entitiesSql[strval(CCrmOwnerType::Lead)] = CCrmLead::BuildPermSql($aliasPrefix, $permType, $permOptions);
$entitiesSql[strval(CCrmOwnerType::Deal)] = CCrmDeal::BuildPermSql($aliasPrefix, $permType, $permOptions);
$entitiesSql[strval(CCrmOwnerType::Contact)] = CCrmContact::BuildPermSql($aliasPrefix, $permType, $permOptions);
$entitiesSql[strval(CCrmOwnerType::Company)] = CCrmCompany::BuildPermSql($aliasPrefix, $permType, $permOptions);
$entitiesSql[strval(CCrmOwnerType::Invoice)] = CCrmInvoice::BuildPermSql($aliasPrefix, $permType, $permOptions);
foreach ($entitiesSql as $entityTypeID => $entitySql) {
if (!is_string($entitySql)) {
//If $entityPermSql is not string - acces denied. Clear permission SQL and related records will be ignored.
unset($entitiesSql[$entityTypeID]);
continue;
}
if ($entitySql !== '') {
$entitiesSql[$entityTypeID] = '(' . $aliasPrefix . '.OWNER_TYPE_ID = ' . $entityTypeID . ' AND (' . $entitySql . ') )';
} else {
// No permissions check - fetch all related records
$entitiesSql[$entityTypeID] = '(' . $aliasPrefix . '.OWNER_TYPE_ID = ' . $entityTypeID . ')';
}
}
//If $entitiesSql is empty - user does not have permissions at all.
if (empty($entitiesSql)) {
return false;
}
$userID = CCrmSecurityHelper::GetCurrentUserID();
if ($userID > 0) {
//Allow responsible user to view activity without permissions check.
return $aliasPrefix . '.RESPONSIBLE_ID = ' . $userID . ' OR ' . implode(' OR ', $entitiesSql);
} else {
return implode(' OR ', $entitiesSql);
}
}
示例10: ShowError
<?php
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
die;
}
global $APPLICATION;
use Bitrix\Crm\BirthdayReminder;
if (!CModule::IncludeModule('crm')) {
ShowError(GetMessage('CRM_MODULE_NOT_INSTALLED'));
return;
}
$userID = CCrmSecurityHelper::GetCurrentUserID();
$isAdminUser = CCrmPerms::IsAdmin($userID);
$userPermissions = CCrmPerms::GetUserPermissions($userID);
$canReadLead = CCrmLead::CheckReadPermission(0, $userPermissions);
$canReadContact = CCrmContact::CheckReadPermission(0, $userPermissions);
if (!$canReadLead && !$canReadContact) {
ShowError(GetMessage('CRM_PERMISSION_DENIED'));
return;
}
$arResult['USER_ID'] = $userID;
$listID = isset($arParams['LIST_ID']) ? $arParams['LIST_ID'] : '';
if ($listID === '') {
$listID = uniqid('birthdays_');
}
$arResult['LIST_ID'] = $listID;
$arResult['ERRORS'] = array();
$arResult['MESSAGES'] = array();
$arParams['NAME_FORMAT'] = isset($arParams['NAME_FORMAT']) ? $arParams['NAME_FORMAT'] : '';
$arResult['NAME_FORMAT'] = $arParams['NAME_FORMAT'] !== '' ? $arParams['NAME_FORMAT'] : \Bitrix\Crm\Format\PersonNameFormatter::getFormat();
$utils = new CComponentUtil();
示例11: foreach
$navigationIndex = CUserOptions::GetOption('crm.navigation', 'index');
if (is_array($navigationIndex)) {
foreach ($navigationIndex as $k => $v) {
$pageKey = 'PATH_TO_' . strtoupper("{$k}_{$v}");
$arParams['PATH_TO_' . strtoupper($k) . '_INDEX'] = $arParams['PATH_TO_' . strtoupper("{$k}_{$v}")];
}
}
//<-- Preparing of URL templates
$arResult['ACTIVE_ITEM_ID'] = isset($arParams['ACTIVE_ITEM_ID']) ? $arParams['ACTIVE_ITEM_ID'] : '';
$arResult['ENABLE_SEARCH'] = isset($arParams['ENABLE_SEARCH']) && is_bool($arParams['ENABLE_SEARCH']) ? $arParams['ENABLE_SEARCH'] : true;
$arResult['SEARCH_PAGE_URL'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_SEARCH_PAGE']);
$arResult['ID'] = isset($arParams['ID']) ? $arParams['ID'] : '';
if ($arResult['ID'] === '') {
$arResult['ID'] = 'DEFAULT';
}
$isAdmin = CCrmPerms::IsAdmin();
$userPermissions = CCrmPerms::GetCurrentUserPermissions();
// Prepere standard items -->
$counter = new CCrmUserCounter(CCrmPerms::GetCurrentUserID(), CCrmUserCounter::CurrentActivies);
$stdItems = array('STREAM' => array('ID' => 'STREAM', 'NAME' => GetMessage('CRM_CTRL_PANEL_ITEM_STREAM'), 'TITLE' => GetMessage('CRM_CTRL_PANEL_ITEM_STREAM_TITLE'), 'URL' => CComponentEngine::MakePathFromTemplate(isset($arParams['PATH_TO_STREAM']) ? $arParams['PATH_TO_STREAM'] : '#SITE_DIR#crm/stream/'), 'ICON' => 'feed'), 'MY_ACTIVITY' => array('ID' => 'MY_ACTIVITY', 'NAME' => GetMessage('CRM_CTRL_PANEL_ITEM_MY_ACTIVITY'), 'TITLE' => GetMessage('CRM_CTRL_PANEL_ITEM_MY_ACTIVITY_TITLE'), 'URL' => CComponentEngine::MakePathFromTemplate(isset($arParams['PATH_TO_ACTIVITY_LIST']) ? $arParams['PATH_TO_ACTIVITY_LIST'] : '#SITE_DIR#crm/activity/'), 'COUNTER' => $counter->GetValue(), 'ICON' => 'activity'));
if ($isAdmin || !$userPermissions->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'READ')) {
$counter = new CCrmUserCounter(CCrmPerms::GetCurrentUserID(), CCrmUserCounter::CurrentContactActivies);
$stdItems['CONTACT'] = array('ID' => 'CONTACT', 'NAME' => GetMessage('CRM_CTRL_PANEL_ITEM_CONTACT'), 'TITLE' => GetMessage('CRM_CTRL_PANEL_ITEM_CONTACT_TITLE'), 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_LIST']), 'ICON' => 'contact', 'COUNTER' => $counter->GetValue($arResult['ACTIVE_ITEM_ID'] === 'CONTACT'), 'ACTIONS' => array(array('ID' => 'CREATE', 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_EDIT'], array('contact_id' => 0)))));
}
if ($isAdmin || !$userPermissions->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'READ')) {
$counter = new CCrmUserCounter(CCrmPerms::GetCurrentUserID(), CCrmUserCounter::CurrentCompanyActivies);
$stdItems['COMPANY'] = array('ID' => 'COMPANY', 'NAME' => GetMessage('CRM_CTRL_PANEL_ITEM_COMPANY'), 'TITLE' => GetMessage('CRM_CTRL_PANEL_ITEM_COMPANY_TITLE'), 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_LIST']), 'ICON' => 'company', 'COUNTER' => $counter->GetValue($arResult['ACTIVE_ITEM_ID'] === 'COMPANY'), 'ACTIONS' => array(array('ID' => 'CREATE', 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_EDIT'], array('company_id' => 0)))));
}
if ($isAdmin || !$userPermissions->HavePerm('DEAL', BX_CRM_PERM_NONE, 'READ')) {
$counter = new CCrmUserCounter(CCrmPerms::GetCurrentUserID(), CCrmUserCounter::CurrentDealActivies);
$stdItems['DEAL'] = array('ID' => 'DEAL', 'NAME' => GetMessage('CRM_CTRL_PANEL_ITEM_DEAL'), 'TITLE' => GetMessage('CRM_CTRL_PANEL_ITEM_DEAL_TITLE'), 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_INDEX'] !== '' ? $arParams['PATH_TO_DEAL_INDEX'] : $arParams['PATH_TO_DEAL_LIST']), 'ICON' => 'deal', 'COUNTER' => $counter->GetValue($arResult['ACTIVE_ITEM_ID'] === 'DEAL'), 'ACTIONS' => array(array('ID' => 'CREATE', 'URL' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_EDIT'], array('deal_id' => 0)))));
示例12: array
$fields['~OWNER_FORMATTED_NAME'] = CUser::FormatName($arParams['NAME_TEMPLATE'], array('LOGIN' => $fields['~OWNER_LOGIN'], 'NAME' => $fields['~OWNER_NAME'], 'SECOND_NAME' => $fields['~OWNER_SECOND_NAME'], 'LAST_NAME' => $fields['~OWNER_LAST_NAME']), true, false);
$fields['OWNER_FORMATTED_NAME'] = htmlspecialcharsbx($fields['~OWNER_FORMATTED_NAME']);
$fields['~ENTITY_TYPE_NAME'] = isset($fields['~ENTITY_TYPE_ID']) ? CCrmOwnerType::GetDescription($fields['~ENTITY_TYPE_ID']) : '';
$fields['ENTITY_TYPE_NAME'] = htmlspecialcharsbx($fields['~ENTITY_TYPE_NAME']);
$fields['~SCOPE_NAME'] = isset($fields['~SCOPE']) ? CCrmMailTemplateScope::GetDescription($fields['~SCOPE']) : '';
$fields['SCOPE_NAME'] = htmlspecialcharsbx($fields['~SCOPE_NAME']);
$fields['CAN_EDIT'] = $fields['CAN_DELETE'] = $userID === intval($fields['~OWNER_ID']);
$fields['PATH_TO_EDIT'] = $fields['PATH_TO_DELETE'] = '';
if ($fields['CAN_EDIT']) {
$fields['PATH_TO_EDIT'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_MAIL_TEMPLATE_EDIT'], array('element_id' => $ID));
}
if ($fields['CAN_DELETE']) {
$fields['PATH_TO_DELETE'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_MAIL_TEMPLATE_LIST'], array('element_id' => $ID)), array('action_' . $arResult['GRID_ID'] => 'delete', 'ID' => $ID, 'sessid' => bitrix_sessid()));
}
$items[] = $fields;
$count++;
}
$arResult['ROWS_COUNT'] = $count;
$arResult['ITEMS'] =& $items;
$arResult['NEED_FOR_CONVERTING'] = false;
if (CCrmPerms::IsAdmin()) {
$curPage = $APPLICATION->GetCurPage();
if (COption::GetOptionString('crm', '~CRM_MAIL_TEMPLATE_LIST_CONVERTING', 'N') !== 'Y' && COption::GetOptionString('crm', 'email_from') !== '') {
$arResult['NEED_FOR_CONVERTING'] = true;
$sessid = bitrix_sessid();
$arResult['CONV_EXEC_URL'] = CHTTP::urlAddParams($curPage, array('conv' => 'exec', 'sessid' => $sessid));
$arResult['CONV_SKIP_URL'] = CHTTP::urlAddParams($curPage, array('conv' => 'skip', 'sessid' => $sessid));
}
}
$arResult['MESSAGE_VIEW_ID'] = isset($arParams['MESSAGE_VIEW_ID']) ? $arParams['MESSAGE_VIEW_ID'] : '';
$this->IncludeComponentTemplate();
示例13: WriteDiskFileToResponse
public static function WriteDiskFileToResponse($ownerTypeID, $ownerID, $fileID, &$errors, $options = array())
{
$ownerTypeID = (int) $ownerTypeID;
$ownerTypeName = CCrmOwnerType::ResolveName($ownerTypeID);
$ownerID = (int) $ownerID;
$fileID = (int) $fileID;
$options = is_array($options) ? $options : array();
if (!CCrmOwnerType::IsDefined($ownerTypeID) || $ownerID <= 0 || $fileID <= 0) {
$errors[] = 'Invalid data ownerTypeID = ' . $ownerTypeID . ', ownerID = ' . $ownerID . ', fileID = ' . $fileID;
return false;
}
if ($ownerTypeID !== CCrmOwnerType::Activity) {
$errors[] = "The owner type '{$ownerTypeName}' is not supported in current context";
return false;
}
$authToken = isset($options['oauth_token']) ? $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 (!CCrmActivity::CheckStorageElementExists($ownerID, CCrmActivityStorageType::Disk, $fileID)) {
$errors[] = 'File not found';
return false;
}
$isPermitted = false;
if (CCrmPerms::IsAdmin()) {
$isPermitted = true;
} else {
$userPermissions = CCrmPerms::GetCurrentUserPermissions();
$bindings = CCrmActivity::GetBindings($ownerID);
foreach ($bindings as $binding) {
if (CCrmAuthorizationHelper::CheckReadPermission($binding['OWNER_TYPE_ID'], $binding['OWNER_ID'], $userPermissions)) {
$isPermitted = true;
break;
}
}
}
if (!$isPermitted) {
$errors[] = 'Access denied.';
return false;
}
Bitrix\Crm\Integration\DiskManager::writeFileToResponse($fileID);
return true;
}
示例14: elseif
if ($itemID > 0) {
$arResult['OPEN_VIEW_ITEM_ID'] = $itemID;
}
} elseif (isset($_GET['open_edit'])) {
$itemID = intval($_GET['open_edit']);
if ($itemID > 0) {
$arResult['OPEN_EDIT_ITEM_ID'] = $itemID;
}
$disableStorageEdit = isset($_GET['disable_storage_edit']) && strtoupper($_GET['disable_storage_edit']) === 'Y';
if ($disableStorageEdit) {
$arResult['DISABLE_STORAGE_EDIT'] = true;
}
}
}
$arResult['NEED_FOR_CONVERTING_OF_CALENDAR_EVENTS'] = $arResult['NEED_FOR_CONVERTING_OF_TASKS'] = false;
if ($arResult['TAB_ID'] === '' && CCrmPerms::IsAdmin()) {
$curPage = $APPLICATION->GetCurPage();
//Converting existing calendar events
if (COption::GetOptionString('crm', '~CRM_ACTIVITY_LIST_CONVERTING_CALENDAR_EVENTS', 'N') !== 'Y') {
if (CCrmActivityConverter::IsCalEventConvertigRequired()) {
$arResult['NEED_FOR_CONVERTING_OF_CALENDAR_EVENTS'] = true;
$arResult['CAL_EVENT_CONV_EXEC_URL'] = CHTTP::urlAddParams($curPage, array('conv' => 'exec_cal'));
$arResult['CAL_EVENT_CONV_SKIP_URL'] = CHTTP::urlAddParams($curPage, array('conv' => 'skip_cal'));
} else {
COption::SetOptionString('crm', '~CRM_ACTIVITY_LIST_CONVERTING_CALENDAR_EVENTS', 'Y');
}
}
//Converting existing tasks
if (COption::GetOptionString('crm', '~CRM_ACTIVITY_LIST_CONVERTING_OF_TASKS', 'N') !== 'Y') {
if (CCrmActivityConverter::IsTaskConvertigRequired()) {
$arResult['NEED_FOR_CONVERTING_OF_TASKS'] = true;
示例15: foreach
$arResult['ACTIVE_TAB'] = $_POST['ACTIVE_TAB'];
}
$ar = CCrmStatus::GetEntityTypes();
foreach ($ar as $entityId => $arEntityType) {
$arResult['HEADERS'][$entityId] = $arEntityType['NAME'];
$arResult['ROWS'][$entityId] = array();
}
$res = CCrmStatus::GetList(array('SORT' => 'ASC'));
while ($ar = $res->Fetch()) {
$arResult['ROWS'][$ar['ENTITY_ID']][$ar['ID']] = $ar;
}
/*
* We can add here some elements to status list of own type(s)
* TODO: transfer to GetList
*/
$events = GetModuleEvents("crm", "OnCrmStatusGetList");
while ($arEvent = $events->Fetch()) {
$arStatuses = ExecuteModuleEventEx($arEvent);
foreach ($arStatuses as $key => $arStatus) {
$arResult['ROWS'][$arStatus['ENTITY_ID']][$arStatus['ID']] = $arStatus;
}
}
/**/
$arResult['NEED_FOR_FIX_STATUSES'] = false;
if (CCrmPerms::IsAdmin() && COption::GetOptionString('crm', '~CRM_FIX_STATUSES', 'N') === 'Y') {
$arResult['NEED_FOR_FIX_STATUSES'] = true;
}
CUtil::InitJSCore();
$arResult['ENABLE_CONTROL_PANEL'] = isset($arParams['ENABLE_CONTROL_PANEL']) ? $arParams['ENABLE_CONTROL_PANEL'] : true;
$this->IncludeComponentTemplate();
$APPLICATION->AddChainItem(GetMessage('CRM_FIELDS_ENTITY_LIST'), $arResult['~ENTITY_LIST_URL']);