1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
configcomponent.php
См. документацию.
1<?php
2
3namespace Bitrix\Main\UserField;
4
5use Bitrix\Main\Application;
6use Bitrix\Main\Error;
7use Bitrix\Main\ErrorCollection;
8use Bitrix\Main\Localization\Loc;
9
10abstract class ConfigComponent extends \CBitrixComponent
11{
12 public const ERROR_CODE_NO_MODULE_ERROR = 'UF_CONFIG_NO_MODULE';
13
15 protected $access;
16 protected $entityId = '';
17 protected $moduleId;
20 protected $userTypes;
21
22 protected function init(): void
23 {
24 $this->errorCollection = new ErrorCollection();
25
26 $request = Application::getInstance()->getContext()->getRequest();
27 $this->entityId = !empty($this->arParams['entityId']) ? $this->arParams['entityId'] : $request->get('entityId');
28 $this->moduleId = !empty($this->arParams['moduleId']) ? $this->arParams['moduleId'] : $request->get('moduleId');
29
30 if(!$this->moduleId)
31 {
32 $this->errorCollection[] = $this->getNoModuleError();
33 return;
34 }
35 $this->access = UserFieldAccess::getInstance($this->moduleId);
36 }
37
38 protected function getNoModuleError(): Error
39 {
40 return new Error(Loc::getMessage('MAIN_USER_FIELD_CONFIG_COMPONENT_NO_MODULE_ERROR'), static::ERROR_CODE_NO_MODULE_ERROR);
41 }
42
43 protected function getAccessDeniedError(): Error
44 {
45 return new Error(Loc::getMessage('MAIN_USER_FIELD_CONFIG_COMPONENT_ACCESS_DENIED_ERROR'), static::ERROR_CODE_NO_MODULE_ERROR);
46 }
47
48 protected function getUserTypes(): array
49 {
50 if(!$this->userTypes)
51 {
53 $this->userTypes = $USER_FIELD_MANAGER->GetUserType();
54 $restrictedTypes = $this->access->getRestrictedTypes();
55 foreach($restrictedTypes as $typeId)
56 {
57 unset($this->userTypes[$typeId]);
58 }
59 }
60
61 return $this->userTypes;
62 }
63
64 protected function setTitle(string $title): void
65 {
66 global $APPLICATION;
67
68 $APPLICATION->SetTitle($title);
69 }
70}
global $APPLICATION
Определения include.php:80
static getInstance()
Определения application.php:98
Определения error.php:15
setTitle(string $title)
Определения configcomponent.php:64
static getInstance(string $moduleId, int $userId=null)
Определения userfieldaccess.php:28
$request
Определения component.php:65
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
global $USER_FIELD_MANAGER
Определения attempt.php:6
$title
Определения pdf.php:123