Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/userfield/ |
Upload File : |
<?php namespace Bitrix\Main\UserField; use Bitrix\Main\Application; use Bitrix\Main\Error; use Bitrix\Main\ErrorCollection; use Bitrix\Main\Localization\Loc; abstract class ConfigComponent extends \CBitrixComponent { public const ERROR_CODE_NO_MODULE_ERROR = 'UF_CONFIG_NO_MODULE'; /** @var \Bitrix\Main\UserField\UserFieldAccess */ protected $access; protected $entityId = ''; protected $moduleId; /** @var ErrorCollection */ protected $errorCollection; protected $userTypes; protected function init(): void { $this->errorCollection = new ErrorCollection(); $request = Application::getInstance()->getContext()->getRequest(); $this->entityId = !empty($this->arParams['entityId']) ? $this->arParams['entityId'] : $request->get('entityId'); $this->moduleId = !empty($this->arParams['moduleId']) ? $this->arParams['moduleId'] : $request->get('moduleId'); if(!$this->moduleId) { $this->errorCollection[] = $this->getNoModuleError(); return; } $this->access = UserFieldAccess::getInstance($this->moduleId); } protected function getNoModuleError(): Error { return new Error(Loc::getMessage('MAIN_USER_FIELD_CONFIG_COMPONENT_NO_MODULE_ERROR'), static::ERROR_CODE_NO_MODULE_ERROR); } protected function getAccessDeniedError(): Error { return new Error(Loc::getMessage('MAIN_USER_FIELD_CONFIG_COMPONENT_ACCESS_DENIED_ERROR'), static::ERROR_CODE_NO_MODULE_ERROR); } protected function getUserTypes(): array { if(!$this->userTypes) { global $USER_FIELD_MANAGER; $this->userTypes = $USER_FIELD_MANAGER->GetUserType(); $restrictedTypes = $this->access->getRestrictedTypes(); foreach($restrictedTypes as $typeId) { unset($this->userTypes[$typeId]); } } return $this->userTypes; } protected function setTitle(string $title): void { global $APPLICATION; $APPLICATION->SetTitle($title); } }