Example #1
0
 protected function processActionShowBp()
 {
     $this->getApplication()->setTitle($this->storage->getProxyType()->getTitleForCurrentUser());
     $viewFile = CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_FILE_VIEW'], array('FILE_ID' => $this->file->getId(), 'FILE_PATH' => $this->arParams['RELATIVE_PATH']));
     $urlStartBizproc = \CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_DISK_START_BIZPROC'], array("ELEMENT_ID" => $this->file->getId()));
     $urlStartBizproc .= "?back_url=" . urlencode($this->getApplication()->getCurPage());
     $urlStartBizproc .= (strpos($urlStartBizproc, "?") === false ? "?" : "&") . 'workflow_template_id=0&' . bitrix_sessid_get();
     $this->arResult = array('STORAGE' => $this->storage, 'FILE' => array('ID' => $this->file->getId()), 'PATH_TO_FILE_VIEW' => $viewFile, 'PATH_TO_START_BIZPROC' => $urlStartBizproc, 'STORAGE_ID' => 'STORAGE_' . $this->storage->getId());
     $this->arParams['STATUS_BIZPROC'] = $this->storage->isEnabledBizProc() && Loader::includeModule("bizproc");
     if ($this->arParams['STATUS_BIZPROC']) {
         $documentData = array('DISK' => array('DOCUMENT_TYPE' => \Bitrix\Disk\BizProcDocument::generateDocumentComplexType($this->storage->getId()), 'DOCUMENT_ID' => \Bitrix\Disk\BizProcDocument::getDocumentComplexId($this->file->getId())), 'WEBDAV' => array('DOCUMENT_TYPE' => \Bitrix\Disk\BizProcDocumentCompatible::generateDocumentComplexType($this->storage->getId()), 'DOCUMENT_ID' => \Bitrix\Disk\BizProcDocumentCompatible::getDocumentComplexId($this->file->getId())));
         $webdavFileId = $this->file->getXmlId();
         if (!empty($webdavFileId)) {
             if (Loader::includeModule("iblock")) {
                 if ($this->storage->getProxyType() instanceof ProxyType\Group) {
                     $iblock = CIBlockElement::getList(array(), array("ID" => $webdavFileId, 'SHOW_NEW' => 'Y'), false, false, array('ID', 'IBLOCK_ID'))->fetch();
                     $entity = 'CIBlockDocumentWebdavSocnet';
                 } else {
                     $iblock = CIBlockElement::getList(array(), array("ID" => $webdavFileId, 'SHOW_NEW' => 'Y'), false, false, array('ID', 'IBLOCK_ID'))->fetch();
                     $entity = 'CIBlockDocumentWebdav';
                 }
                 if (!empty($iblock)) {
                     $documentData['OLD_FILE'] = array('DOCUMENT_TYPE' => array('webdav', $entity, "iblock_" . $iblock['IBLOCK_ID']), 'DOCUMENT_ID' => array('webdav', $entity, $iblock['ID']));
                 }
             }
         }
         $this->showBizProc($documentData);
     }
     $this->includeComponentTemplate('bp');
     $this->end();
 }