3namespace Bitrix\Bizproc\UI;
5use Bitrix\Bizproc\Api\Data\UserService\UsersToGet;
6use Bitrix\Bizproc\Api\Request\WorkflowFacesService\GetDataRequest;
7use Bitrix\Bizproc\Api\Response\WorkflowFacesService\GetDataByStepsResponse;
8use Bitrix\Bizproc\Api\Service\UserService;
9use Bitrix\Bizproc\Api\Service\WorkflowAccessService;
10use Bitrix\Bizproc\Api\Service\WorkflowFacesService;
14 private string $workflowId;
15 private int $runningTaskId;
16 private array $usersView = [];
19 public function __construct(
string $workflowId, ?
int $runningTaskId =
null)
21 $this->workflowId = $workflowId;
22 $this->runningTaskId = max($runningTaskId ?? 0, 0);
27 $data = $this->loadData();
28 if (!$data->isSuccess())
36 'workflowId' => $this->workflowId,
42 $progressBox = $data->getProgressBox();
43 if ($progressBox && $progressBox->getProgressTasksCount() > 0)
45 $result[
'progressBox'] = $progressBox->getData();
53 $data = $this->loadData();
54 if ($data->isSuccess())
56 return $data->getUniqueUserIds();
64 $data = $this->loadData();
65 if (!$data->isSuccess())
71 foreach ($data->getSteps() as $step)
75 $stepData = $step->getData();
76 $stepData[
'avatarsData'] = $this->getStepAvatars($step->getAvatars());
78 if ($step->getDuration() <= 0)
80 $stepData[
'duration'] = $step::getEmptyDurationText();
92 $data = $this->loadData();
93 if ($data->isSuccess())
95 return $data->getTimeStep()?->getData();
103 if ($this->data ===
null)
110 workflowId: $this->workflowId,
111 runningTaskId: $this->runningTaskId,
112 skipAccessCheck:
true,
115 $this->data = $workflowFacesService->getDataBySteps(
$request);
121 private function loadUsersView(
array $userIds): void
123 $userService =
new UserService();
124 $response = $userService->getUsersView(
new UsersToGet($userIds));
127 foreach (
$response->getUserViews() as $userView)
129 $userId = $userView->getUserId();
133 'avatarUrl' => $userView->getUserAvatar(),
139 private function getStepAvatars(
array $userIds):
array
154 return [
'id' => 0,
'avatarUrl' =>
null];
157 if (array_key_exists(
$userId, $this->usersView))
159 return $this->usersView[
$userId];
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
__construct(string $workflowId, ?int $runningTaskId=null)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)