1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
task.php
См. документацию.
1<?php
2
3namespace Bitrix\Bizproc\Workflow;
4
5use Bitrix\Bizproc\Workflow\Task\EO_Task;
6use Bitrix\Bizproc\Workflow\Task\EO_TaskUser;
7
8class Task extends EO_Task
9{
10 public function getValues(): array
11 {
12 $values = $this->collectValues();
13
14 if (isset($values['TASK_USERS']))
15 {
16 $values['TASK_USERS'] = [];
17
18 foreach ($this->getTaskUsers() as $taskUser)
19 {
20 $values['TASK_USERS'][] = $taskUser->collectValues();
21 }
22 }
23
24 return $values;
25 }
26
27 public function isCompleted(): bool
28 {
29 return $this->getStatus() !== \CBPTaskStatus::Running;
30 }
31
32 public function isCompletedByUser(int $userId): bool
33 {
34 foreach ($this->getTaskUsers() as $taskUser)
35 {
36 if ($taskUser->getUserId() === $userId && $taskUser->getStatus() !== \CBPTaskUserStatus::Waiting)
37 {
38 return true;
39 }
40 }
41
42 return false;
43 }
44
45 public function hasRights(int $userId): bool
46 {
47 if (!$this->isRightsRestricted())
48 {
49 return true;
50 }
51
52 return $this->isResponsibleForTask($userId);
53 }
54
55 public function hasViewRights(int $userId): bool
56 {
57 if (!$this->isRightsRestricted())
58 {
59 return true;
60 }
61
62 if ($this->isResponsibleForTask($userId))
63 {
64 return true;
65 }
66
67 return (new \CBPWorkflowTemplateUser($userId))->isAdmin();
68 }
69
70 public function getTaskUserById(int $userId): ?EO_TaskUser
71 {
72 foreach ($this->getTaskUsers() as $taskUser)
73 {
74 if ($taskUser->getUserId() === $userId)
75 {
76 return $taskUser;
77 }
78 }
79
80 return null;
81 }
82
83 public function isResponsibleForTask(int $userId): bool
84 {
85 return $this->getTaskUserById($userId) !== null;
86 }
87
88 public function isInline(): bool
89 {
90 return $this->getIsInline() === 'Y';
91 }
92
93 public function isRightsRestricted(): bool
94 {
95 $accessControl = $this->getParameters()['AccessControl'] ?? 'N';
96
97 return $accessControl === 'Y';
98 }
99}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
isResponsibleForTask(int $userId)
Определения task.php:83
isCompleted()
Определения task.php:27
hasRights(int $userId)
Определения task.php:45
isRightsRestricted()
Определения task.php:93
getValues()
Определения task.php:10
isCompletedByUser(int $userId)
Определения task.php:32
isInline()
Определения task.php:88
getTaskUserById(int $userId)
Определения task.php:70
hasViewRights(int $userId)
Определения task.php:55
Определения orm.php:8846
const Running
Определения constants.php:258
const Waiting
Определения constants.php:273
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804