1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
TasksToBeDelegated.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Bizproc\Api\Data\TaskService
;
4
5
use
Bitrix\Bizproc\Api\Request\TaskService\DelegateTasksRequest
;
6
use
Bitrix\Main\ArgumentException
;
7
use
Bitrix\Main\ArgumentOutOfRangeException
;
8
9
final
class
TasksToBeDelegated
10
{
11
private
array
$taskIds;
12
private
int
$fromUserId;
13
private
int
$toUserId;
14
private
int
$currentUserId;
15
16
private
function
__construct(
17
array
$taskIds,
18
int
$fromUserId,
19
int
$toUserId,
20
int
$currentUserId
21
)
22
{
23
$this->taskIds = $taskIds;
24
$this->fromUserId = $fromUserId;
25
$this->toUserId = $toUserId;
26
$this->currentUserId = $currentUserId;
27
}
28
33
public
static
function
createFromRequest
(
DelegateTasksRequest
$request
): self
34
{
35
$taskIds = self::validateTaskIds(
$request
->taskIds);
36
if
(!$taskIds)
37
{
38
throw
new
ArgumentException
(
'taskIds'
);
39
}
40
41
$fromUserId = self::validateUserId(
$request
->fromUserId);
42
if
(!$fromUserId)
43
{
44
throw
new
ArgumentOutOfRangeException
(
'fromUserId'
, 1,
null
);
45
}
46
47
$toUserId = self::validateUserId(
$request
->toUserId);
48
if
(!$toUserId)
49
{
50
throw
new
ArgumentOutOfRangeException
(
'toUserId'
, 1,
null
);
51
}
52
53
$currentUserId = self::validateUserId(
$request
->currentUserId);
54
55
return
new
self
($taskIds, $fromUserId, $toUserId, $currentUserId);
56
}
57
62
private
static
function
validateTaskIds(
array
$taskIds):
array
63
{
64
$ids = [];
65
foreach
($taskIds as $taskId)
66
{
67
if
(is_numeric($taskId))
68
{
69
$taskId = (int)$taskId;
70
$ids[$taskId] = $taskId;
71
}
72
}
73
74
return
$ids ? array_keys($ids) : [];
75
}
76
81
private
static
function
validateUserId(
int
$userId
): int
82
{
83
return
max(
$userId
, 0);
84
}
85
89
public
function
getTaskIds
():
array
90
{
91
return
$this->taskIds;
92
}
93
97
public
function
getFromUserId
(): int
98
{
99
return
$this->fromUserId;
100
}
101
105
public
function
getToUserId
(): int
106
{
107
return
$this->toUserId;
108
}
109
113
public
function
getCurrentUserId
(): int
114
{
115
return
$this->currentUserId;
116
}
117
}
$request
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения
catalog_reindex.php:36
$userId
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения
check_mail.php:18
Bitrix\Bizproc\Api\Data\TaskService\TasksToBeDelegated
Определения
TasksToBeDelegated.php:10
Bitrix\Bizproc\Api\Data\TaskService\TasksToBeDelegated\getFromUserId
getFromUserId()
Определения
TasksToBeDelegated.php:97
Bitrix\Bizproc\Api\Data\TaskService\TasksToBeDelegated\getToUserId
getToUserId()
Определения
TasksToBeDelegated.php:105
Bitrix\Bizproc\Api\Data\TaskService\TasksToBeDelegated\getTaskIds
getTaskIds()
Определения
TasksToBeDelegated.php:89
Bitrix\Bizproc\Api\Data\TaskService\TasksToBeDelegated\createFromRequest
static createFromRequest(DelegateTasksRequest $request)
Определения
TasksToBeDelegated.php:33
Bitrix\Bizproc\Api\Data\TaskService\TasksToBeDelegated\getCurrentUserId
getCurrentUserId()
Определения
TasksToBeDelegated.php:113
Bitrix\Bizproc\Api\Request\TaskService\DelegateTasksRequest
Определения
DelegateTasksRequest.php:6
Bitrix\Main\ArgumentException
Определения
ArgumentException.php:9
Bitrix\Main\ArgumentOutOfRangeException
Определения
ArgumentOutOfRangeException.php:9
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Bizproc\Api\Data\TaskService
Определения
TasksToBeDelegated.php:3
bitrix
modules
bizproc
lib
Api
Data
TaskService
TasksToBeDelegated.php
Создано системой
1.14.0