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


PHP CBPWorkflowTemplateLoader::GetTemplateState方法代码示例

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


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

示例1: array

 $arResult["Blocks"] = array();
 $dbBlockList = CIBlock::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("ACTIVE" => "Y", "SITE_ID" => SITE_ID, "TYPE" => $arParams["IBLOCK_TYPE"]));
 while ($arBlock = $dbBlockList->GetNext()) {
     $arBlock["LIST_URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_LIST"], array("block_id" => $arBlock["ID"]));
     if (intval($arBlock["PICTURE"]) <= 0) {
         $arBlock["PICTURE"] = "/bitrix/images/bizproc/vd_bp.jpg";
     }
     $arMessagesTmp = CIBlock::GetMessages($arBlock["ID"]);
     $arBlock["CreateTitle"] = htmlspecialcharsbx(is_array($arMessagesTmp) && array_key_exists("ELEMENT_ADD", $arMessagesTmp) ? $arMessagesTmp["ELEMENT_ADD"] : "");
     $workflowTemplateId = 0;
     $db = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => array("bizproc", "CBPVirtualDocument", "type_" . $arBlock["ID"])), false, false, array("ID"));
     if ($ar = $db->Fetch()) {
         $workflowTemplateId = intval($ar["ID"]);
     }
     if ($workflowTemplateId > 0) {
         $arWorkflowTemplate = CBPWorkflowTemplateLoader::GetTemplateState($workflowTemplateId);
         if (!is_array($arWorkflowTemplate["STATE_PERMISSIONS"]) || count($arWorkflowTemplate["STATE_PERMISSIONS"]) <= 0) {
             $arWorkflowTemplate["STATE_PERMISSIONS"]["create"] = array("author");
         }
         $arAllowableOperations = CBPDocument::GetAllowableOperations($GLOBALS["USER"]->GetID(), $GLOBALS["USER"]->GetUserGroupArray(), array($arWorkflowTemplate));
         $arBlock["START_URL"] = "";
         if ($arResult["AdminAccess"] || (is_array($arAllowableOperations) && in_array("create", $arAllowableOperations) || is_array($arWorkflowTemplate["STATE_PERMISSIONS"]["create"]) && in_array("author", $arWorkflowTemplate["STATE_PERMISSIONS"]["create"]))) {
             $arBlock["START_URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_START"], array("block_id" => $arBlock["ID"]));
         }
     }
     $arBlock["DELETE_URL"] = "";
     if ($arResult["AdminAccess"]) {
         $arBlock["EDIT_URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_EDIT"], array("block_id" => $arBlock["ID"]));
         $arBlock["DELETE_URL"] = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_INDEX"], array());
         $arBlock["DELETE_URL"] .= strpos($arBlock["DELETE_URL"], "?") === false ? "?" : "&";
         $arBlock["DELETE_URL"] .= "delete_block_id=" . $arBlock["ID"] . "&" . bitrix_sessid_get();
开发者ID:k-kalashnikov,项目名称:geekcon,代码行数:31,代码来源:component.php

示例2: CanUserOperateDocumentType


