Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
task.php
1<?php
2
4
5use Bitrix\Bizproc\Workflow\Task\EO_Task;
6
7class Task extends EO_Task
8{
9 public function getValues(): array
10 {
11 $values = $this->collectValues();
12
13 if (isset($values['TASK_USERS']))
14 {
15 $values['TASK_USERS'] = [];
16
17 foreach ($this->getTaskUsers() as $taskUser)
18 {
19 $values['TASK_USERS'][] = $taskUser->collectValues();
20 }
21 }
22
23 return $values;
24 }
25
26 public function isCompleted(): bool
27 {
28 return $this->getStatus() !== \CBPTaskStatus::Running;
29 }
30
31 public function isCompletedByUser(int $userId): bool
32 {
33 foreach ($this->getTaskUsers() as $taskUser)
34 {
35 if ($taskUser->getUserId() === $userId && $taskUser->getStatus() !== \CBPTaskUserStatus::Waiting)
36 {
37 return true;
38 }
39 }
40
41 return false;
42 }
43
44 public function hasRights(int $userId): bool
45 {
46 if (!$this->isRightsRestricted())
47 {
48 return true;
49 }
50
51 return $this->isResponsibleForTask($userId);
52 }
53
54 public function hasViewRights(int $userId): bool
55 {
56 if (!$this->isRightsRestricted())
57 {
58 return true;
59 }
60
61 return $this->isResponsibleForTask($userId);
62 }
63
64 public function isResponsibleForTask(int $userId): bool
65 {
66 foreach ($this->getTaskUsers() as $taskUser)
67 {
68 if ($taskUser->getUserId() === $userId)
69 {
70 return true;
71 }
72 }
73
74 return false;
75 }
76
77 public function isInline(): bool
78 {
79 return $this->getIsInline() === 'Y';
80 }
81
82 public function isRightsRestricted(): bool
83 {
84 $accessControl = $this->getParameters()['AccessControl'] ?? 'N';
85
86 return $accessControl === 'Y';
87 }
88}
isResponsibleForTask(int $userId)
Definition task.php:64
hasRights(int $userId)
Definition task.php:44
isCompletedByUser(int $userId)
Definition task.php:31
hasViewRights(int $userId)
Definition task.php:54