当前位置: 首页>>代码示例>>PHP>>正文


PHP CBPDocument::getDocumentStates方法代码示例

本文整理汇总了PHP中CBPDocument::getDocumentStates方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPDocument::getDocumentStates方法的具体用法?PHP CBPDocument::getDocumentStates怎么用?PHP CBPDocument::getDocumentStates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBPDocument的用法示例。


在下文中一共展示了CBPDocument::getDocumentStates方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processActionPerformActionBp

 protected function processActionPerformActionBp()
 {
     if (!Loader::includeModule('bizproc')) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_LAC_MODULE_NOT_INSTALLED'))));
     }
     $this->checkRequiredPostParams(array('iblockTypeId', 'iblockId', 'sectionId', 'workflowId', 'elementId', 'action'));
     if ($this->request->getPost('iblockTypeId') == COption::getOptionString('lists', 'livefeed_iblock_type_id')) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_LAC_UNKNOWN_ERROR'))));
     }
     if ($this->errorCollection->hasErrors()) {
         $this->sendJsonErrorResponse();
     }
     $this->iblockTypeId = $this->request->getPost('iblockTypeId');
     $this->iblockId = $this->request->getPost('iblockId');
     $this->sectionId = $this->request->getPost('sectionId');
     $workflowId = $this->request->getPost('workflowId');
     $elementId = $this->request->getPost('elementId');
     $action = $this->request->getPost('action');
     $this->documentStates = CBPDocument::getDocumentStates(BizProcDocument::generateDocumentComplexType($this->iblockTypeId, $this->iblockId), BizProcDocument::getDocumentComplexId($this->iblockTypeId, $elementId));
     if (isset($this->documentStates[$workflowId]['WORKFLOW_STATUS']) && $this->documentStates[$workflowId]['WORKFLOW_STATUS'] !== null) {
         $this->terminateWorkflow($workflowId, $elementId);
     }
     if ($action == 'delete') {
         if (CBPDocument::canUserOperateDocument(CBPCanUserOperateOperation::CreateWorkflow, $this->getUser(), BizProcDocument::getDocumentComplexId($this->iblockTypeId, $elementId), array("DocumentStates" => $this->documentStates))) {
             CBPTaskService::DeleteByWorkflow($workflowId);
             CBPTrackingService::DeleteByWorkflow($workflowId);
             CBPStateService::DeleteWorkflow($workflowId);
         } else {
             $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_LAC_ACCESS_DENIED'))));
         }
         if ($this->errorCollection->hasErrors()) {
             $this->sendJsonErrorResponse();
         }
     }
     $this->sendJsonSuccessResponse(array('message' => Loc::getMessage('LISTS_LAC_MESSAGE_SUCCESS')));
 }
开发者ID:Satariall,项目名称:izurit,代码行数:36,代码来源:ajax.php

