1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
TaskUploaderController.php
См. документацию.
1<?php
2
3namespace Bitrix\Bizproc\FileUploader;
4
5use Bitrix\Main\Engine\CurrentUser;
6use Bitrix\UI\FileUploader\FileOwnershipCollection;
7use Bitrix\UI\FileUploader\Configuration;
8use Bitrix\UI\FileUploader\UploaderController;
9
11{
12 public function __construct(array $options)
13 {
14 $options['taskId'] = (int)($options['taskId'] ?? 0);
15 $options['fieldId'] = (string)($options['fieldName'] ?? 0);
16
17 parent::__construct($options);
18 }
19
20 public function isAvailable(): bool
21 {
22 return true;
23 }
24
26 {
27 return new Configuration();
28 }
29
30 public function canUpload(): bool
31 {
32 [
33 'taskId' => $taskId,
34 'fieldId' => $fieldId,
35 ] = $this->getOptions();
36
37 if (!$taskId)
38 {
39 return false;
40 }
41
42 $userId = (int)(CurrentUser::get()?->getId() ?? 0);
43 $taskUserIds = \CBPTaskService::getTaskUserIds($taskId);
44
45 if (!in_array($userId, $taskUserIds, true))
46 {
47 return false;
48 }
49
51 arFilter: ['ID' => $taskId],
52 arSelectFields: ['ACTIVITY', 'PARAMETERS', 'STATUS']
53 )->fetch();
54
55 if ($task && (int)$task['STATUS'] === \CBPTaskStatus::Running)
56 {
57 $taskFields = \CBPDocument::getTaskControls($task)['FIELDS'] ?? [];
58
59 $editableFields = array_filter(
60 $taskFields,
61 static fn($field) => $field['Id'] === $fieldId && in_array($field['Type'], ['file', 'S:DiskFile']),
62 );
63
64 return count($editableFields) > 0;
65 }
66
67 return false;
68 }
69
71 {
72 $stop = true;
73
74 // $entityFiles = $this->fetchToDoActivityFiles();
75 // foreach ($files as $file)
76 // {
77 // if (in_array($file->getId(), $entityFiles, true))
78 // {
79 // $file->markAsOwn();
80 // }
81 // }
82 }
83
84 public function canView(): bool
85 {
86 return true;// todo: check?
87 }
88
89 public function canRemove(): bool
90 {
91 return false;
92 }
93}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
verifyFileOwner(FileOwnershipCollection $files)
Определения TaskUploaderController.php:70
static getTaskUserIds(int $taskId)
Определения taskservice.php:154
static getList($arOrder=array("ID"=> "DESC"), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
Определения taskservice.php:831
const Running
Определения constants.php:258
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$files
Определения mysql_to_pgsql.php:30
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936