Example #1
0
 public function executeComponent()
 {
     $id = $this->getWorkflowId();
     $this->arResult = array('NeedAuth' => $this->isAuthorizationNeeded() ? 'Y' : 'N', 'FatalErrorMessage' => '', 'ErrorMessage' => '');
     if ($id) {
         $workflowState = \CBPStateService::getWorkflowState($id);
         if (!$workflowState) {
             $this->arResult['FatalErrorMessage'] = Loc::getMessage('BPWFI_WORKFLOW_NOT_FOUND');
         } else {
             $this->arResult['WorkflowState'] = $workflowState;
             $this->arResult['WorkflowTrack'] = \CBPTrackingService::DumpWorkflow($id);
             if ($workflowState['STARTED_BY'] && ($photo = $this->getStartedByPhoto($workflowState['STARTED_BY']))) {
                 $this->arResult['startedByPhotoSrc'] = $photo['src'];
             }
             $runtime = CBPRuntime::GetRuntime();
             $runtime->StartRuntime();
             /**
              * @var CBPDocumentService $documentService
              */
             $documentService = $runtime->GetService('DocumentService');
             try {
                 $this->arResult['DOCUMENT_NAME'] = $documentService->getDocumentName($workflowState['DOCUMENT_ID']);
                 $this->arResult['DOCUMENT_ICON'] = $documentService->getDocumentIcon($workflowState['DOCUMENT_ID']);
             } catch (Main\ArgumentException $e) {
                 $this->arResult['FatalErrorMessage'] = $e->getMessage();
             }
         }
     }
     $this->includeComponentTemplate();
     if ($this->arParams['SET_TITLE']) {
         $this->setPageTitle(Loc::getMessage('BPWFI_PAGE_TITLE'));
     }
 }