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/ui/lib/Integration/Rest/ |
Upload File : |
<?php namespace Bitrix\UI\Integration\Rest; use Bitrix\Main\Error; use Bitrix\UI\Avatar; class MaskImportPersonal extends ImportStep { protected int $ownerId; protected Avatar\Mask\Owner\DefaultOwner $owner; public function init($event): void { $this->ownerId = (int) $event->getParameter('USER_ID'); if ($this->ownerId <= 0) { $this->errorCollection->setError(new Error('User owner is not set')); return; } $this->owner = new Avatar\Mask\Owner\User($this->ownerId); } public function makeAStep(): void { foreach ($this->data as $res) { $fileInfo = $this->structure->getUnpackFile((int)$res['FILE_ID']); $file = !empty($fileInfo['PATH']) ? \CFile::makeFileArray($fileInfo['PATH']) : null; $file['name'] = $fileInfo['NAME']; if ($file) { $result = Avatar\Mask\Item::create( $this->owner, $file, [ 'TITLE' => $res['TITLE'], 'DESCRIPTION' => $res['DESCRIPTION'], 'ACCESS_CODE' => $this->owner->getDefaultAccess() ] ); if (!$result->isSuccess()) { $this->errorCollection->add($result->getErrors()); } } } } }