示例2: getBizprocData

 protected function getBizprocData()
 {
     $userId = $this->getUser()->getID();
     $currentUserGroups = $this->getUser()->getUserGroupArray();
     if (!$this->lists['ELEMENT_FIELDS'] || $this->lists['ELEMENT_FIELDS']['CREATED_BY'] == $userId) {
         $currentUserGroups[] = 'Author';
     }
     $documentType = 'iblock_' . $this->iblockId;
     CBPDocument::addShowParameterInit('lists', 'only_users', $documentType);
     $this->lists['BIZPROC_FIELDS'] = array();
     $bizprocIndex = 0;
     $documentStates = CBPDocument::getDocumentStates(array('lists', 'BizprocDocument', $documentType), null);
     $runtime = CBPRuntime::getRuntime();
     $runtime->startRuntime();
     $documentService = $runtime->getService('DocumentService');
     foreach ($documentStates as $documentState) {
         $bizprocIndex++;
         $viewWorkflow = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::StartWorkflow, $userId, array('lists', 'BizprocDocument', $documentType), array('sectionId' => 0, 'AllUserGroups' => $currentUserGroups, 'DocumentStates' => $documentStates, 'WorkflowId' => $documentState['ID'] > 0 ? $documentState['ID'] : $documentState['TEMPLATE_ID']));
         if ($viewWorkflow) {
             $templateId = intval($documentState['TEMPLATE_ID']);
             $workflowParameters = $documentState['TEMPLATE_PARAMETERS'];
             if (!is_array($workflowParameters)) {
                 $workflowParameters = array();
             }
             if (strlen($documentState["ID"]) <= 0 && $templateId > 0) {
                 $parametersValues = array();
                 $keys = array_keys($workflowParameters);
                 foreach ($keys as $key) {
                     $value = $workflowParameters[$key]["Default"];
                     if (!is_array($value)) {
                         $parametersValues[$key] = htmlspecialcharsbx($value);
                     } else {
                         $keys1 = array_keys($value);
                         foreach ($keys1 as $key1) {
                             $parametersValues[$key][$key1] = htmlspecialcharsbx($value[$key1]);
                         }
                     }
                 }
                 foreach ($workflowParameters as $parameterKey => $arParameter) {
                     $parameterKeyExt = "bizproc" . $templateId . "_" . $parameterKey;
                     $html = $documentService->GetFieldInputControl(array('lists', 'BizprocDocument', $documentType), $arParameter, array("Form" => "start_workflow_form1", "Field" => $parameterKeyExt), $parametersValues[$parameterKey], false, true);
                     $this->lists['BIZPROC_FIELDS'][$parameterKeyExt . $bizprocIndex] = array("id" => $parameterKeyExt . $bizprocIndex, "required" => $arParameter["Required"], "name" => $arParameter["Name"], "title" => $arParameter["Description"], "type" => "custom", "value" => $html, 'show' => 'Y');
                 }
             }
         }
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:47,代码来源:ajax.php

示例3: CanUserOperateDocumentType

 function CanUserOperateDocumentType($operation, $userId, $documentType, $parameters = array())
 {
     $documentType = trim($documentType);
     if (strlen($documentType) <= 0) {
         return false;
     }
     $parameters["IBlockId"] = intval(substr($documentType, strlen("iblock_")));
     $parameters['sectionId'] = !empty($parameters['sectionId']) ? (int) $parameters['sectionId'] : 0;
     if (!array_key_exists("IBlockRightsMode", $parameters)) {
         $parameters["IBlockRightsMode"] = CIBlock::getArrayByID($parameters["IBlockId"], "RIGHTS_MODE");
     }
     if ($parameters["IBlockRightsMode"] === "E") {
         if ($operation === CBPCanUserOperateOperation::CreateWorkflow) {
             return CIBlockRights::userHasRightTo($parameters["IBlockId"], $parameters["IBlockId"], "iblock_rights_edit");
         } elseif ($operation === CBPCanUserOperateOperation::WriteDocument) {
             return CIBlockSectionRights::userHasRightTo($parameters["IBlockId"], $parameters["sectionId"], "section_element_bind");
         } elseif ($operation === CBPCanUserOperateOperation::ViewWorkflow || $operation === CBPCanUserOperateOperation::StartWorkflow) {
             if (!array_key_exists("WorkflowId", $parameters)) {
                 return false;
             }
             if ($operation === CBPCanUserOperateOperation::ViewWorkflow) {
                 return CIBlockRights::userHasRightTo($parameters["IBlockId"], 0, "element_read");
             }
             if ($operation === CBPCanUserOperateOperation::StartWorkflow) {
                 return CIBlockSectionRights::userHasRightTo($parameters["IBlockId"], $parameters['sectionId'], "section_element_bind");
             }
             $userId = intval($userId);
             if (!array_key_exists("AllUserGroups", $parameters)) {
                 if (!array_key_exists("UserGroups", $parameters)) {
                     $parameters["UserGroups"] = CUser::getUserGroup($userId);
                 }
                 $parameters["AllUserGroups"] = $parameters["UserGroups"];
                 $parameters["AllUserGroups"][] = "Author";
             }
             if (!array_key_exists("DocumentStates", $parameters)) {
                 if ($operation === CBPCanUserOperateOperation::StartWorkflow) {
                     $parameters["DocumentStates"] = CBPWorkflowTemplateLoader::getDocumentTypeStates(array("lists", get_called_class(), "iblock_" . $parameters["IBlockId"]));
                 } else {
                     $parameters["DocumentStates"] = CBPDocument::getDocumentStates(array("lists", get_called_class(), "iblock_" . $parameters["IBlockId"]), null);
                 }
             }
             if (array_key_exists($parameters["WorkflowId"], $parameters["DocumentStates"])) {
                 $parameters["DocumentStates"] = array($parameters["WorkflowId"] => $parameters["DocumentStates"][$parameters["WorkflowId"]]);
             } else {
                 return false;
             }
             $allowableOperations = CBPDocument::getAllowableOperations($userId, $parameters["AllUserGroups"], $parameters["DocumentStates"], true);
             if (!is_array($allowableOperations)) {
                 return false;
             }
             if ($operation === CBPCanUserOperateOperation::ViewWorkflow && in_array("read", $allowableOperations) || $operation === CBPCanUserOperateOperation::StartWorkflow && in_array("write", $allowableOperations)) {
                 return true;
             }
             $chop = $operation === CBPCanUserOperateOperation::ViewWorkflow ? "element_read" : "section_element_bind";
             $tasks = self::getRightsTasks();
             foreach ($allowableOperations as $op) {
                 if (isset($tasks[$op])) {
                     $op = $tasks[$op]['ID'];
                 }
                 $ar = CTask::getOperations($op, true);
                 if (in_array($chop, $ar)) {
                     return true;
                 }
             }
         }
         return false;
     }
     if (!array_key_exists("IBlockPermission", $parameters)) {
         if (CModule::includeModule('lists')) {
             $parameters["IBlockPermission"] = CLists::getIBlockPermission($parameters["IBlockId"], $userId);
         } else {
             $parameters["IBlockPermission"] = CIBlock::getPermission($parameters["IBlockId"], $userId);
         }
     }
     if ($parameters["IBlockPermission"] <= "R") {
         return false;
     } elseif ($parameters["IBlockPermission"] >= "W") {
         return true;
     }
     $userId = intval($userId);
     if (!array_key_exists("AllUserGroups", $parameters)) {
         if (!array_key_exists("UserGroups", $parameters)) {
             $parameters["UserGroups"] = CUser::getUserGroup($userId);
         }
         $parameters["AllUserGroups"] = $parameters["UserGroups"];
         $parameters["AllUserGroups"][] = "Author";
     }
     if (!array_key_exists("DocumentStates", $parameters)) {
         $parameters["DocumentStates"] = CBPDocument::getDocumentStates(array("lists", get_called_class(), "iblock_" . $parameters["IBlockId"]), null);
     }
     if (array_key_exists("WorkflowId", $parameters)) {
         if (array_key_exists($parameters["WorkflowId"], $parameters["DocumentStates"])) {
             $parameters["DocumentStates"] = array($parameters["WorkflowId"] => $parameters["DocumentStates"][$parameters["WorkflowId"]]);
         } else {
             return false;
         }
     }
     $allowableOperations = CBPDocument::getAllowableOperations($userId, $parameters["AllUserGroups"], $parameters["DocumentStates"]);
     if (!is_array($allowableOperations)) {
         return false;
//.........这里部分代码省略.........
开发者ID:Satariall,项目名称:izurit,代码行数:101,代码来源:bizprocdocument.php

示例4: getBizProcData

 protected function getBizProcData(BaseObject $object, SecurityContext $securityContext, array $actions, array $columnsBizProc, array $bizprocIcon, array $exportData)
 {
     $documentData = array('DISK' => array('DOCUMENT_TYPE' => \Bitrix\Disk\BizProcDocument::generateDocumentComplexType($this->storage->getId()), 'DOCUMENT_ID' => \Bitrix\Disk\BizProcDocument::getDocumentComplexId($object->getId())), 'WEBDAV' => array('DOCUMENT_TYPE' => \Bitrix\Disk\BizProcDocumentCompatible::generateDocumentComplexType($this->storage->getId()), 'DOCUMENT_ID' => \Bitrix\Disk\BizProcDocumentCompatible::getDocumentComplexId($object->getId())));
     $listBpTemplates = array();
     foreach ($this->arParams['TEMPLATE_BIZPROC'] as $idTemplate => $valueTemplate) {
         $url = CComponentEngine::MakePathFromTemplate($valueTemplate['URL'], array("ELEMENT_ID" => $object->getId()));
         $listBpTemplates[] = array("ICONCLASS" => "", "TEXT" => $valueTemplate['NAME'], "ONCLICK" => "jsUtils.Redirect([], '" . CUtil::JSEscape($url) . "');");
     }
     if ($object->canStartBizProc($securityContext) && !empty($listBpTemplates)) {
         $actions[] = array("ICONCLASS" => "bizproc_start", "TEXT" => Loc::getMessage("DISK_FOLDER_LIST_ACT_START_BIZPROC"), "MENU" => $listBpTemplates);
     }
     $webdavFileId = $object->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']));
             }
         }
     }
     foreach ($documentData as $nameModuleId => $data) {
         $temporary[$nameModuleId] = CBPDocument::getDocumentStates($data['DOCUMENT_TYPE'], $data['DOCUMENT_ID']);
     }
     if (isset($temporary['OLD_FILE'])) {
         $documentStates = array_merge($temporary['DISK'], $temporary['WEBDAV'], $temporary['OLD_FILE']);
     } else {
         $documentStates = array_merge($temporary['DISK'], $temporary['WEBDAV']);
     }
     foreach ($documentStates as $key => $documentState) {
         if (empty($documentState['ID'])) {
             unset($documentStates[$key]);
         }
     }
     $columnsBizProc['BIZPROC'] = "";
     $bizprocIcon['BIZPROC'] = "";
     if (!empty($documentStates)) {
         if (count($documentStates) == 1) {
             $documentState = reset($documentStates);
             if ($documentState['WORKFLOW_STATUS'] > 0 || empty($documentState['WORKFLOW_STATUS'])) {
                 $tasksWorkflow = CBPDocument::getUserTasksForWorkflow($this->getUser()->GetID(), $documentState["ID"]);
                 $columnsBizProc["BIZPROC"] = '<div class="bizproc-item-title">' . htmlspecialcharsbx($documentState["TEMPLATE_NAME"]) . ': ' . '<span class="bizproc-item-title bizproc-state-title" style="">' . '<a href="' . $exportData["OPEN_URL"] . '#tab-bp">' . (strlen($documentState["STATE_TITLE"]) > 0 ? htmlspecialcharsbx($documentState["STATE_TITLE"]) : htmlspecialcharsbx($documentState["STATE_NAME"])) . '</a>' . '</span>' . '</div>';
                 $columnsBizProc['BIZPROC'] = str_replace("'", "\"", $columnsBizProc['BIZPROC']);
                 $bizprocIcon["BIZPROC"] = "<div class=\"element-bizproc-status bizproc-statuses " . (!(strlen($documentState["ID"]) <= 0 || strlen($documentState["WORKFLOW_STATUS"]) <= 0) ? 'bizproc-status-' . (empty($tasksWorkflow) ? "inprogress" : "attention") : '') . "\" onmouseover='BX.hint(this, \"" . addslashes($columnsBizProc["BIZPROC"]) . "\")'></div>";
                 if (!empty($tasksWorkflow)) {
                     $tmp = array();
                     foreach ($tasksWorkflow as $val) {
                         $url = CComponentEngine::makePathFromTemplate($this->arParams["PATH_TO_DISK_TASK"], array("ID" => $val["ID"]));
                         $url .= "?back_url=" . urlencode($this->getApplication()->getCurPageParam());
                         $tmp[] = '<a href="' . $url . '">' . $val["NAME"] . '</a>';
                     }
                     $columnsBizProc["BIZPROC"] .= '<div class="bizproc-tasks">' . implode(", ", $tmp) . '</div>';
                     return array($actions, $columnsBizProc, $bizprocIcon);
                 }
                 return array($actions, $columnsBizProc, $bizprocIcon);
             }
             return array($actions, $columnsBizProc, $bizprocIcon);
         } else {
             $tasks = array();
             $inprogress = false;
             foreach ($documentStates as $key => $documentState) {
                 if ($documentState['WORKFLOW_STATUS'] > 0 || empty($documentState['WORKFLOW_STATUS'])) {
                     $tasksWorkflow = CBPDocument::getUserTasksForWorkflow($this->getUser()->GetID(), $documentState["ID"]);
                     if (!$inprogress) {
                         $inprogress = strlen($documentState['ID']) > 0 && strlen($documentState['WORKFLOW_STATUS']) > 0;
                     }
                     if (!empty($tasksWorkflow)) {
                         foreach ($tasksWorkflow as $val) {
                             $tasks[] = $val;
                         }
                     }
                 }
             }
             $columnsBizProc["BIZPROC"] = '<span class="bizproc-item-title">' . Loc::getMessage("DISK_FOLDER_LIST_GRID_BIZPROC") . ': <a href="' . $exportData["OPEN_URL"] . '#tab-bp" title="' . Loc::getMessage("DISK_FOLDER_LIST_GRID_BIZPROC_TITLE") . '">' . count($documentStates) . '</a></span>' . (!empty($tasks) ? '<br /><span class="bizproc-item-title">' . Loc::getMessage("DISK_FOLDER_LIST_GRID_BIZPROC_TASKS") . ': <a href="' . $this->arParams["PATH_TO_DISK_TASK_LIST"] . '" title="' . Loc::getMessage("DISK_FOLDER_LIST_GRID_BIZPROC_TASKS_TITLE") . '">' . count($tasks) . '</a></span>' : '');
             $bizprocIcon["BIZPROC"] = "<div class=\"element-bizproc-status bizproc-statuses " . ($inprogress ? ' bizproc-status-' . (empty($tasks) ? "inprogress" : "attention") : '') . "\" onmouseover='BX.hint(this, \"" . addslashes($columnsBizProc['BIZPROC']) . "\")'></div>";
             return array($actions, $columnsBizProc, $bizprocIcon);
         }
     }
     return array($actions, $columnsBizProc, $bizprocIcon);
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:85,代码来源:class.php

示例5: completeWorkflow

 /**
  * @param string $workflowId
  * @param string $iblockType
  * @param int $elementId
  * @param int $iblockId
  * @param string $action Action stop or delete
  * @return string error
  */
 public static function completeWorkflow($workflowId, $iblockType, $elementId, $iblockId, $action)
 {
     if (!Loader::includeModule('bizproc')) {
         return Loc::getMessage('LISTS_MODULE_BIZPROC_NOT_INSTALLED');
     }
     global $USER;
     $userId = $USER->getID();
     $documentType = BizprocDocument::generateDocumentComplexType($iblockType, $iblockId);
     $documentId = BizprocDocument::getDocumentComplexId($iblockType, $elementId);
     $documentStates = CBPDocument::getDocumentStates($documentType, $documentId);
     $permission = CBPDocument::canUserOperateDocument($action == 'stop' ? CBPCanUserOperateOperation::StartWorkflow : CBPCanUserOperateOperation::CreateWorkflow, $userId, $documentId, array("DocumentStates" => $documentStates));
     if (!$permission) {
         return Loc::getMessage('LISTS_ACCESS_DENIED');
     }
     $stringError = '';
     if ($action == 'stop') {
         $errors = array();
         CBPDocument::terminateWorkflow($workflowId, $documentId, $errors);
         if (!empty($errors)) {
             $stringError = '';
             foreach ($errors as $error) {
                 $stringError .= $error['message'];
             }
             $listError[] = array('id' => 'stopBizproc', 'text' => $stringError);
         }
     } else {
         $errors = array();
         if (isset($documentStates[$workflowId]['WORKFLOW_STATUS']) && $documentStates[$workflowId]['WORKFLOW_STATUS'] !== null) {
             CBPDocument::terminateWorkflow($workflowId, $documentId, $errors);
         }
         if (!empty($errors)) {
             $stringError = '';
             foreach ($errors as $error) {
                 $stringError .= $error['message'];
             }
             $listError[] = array('id' => 'stopBizproc', 'text' => $stringError);
         } else {
             CBPTaskService::deleteByWorkflow($workflowId);
             CBPTrackingService::deleteByWorkflow($workflowId);
             CBPStateService::deleteWorkflow($workflowId);
         }
     }
     if (empty($listError) && Loader::includeModule('socialnetwork') && $iblockType == COption::getOptionString("lists", "livefeed_iblock_type_id")) {
         $sourceId = CBPStateService::getWorkflowIntegerId($workflowId);
         $resultQuery = CSocNetLog::getList(array(), array('EVENT_ID' => 'lists_new_element', 'SOURCE_ID' => $sourceId), false, false, array('ID'));
         while ($log = $resultQuery->fetch()) {
             CSocNetLog::delete($log['ID']);
         }
     }
     if (!empty($listError)) {
         $errorObject = new CAdminException($listError);
         $stringError = $errorObject->getString();
     }
     return $stringError;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:63,代码来源:lists.php

示例6: showBizProc

 protected function showBizProc($documentData)
 {
     $this->arResult['BIZPROC_PERMISSION'] = array();
     $this->arResult['BIZPROC_PERMISSION']['START'] = CBPDocument::canUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $this->getUser()->getId(), $documentData['DISK']['DOCUMENT_ID']);
     $this->arResult['BIZPROC_PERMISSION']['VIEW'] = CBPDocument::canUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $this->getUser()->getId(), $documentData['DISK']['DOCUMENT_ID']);
     $this->arResult['BIZPROC_PERMISSION']['STOP'] = $this->arResult['BIZPROC_PERMISSION']['START'];
     $this->arResult['BIZPROC_PERMISSION']['DROP'] = CBPDocument::canUserOperateDocument(CBPCanUserOperateOperation::CreateWorkflow, $this->getUser()->getId(), $documentData['DISK']['DOCUMENT_ID']);
     foreach ($documentData as $nameModuleId => $data) {
         $temporary[$nameModuleId] = CBPDocument::getDocumentStates($data['DOCUMENT_TYPE'], $data['DOCUMENT_ID']);
     }
     if (isset($temporary['OLD_FILE'])) {
         $allBizProcArray = array_merge($temporary['DISK'], $temporary['WEBDAV'], $temporary['OLD_FILE']);
     } else {
         $allBizProcArray = array_merge($temporary['DISK'], $temporary['WEBDAV']);
     }
     if (!empty($allBizProcArray)) {
         $userGroup = $this->getUser()->getUserGroupArray();
         $userGroup[] = 'author';
         if ($this->request->isPost() && intval($this->request->getPost('bizproc_index')) > 0) {
             $bizProcWorkflowId = array();
             $bizprocIndex = intval($this->request->getPost('bizproc_index'));
             for ($i = 1; $i <= $bizprocIndex; $i++) {
                 $bpId = trim($this->request->getPost("bizproc_id_" . $i));
                 $bpTemplateId = intval($this->request->getPost("bizproc_template_id_" . $i));
                 $bpEvent = trim($this->request->getPost("bizproc_event_" . $i));
                 if (strlen($bpId) > 0) {
                     if (!array_key_exists($bpId, $allBizProcArray)) {
                         continue;
                     }
                 } else {
                     if (!array_key_exists($bpTemplateId, $allBizProcArray)) {
                         continue;
                     }
                     $bpId = $bizProcWorkflowId[$bpTemplateId];
                 }
                 if (strlen($bpEvent) > 0) {
                     $errors = array();
                     CBPDocument::sendExternalEvent($bpId, $bpEvent, array("Groups" => $userGroup, "User" => $this->getUser()->getId()), $errors);
                 } else {
                     $errors = array();
                     foreach ($allBizProcArray as $idBizProc => $bizProcArray) {
                         if ($idBizProc == $bpId) {
                             CBPDocument::TerminateWorkflow($bpId, $bizProcArray['DOCUMENT_ID'], $errors);
                         }
                     }
                 }
                 if (!empty($errors)) {
                     foreach ($errors as $error) {
                         $this->arResult['ERROR_MESSAGE'] = $error['message'];
                     }
                 } else {
                     LocalRedirect($this->arResult['PATH_TO_FILE_VIEW'] . "#tab-bp");
                 }
             }
         }
         $this->arResult['BIZPROC_LIST'] = array();
         $count = 1;
         foreach ($allBizProcArray as $idBizProc => $bizProcArray) {
             if (intVal($bizProcArray["WORKFLOW_STATUS"]) < 0 || $idBizProc <= 0) {
                 continue;
             } else {
                 if (!CBPDocument::canUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $this->getUser()->getId(), $documentData['DISK']['DOCUMENT_ID'], array("DocumentStates" => $bizProcArray, "WorkflowId" => $bizProcArray["ID"] > 0 ? $bizProcArray["ID"] : $bizProcArray["TEMPLATE_ID"]))) {
                     continue;
                 }
             }
             $groups = CBPDocument::getAllowableUserGroups($documentData['DISK']['DOCUMENT_TYPE']);
             foreach ($groups as $key => $val) {
                 $groups[strtolower($key)] = $val;
             }
             $users = array();
             $dmpWorkflow = CBPTrackingService::getList(array("ID" => "DESC"), array("WORKFLOW_ID" => $idBizProc, "TYPE" => array(CBPTrackingType::Report, CBPTrackingType::Custom, CBPTrackingType::FaultActivity)), false, array("nTopCount" => 5), array("ID", "TYPE", "MODIFIED", "ACTION_NOTE", "ACTION_TITLE", "ACTION_NAME", "EXECUTION_STATUS", "EXECUTION_RESULT"));
             while ($track = $dmpWorkflow->getNext()) {
                 $messageTemplate = "";
                 switch ($track["TYPE"]) {
                     case 1:
                         $messageTemplate = Loc::getMessage("DISK_FILE_VIEW_BPABL_TYPE_1");
                         break;
                     case 2:
                         $messageTemplate = Loc::getMessage("DISK_FILE_VIEW_BPABL_TYPE_2");
                         break;
                     case 3:
                         $messageTemplate = Loc::getMessage("DISK_FILE_VIEW_BPABL_TYPE_3");
                         break;
                     case 4:
                         $messageTemplate = Loc::getMessage("DISK_FILE_VIEW_BPABL_TYPE_4");
                         break;
                     case 5:
                         $messageTemplate = Loc::getMessage("DISK_FILE_VIEW_BPABL_TYPE_5");
                         break;
                     default:
                         $messageTemplate = Loc::getMessage("DISK_FILE_VIEW_BPABL_TYPE_6");
                 }
                 $name = strlen($track["ACTION_TITLE"]) > 0 ? $track["ACTION_TITLE"] : $track["ACTION_NAME"];
                 switch ($track["EXECUTION_STATUS"]) {
                     case CBPActivityExecutionStatus::Initialized:
                         $status = Loc::getMessage("DISK_FILE_VIEW_BPABL_STATUS_1");
                         break;
                     case CBPActivityExecutionStatus::Executing:
                         $status = Loc::getMessage("DISK_FILE_VIEW_BPABL_STATUS_2");
                         break;
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:class.php


注:本文中的CBPDocument::getDocumentStates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。