29 if (!$timeline || !
$response->isSuccess())
36 $workflowState = $timeline->getWorkflowState();
38 $userIds = [$workflowState->getStartedBy()];
39 foreach ($timeline->getTasks() as $task)
41 $userIds = array_merge($userIds, $task->getTaskUserIds());
56 $data = $timeline->jsonSerialize();
58 $duration = $workflowStateService->getAverageWorkflowDuration(
60 )->getRoundedAverageDuration();
61 $executionTime = $workflowStateService->getExecutionTime(
63 workflowId: $workflowState->getId(),
64 workflowStarted: $workflowState->getStarted(),
65 workflowModified: $workflowState->getModified()
67 )->getRoundedExecutionTime();
68 $efficiencyData = $workflowStateService->getEfficiencyData(
70 executionTime: $executionTime ?? 0,
71 averageDuration: $duration
76 'averageDuration' => $efficiencyData->getAverageDuration(),
77 'efficiency' => $efficiencyData->getEfficiency(),
80 $data[
'biMenu'] = $this->getBiMenu($workflowState->getWorkflowTemplateId());
133 $currentUserId = $this->getCurrentUser()?->getId();
135 $workflowService = new \Bitrix\Bizproc\Api\Service\WorkflowService(
139 [$documentType, $documentCategoryId, $documentId] = \CBPDocument::unSignParameters($signedDocument);
140 $complexDocumentId = [$documentType[0], $documentType[1], $documentId];
161 $template = Bizproc\Workflow\Template\Entity\WorkflowTemplateTable::getById(
$templateId)->fetchObject();
162 $hasPermission =
false;
166 $hasPermission = \CBPDocument::canUserOperateDocumentType(
168 $this->getCurrentUser()->getId(),
175 $this->
addError(
new Error(Loc::getMessage(
'BIZPROC_CONTROLLER_WORKFLOW_TEMPLATE_NO_PRERMISSIONS')));
183 ->setOrder([
'STARTED' =>
'ASC'])
184 ->setLimit(self::PAGE_SIZE + 1)
188 $ids = array_column(
$result->fetchAll(),
'ID');
192 $this->
addError(
new Error(Loc::getMessage(
'BIZPROC_CONTROLLER_WORKFLOW_TEMPLATE_NO_LIST')));
197 $hasNextPage =
count($ids) > self::PAGE_SIZE;
201 $ids = array_slice($ids, 0, self::PAGE_SIZE);
206 static fn($id) =>
new Bizproc\
UI\WorkflowFacesView($id),
209 'hasNextPage' => $hasNextPage,