Exemple #1
0
 private function GetConstantTypes()
 {
     $rootActivity = $this->GetRootActivity();
     if (method_exists($rootActivity, 'GetWorkflowTemplateId')) {
         $templateId = $rootActivity->GetWorkflowTemplateId();
         if ($templateId > 0) {
             return CBPWorkflowTemplateLoader::getTemplateConstants($templateId);
         }
     }
     return null;
 }
Exemple #2
0
    if (!$arResult["ELEMENT_FIELDS"] || $arResult["ELEMENT_FIELDS"]["CREATED_BY"] == $GLOBALS["USER"]->GetID()) {
        $arCurrentUserGroups[] = "author";
    }
    $DOCUMENT_TYPE = "iblock_" . $arResult["IBLOCK_ID"];
    CBPDocument::AddShowParameterInit("iblock", "only_users", $DOCUMENT_TYPE);
    $arTab2Fields = array();
    $arTab2Fields[] = array("id" => "BIZPROC_WF_STATUS", "name" => GetMessage("CT_BLEE_BIZPROC_PUBLISHED"), "type" => "label", "value" => $arResult["ELEMENT_FIELDS"]["BP_PUBLISHED"] == "Y" ? GetMessage("MAIN_YES") : GetMessage("MAIN_NO"));
    $bizProcIndex = 0;
    $arDocumentStates = CBPDocument::GetDocumentStates(BizProcDocument::generateDocumentComplexType($arParams["IBLOCK_TYPE_ID"], $arResult["IBLOCK_ID"]), $arResult["ELEMENT_ID"] > 0 ? BizProcDocument::getDocumentComplexId($arParams["IBLOCK_TYPE_ID"], $arResult["ELEMENT_ID"]) : null, "Y");
    $custom_html .= '<input type="hidden" name="stop_bizproc" id="stop_bizproc" value="">';
    $runtime = CBPRuntime::GetRuntime();
    $runtime->StartRuntime();
    $documentService = $runtime->GetService("DocumentService");
    foreach ($arDocumentStates as $arDocumentState) {
        $templateId = intval($arDocumentState["TEMPLATE_ID"]);
        $templateConstants = CBPWorkflowTemplateLoader::getTemplateConstants($templateId);
        if (empty($arDocumentState["TEMPLATE_PARAMETERS"]) && empty($arDocumentState["ID"]) && empty($templateConstants) && !CIBlockRights::UserHasRightTo($arResult["IBLOCK_ID"], $arResult["IBLOCK_ID"], 'iblock_edit')) {
            continue;
        }
        $bizProcIndex++;
        if ($arResult["ELEMENT_ID"] > 0) {
            $canViewWorkflow = CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $GLOBALS["USER"]->GetID(), BizProcDocument::getDocumentComplexId($arParams["IBLOCK_TYPE_ID"], $arResult["ELEMENT_ID"]), array("AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates, "WorkflowId" => $arDocumentState["ID"]));
        } else {
            $canViewWorkflow = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::StartWorkflow, $GLOBALS["USER"]->GetID(), BizProcDocument::generateDocumentComplexType($arParams["IBLOCK_TYPE_ID"], $arResult["IBLOCK_ID"]), array("sectionId" => intval($arResult["SECTION_ID"]), "AllUserGroups" => $arCurrentUserGroups, "DocumentStates" => $arDocumentStates, "WorkflowId" => $arDocumentState["ID"]));
        }
        if ($canViewWorkflow) {
            $arTab2Fields[] = array("id" => "BIZPROC_TITLE" . $bizProcIndex, "name" => $arDocumentState["TEMPLATE_NAME"], "type" => "section");
            if (strlen($arDocumentState["ID"]) && CIBlockElementRights::UserHasRightTo($arResult["IBLOCK_ID"], $arResult["ELEMENT_ID"], "element_edit") && strlen($arDocumentState["WORKFLOW_STATUS"])) {
                $arTab2Fields[] = array("id" => "BIZPROC_STOP" . $bizProcIndex, "name" => GetMessage("CT_BLEE_BIZPROC_STOP_LABEL"), "type" => "label", "value" => '<a href="javascript:void(0)"
						onclick="BX.Lists[\'' . $jsClass . '\'].completeWorkflow(\'' . $arDocumentState["ID"] . '\',
						\'stop\')">' . GetMessage("CT_BLEE_BIZPROC_STOP") . '</a>');