//.........这里部分代码省略.........
         } else {
             $arParameters["IBlockPermission"] = CIBlockDocumentWebdav::GetIBRights('IBLOCK', $arParameters["IBlockId"]);
         }
     }
     if (CWebDavIblock::CheckRight($arParameters["IBlockPermission"], "element_read") < "R") {
         return false;
     } elseif (CWebDavIblock::CheckRight($arParameters["IBlockPermission"], "element_edit") >= "W") {
         return true;
     }
     // Если мы тут, то инфоблочные права равны U
     // Если нам явно не сказали, то узнаем группы пользователя
     $userId = intval($userId);
     if (!array_key_exists("AllUserGroups", $arParameters)) {
         if (!array_key_exists("UserGroups", $arParameters)) {
             $arParameters["UserGroups"] = CUser::GetUserGroup($userId);
         }
         $arParameters["AllUserGroups"] = $arParameters["UserGroups"];
         $arParameters["AllUserGroups"][] = "Author";
     }
     // Если нам явно не сказали, то узнаем текущие статусы документа
     if (!array_key_exists("DocumentStates", $arParameters)) {
         $arParameters["DocumentStates"] = CBPDocument::GetDocumentStates(array("webdav", "CIBlockDocumentWebdav", "iblock_" . $arParameters["IBlockId"]), null);
     }
     // Если нужно проверить только для одного рабочего потока
     if (array_key_exists("WorkflowId", $arParameters) && !empty($arParameters["WorkflowId"])) {
         if (array_key_exists($arParameters["WorkflowId"], $arParameters["DocumentStates"])) {
             $arParameters["DocumentStates"] = array($arParameters["WorkflowId"] => $arParameters["DocumentStates"][$arParameters["WorkflowId"]]);
         } else {
             return false;
         }
     }
     $arAllowableOperations = CBPDocument::GetAllowableOperations($userId, $arParameters["AllUserGroups"], $arParameters["DocumentStates"]);
     // $arAllowableOperations == null - поток не является автоматом
     // $arAllowableOperations == array() - в автомате нет допустимых операций
     // $arAllowableOperations == array("read", ...) - допустимые операции
     if (!is_array($arAllowableOperations)) {
         return false;
     }
     $r = false;
     switch ($operation) {
         case CBPCanUserOperateOperation::ViewWorkflow:
             $r = CWebDavIblock::CheckRight($arParameters["IBlockPermission"], "element_read") > "U" || in_array("read", $arAllowableOperations);
             break;
         case CBPCanUserOperateOperation::StartWorkflow:
             // право на запуск бизнес-процесса есть у имеющих право "W",
             $r = CWebDavIblock::CheckRight($arParameters["IBlockPermission"], "element_bizproc_start") > "U" || in_array("write", $arAllowableOperations);
             // если задан конкретный шаблон потока, то проверяем его
             if ($r && CWebDavIblock::CheckRight($arParameters["IBlockPermission"], "element_bizproc_start") <= "U" && $arParameters["WorkflowTemplateId"] > 0) {
                 // Выбираем все шаблоны для того, чтобы определить тип шаблона
                 // так как для последовательных процессов мы даем право на запуск
                 // бизнес-процесса без проверки прав на запись.
                 if (!array_key_exists("WorkflowTemplateList" . $arParameters["IBlockId"], $GLOBALS["WEBDAV"]["CACHE"])) {
                     if (array_key_exists("WorkflowTemplateList", $arParameters)) {
                         $GLOBALS["WEBDAV"]["CACHE"]["WorkflowTemplateList" . $arParameters["IBlockId"]] = array();
                         foreach ($arParameters["WorkflowTemplateList"] as $res) {
                             $GLOBALS["WEBDAV"]["CACHE"]["WorkflowTemplateList" . $arParameters["IBlockId"]][$res["ID"]] = $res;
                         }
                     } else {
                         $res = array();
                         $db_res = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => array("webdav", "CIBlockDocumentWebdav", "iblock_" . $arParameters["IBlockId"]), "ACTIVE" => "Y"), false, false, array("ID", "NAME", "DESCRIPTION", "TEMPLATE", "PARAMETERS"));
                         while ($arWorkflowTemplate = $db_res->GetNext()) {
                             $res[$arWorkflowTemplate["ID"]] = $arWorkflowTemplate;
                         }
                         $GLOBALS["WEBDAV"]["CACHE"]["WorkflowTemplateList" . $arParameters["IBlockId"]] = $res;
                     }
                 }
                 $arWorkflowTemplateList = $GLOBALS["WEBDAV"]["CACHE"]["WorkflowTemplateList" . $arParameters["IBlockId"]];
                 if (array_key_exists($arParameters["WorkflowTemplateId"], $arWorkflowTemplateList)) {
                     $arTemplate = $arWorkflowTemplateList[$arParameters["WorkflowTemplateId"]];
                     // Если это машина состояний, то проверяем первое состояние
                     if ($arTemplate["TEMPLATE"][0]["Type"] == "StateMachineWorkflowActivity") {
                         // Выбираем парметры конкретного шаблона рабочего потока
                         if (array_key_exists($arParameters["WorkflowTemplateId"], $arParameters["DocumentStates"])) {
                             $arDocumentStates = $arParameters["DocumentStates"][$arParameters["WorkflowTemplateId"]];
                         } else {
                             if (!array_key_exists("WorkflowTemplate" . $arParameters["WorkflowTemplateId"], $GLOBALS["WEBDAV"]["CACHE"])) {
                                 $GLOBALS["WEBDAV"]["CACHE"]["WorkflowTemplate" . $arParameters["WorkflowTemplateId"]] = CBPWorkflowTemplateLoader::GetTemplateState($arParameters["WorkflowTemplateId"]);
                             }
                             $arDocumentStates = $GLOBALS["WEBDAV"]["CACHE"]["WorkflowTemplate" . $arParameters["WorkflowTemplateId"]];
                         }
                         $arAllowableOperations = CBPDocument::GetAllowableOperations($userId, $arParameters["AllUserGroups"], array($arParameters["WorkflowTemplateId"] => $arDocumentStates));
                         $r = is_array($arAllowableOperations) && in_array("write", $arAllowableOperations);
                     }
                 }
             }
             break;
         case CBPCanUserOperateOperation::CreateWorkflow:
             $r = CWebDavIblock::CheckRight($arParameters["IBlockPermission"], "element_edit") > "U";
             break;
         case CBPCanUserOperateOperation::WriteDocument:
             $r = CWebDavIblock::CheckRight($arParameters["IBlockPermission"], "element_edit") > "U" || in_array("write", $arAllowableOperations);
             break;
         case CBPWebDavCanUserOperateOperation::ReadDocument:
             $r = CWebDavIblock::CheckRight($arParameters["IBlockPermission"], "element_edit") > "U" || in_array("read", $arAllowableOperations);
             break;
         default:
             $r = false;
     }
     return $r;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:iblockbizproc.php


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