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


PHP CBPWorkflowTemplateLoader::GetDocumentTypeStates方法代码示例

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


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

示例1: GetDocumentStates

 /**
  * Метод возвращает массив всех рабочих потоков и их состояний для данного документа.
  * Если задан код документа, то метод возвращает массив всех запущенных для данного документа рабочих потоков (в том числе и завершенные), а так же шаблонов рабочих потоков, настроенных на автозапуск при изменении документа.
  * Если код документа не задан, то метод возвращает массив шаблонов рабочих потоков, настроенных на автозапуск при создании документа.
  * Массив имеет вид:
  *	array(
  *		код_рабочего_потока_или_шаблона => array(
  *			"ID" => код_рабочего_потока,
  *			"TEMPLATE_ID" => код_шаблона_рабочего_потока,
  *			"TEMPLATE_NAME" => название_шаблона_рабочего_потока,
  *			"TEMPLATE_DESCRIPTION" => описание_шаблона_рабочего_потока,
  *			"TEMPLATE_PARAMETERS" => массив_параметров_запуска_рабочего_потока_из_шаблона,
  *			"STATE_NAME" => текущее_состояние_рабочего_потока,
  *			"STATE_TITLE" => название_текущего_состояния_рабочего_потока,
  *			"STATE_MODIFIED" => дата_изменения_статуса_рабочего_потока,
  *			"STATE_PARAMETERS" => массив_событий_принимаемых_потоком_в_данном_состоянии,
  *			"STATE_PERMISSIONS" => права_на_операции_над_документом_в_данном_состоянии,
  *			"WORKFLOW_STATUS" => статус_рабочего_потока,
  *		),
  * 		. . .
  *	)
  * В зависимости от того, рабочий поток это или шаблон, часть полей может быть не установлена. Для шаблона рабочего потока типа конечных автоматов состоянием является его начальное состояние.
  * Массив параметров запуска рабочего потока из шаблона (TEMPLATE_PARAMETERS) имеет вид:
  *	array(
  *		"param1" => array(
  *			"Name" => "Параметр 1",
  *			"Description" => "",
  *			"Type" => "int",
  *			"Required" => true,
  *			"Multiple" => false,
  *			"Default" => 8,
  *			"Options" => null,
  *		),
  *		"param2" => array(
  *			"Name" => "Параметр 2",
  *			"Description" => "",
  *			"Type" => "select",
  *			"Required" => false,
  *			"Multiple" => true,
  *			"Default" => "v2",
  *			"Options" => array(
  *				"v1" => "V 1",
  *				"v2" => "V 2",
  *				"v3" => "V 3",
  *				. . .
  *			),
  *		),
  *		. . .
  *	)
  * Допустимые типы параметров: int, double, string, text, select, bool, date, datetime, user.
  * Массив событий, принимаемых потоком в данном состоянии (STATE_PARAMETERS) имеет вид:
  *	array(
  *		array(
  *			"NAME" => принимаемое_событие,
  *			"TITLE" => название_принимаемого_события,
  *			"PERMISSION" => массив_групп_пользователей_могущих_отправить_событие
  *		),
  *		. . .
  *	)
  * Права на операции над документом в данном состоянии (STATE_PERMISSIONS) имеют вид:
  *	array(
  *		операция => массив_групп_пользователей_могущих_осуществлять_операцию,
  *		. . .
  *	)
  *
  * @param array $documentType - тип документа в виде массива array(модуль, сущность, тип_документа_в_модуле)
  * @param mixed $documentId - код документа в виде массива array(модуль, сущность, код_документа_в_модуле). Если новый документ, то null.
  * @return array - массив рабочих потоков и шаблонов.
  */
 public static function GetDocumentStates($documentType, $documentId = null)
 {
     $arDocumentStates = array();
     if ($documentId != null) {
         $arDocumentStates = CBPStateService::GetDocumentStates($documentId);
     }
     $arTemplateStates = CBPWorkflowTemplateLoader::GetDocumentTypeStates($documentType, $documentId != null ? CBPDocumentEventType::Edit : CBPDocumentEventType::Create);
     return $arDocumentStates + $arTemplateStates;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:78,代码来源:document.php

示例2: Execute

 public function Execute()
 {
     if (!CModule::IncludeModule("intranet")) {
         return CBPActivityExecutionStatus::Closed;
     }
     $iblockId = COption::GetOptionInt("intranet", "iblock_tasks", 0);
     if ($iblockId <= 0) {
         return CBPActivityExecutionStatus::Closed;
     }
     $parentSectionId = 0;
     $dbSectionsList = CIBlockSection::GetList(array(), array("GLOBAL_ACTIVE" => "Y", "XML_ID" => $this->TaskType == "group" ? $this->TaskOwnerId : "users_tasks", "IBLOCK_ID" => $iblockId, "SECTION_ID" => 0), false);
     if ($arSection = $dbSectionsList->GetNext()) {
         $parentSectionId = $arSection["ID"];
     }
     if ($parentSectionId <= 0) {
         $dbSectionsList = CIBlockSection::GetList(array(), array("GLOBAL_ACTIVE" => "Y", "XML_ID" => "users_tasks", "IBLOCK_ID" => $iblockId, "SECTION_ID" => 0), false);
         if ($arSection = $dbSectionsList->GetNext()) {
             $parentSectionId = $arSection["ID"];
         }
     }
     if ($parentSectionId <= 0) {
         return CBPActivityExecutionStatus::Closed;
     }
     $rootActivity = $this->GetRootActivity();
     $documentId = $rootActivity->GetDocumentId();
     $arTaskCreatedBy = CBPHelper::ExtractUsers($this->TaskCreatedBy, $documentId, true);
     $arTaskAssignedTo = CBPHelper::ExtractUsers($this->TaskAssignedTo, $documentId, true);
     if (!$arTaskCreatedBy || !$arTaskAssignedTo) {
         return CBPActivityExecutionStatus::Closed;
     }
     if ($this->TaskType != "group") {
         $this->TaskOwnerId = $arTaskAssignedTo;
     }
     $arTaskTrackers = CBPHelper::ExtractUsers($this->TaskTrackers, $documentId);
     $arFields = array("IBLOCK_SECTION_ID" => $parentSectionId, "MODIFIED_BY" => $arTaskCreatedBy, "CREATED_BY" => $arTaskCreatedBy, "DATE_CREATE" => date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME)), "ACTIVE_FROM" => $this->TaskActiveFrom, "ACTIVE_TO" => $this->TaskActiveTo, "NAME" => $this->TaskName, "DETAIL_TEXT" => $this->TaskDetailText, "PROPERTY_TaskPriority" => $this->TaskPriority, "PROPERTY_TaskAssignedTo" => $arTaskAssignedTo, "PROPERTY_TaskTrackers" => $arTaskTrackers);
     $taskId = CIntranetTasksDocument::CreateDocument($arFields);
     if ($this->TaskType == "group") {
         $pathTemplate = str_replace(array("#GROUP_ID#", "#TASK_ID#"), array($this->TaskOwnerId, "{=Document:ID}"), COption::GetOptionString("intranet", "path_task_group_entry", "/workgroups/group/#GROUP_ID#/tasks/task/view/#TASK_ID#/"));
     } else {
         $pathTemplate = str_replace(array("#USER_ID#", "#TASK_ID#"), array($this->TaskOwnerId, "{=Document:ID}"), COption::GetOptionString("intranet", "path_task_user_entry", "/company/personal/user/#USER_ID#/tasks/task/view/#TASK_ID#/"));
     }
     $pathTemplate = str_replace('#HTTP_HOST#', $_SERVER['HTTP_HOST'], "http://#HTTP_HOST#" . $pathTemplate);
     $arTemplateStates = CBPWorkflowTemplateLoader::GetDocumentTypeStates(array("intranet", "CIntranetTasksDocument", "x" . $iblockId), CBPDocumentEventType::Create);
     foreach ($arTemplateStates as $arState) {
         CBPDocument::StartWorkflow($arState["TEMPLATE_ID"], array("intranet", "CIntranetTasksDocument", $taskId), array("OwnerId" => $this->TaskOwnerId, "TaskType" => $this->TaskType, "PathTemplate" => $pathTemplate, "ForumId" => intval($this->TaskForumId), "IBlockId" => $iblockId), $arErrorsTmp);
     }
     return CBPActivityExecutionStatus::Closed;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:48,代码来源:taskactivity.php

示例3: CanUserOperateDocumentType

 function CanUserOperateDocumentType($operation, $userId, $documentType, $arParameters = array())
 {
     $documentType = trim($documentType);
     if (strlen($documentType) <= 0) {
         return false;
     }
     $arParameters["IBlockId"] = intval(substr($documentType, strlen("iblock_")));
     if (!array_key_exists("IBlockRightsMode", $arParameters)) {
         $arParameters["IBlockRightsMode"] = CIBlock::GetArrayByID($arParameters["IBlockId"], "RIGHTS_MODE");
     }
     if ($arParameters["IBlockRightsMode"] === "E") {
         if ($operation === CBPCanUserOperateOperation::CreateWorkflow) {
             return CIBlockRights::UserHasRightTo($arParameters["IBlockId"], $arParameters["IBlockId"], "iblock_rights_edit");
         } elseif ($operation === CBPCanUserOperateOperation::WriteDocument) {
             return CIBlockRights::UserHasRightTo($arParameters["IBlockId"], $arParameters["IBlockId"], "section_element_bind");
         } elseif ($operation === CBPCanUserOperateOperation::ViewWorkflow || $operation === CBPCanUserOperateOperation::StartWorkflow) {
             if (!array_key_exists("WorkflowId", $arParameters)) {
                 return false;
             }
             if ($operation === CBPCanUserOperateOperation::ViewWorkflow && !CIBlockRights::UserHasRightTo($arParameters["IBlockId"], $arParameters["IBlockId"], "element_read")) {
                 return false;
             }
             if ($operation === CBPCanUserOperateOperation::StartWorkflow && !CIBlockRights::UserHasRightTo($arParameters["IBlockId"], $arParameters["IBlockId"], "section_element_bind")) {
                 return false;
             }
             $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)) {
                 if ($operation === CBPCanUserOperateOperation::StartWorkflow) {
                     $arParameters["DocumentStates"] = CBPWorkflowTemplateLoader::GetDocumentTypeStates(array("iblock", "CIBlockDocument", "iblock_" . $arParameters["IBlockId"]));
                 } else {
                     $arParameters["DocumentStates"] = CBPDocument::GetDocumentStates(array("iblock", "CIBlockDocument", "iblock_" . $arParameters["IBlockId"]), null);
                 }
             }
             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"]);
             if (!is_array($arAllowableOperations)) {
                 return false;
             }
             if ($operation === CBPCanUserOperateOperation::ViewWorkflow && in_array("read", $arAllowableOperations) || $operation === CBPCanUserOperateOperation::StartWorkflow && in_array("write", $arAllowableOperations)) {
                 return true;
             }
             $chop = $operation === CBPCanUserOperateOperation::ViewWorkflow ? "element_read" : "section_element_bind";
             foreach ($arAllowableOperations as $op) {
                 $ar = CTask::GetOperations($op, true);
                 if (in_array($chop, $ar)) {
                     return true;
                 }
             }
         }
         return false;
     }
     if (!array_key_exists("IBlockPermission", $arParameters)) {
         if (CModule::IncludeModule('lists')) {
             $arParameters["IBlockPermission"] = CLists::GetIBlockPermission($arParameters["IBlockId"], $userId);
         } else {
             $arParameters["IBlockPermission"] = CIBlock::GetPermission($arParameters["IBlockId"], $userId);
         }
     }
     if ($arParameters["IBlockPermission"] <= "R") {
         return false;
     } elseif ($arParameters["IBlockPermission"] >= "W") {
         return true;
     }
     $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("iblock", "CIBlockDocument", "iblock_" . $arParameters["IBlockId"]), null);
     }
     if (array_key_exists("WorkflowId", $arParameters)) {
         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"]);
     if (!is_array($arAllowableOperations)) {
         return false;
     }
     $r = false;
     switch ($operation) {
         case CBPCanUserOperateOperation::ViewWorkflow:
             $r = in_array("read", $arAllowableOperations);
//.........这里部分代码省略.........
开发者ID:spas-viktor,项目名称:books,代码行数:101,代码来源:iblockdocument.php

示例4: foreach

    }
}
foreach ($arCustomFilter as $FIELD_ID => $arCallback) {
    $filtered = false;
    call_user_func_array($arCallback["callback"], array($arListFields[$FIELD_ID], array("VALUE" => $FIELD_ID, "GRID_ID" => $arResult["GRID_ID"]), &$arFilter, &$filtered));
}
$arFilter["IBLOCK_ID"] = $arIBlock["ID"];
$arFilter["CHECK_PERMISSIONS"] = $lists_perm >= CListPermissions::CAN_READ ? "N" : "Y";
if (!$arResult["ANY_SECTION"]) {
    $arFilter["SECTION_ID"] = $arResult["SECTION_ID"];
}
/** @var CIBlockResult $rsElements */
$rsElements = CIBlockElement::GetList($grid_sort["sort"], $arFilter, false, $grid_options->GetNavParams(), $arSelect);
if ($arResult["BIZPROC"] == "Y") {
    $arUserGroupsForBP = CUser::GetUserGroup($USER->GetID());
    $arDocumentStatesForBP = CBPWorkflowTemplateLoader::GetDocumentTypeStates(BizProcDocument::generateDocumentComplexType($arParams["IBLOCK_TYPE_ID"], $arIBlock["ID"]));
} else {
    $arUserGroupsForBP = array();
    $arDocumentStatesForBP = array();
}
$arResult["ELEMENTS_CAN_DELETE"] = array();
$arResult["ELEMENTS_CAN_MOVE"] = array();
$arResult["ELEMENTS_ROWS"] = array();
$check = false;
while ($obElement = $rsElements->GetNextElement()) {
    $check = true;
    $data = $obElement->GetFields();
    $aCols = array();
    if (!empty($arProperties)) {
        $rsProp = CIBlockElement::GetProperty($arIBlock["ID"], $data["ID"]);
        while ($arProp = $rsProp->Fetch()) {
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例5: IsBpParamRequired

 function IsBpParamRequired()
 {
     static $dataType = 'IsBpParamRequired';
     $result = 'N';
     if ($this->workflow == 'bizproc') {
         $result = $this->_dataCache($dataType);
         if ($result === false) {
             $arTemplateStates = CBPWorkflowTemplateLoader::GetDocumentTypeStates($this->wfParams["DOCUMENT_TYPE"], CBPDocumentEventType::Create) + CBPWorkflowTemplateLoader::GetDocumentTypeStates($this->wfParams["DOCUMENT_TYPE"], CBPDocumentEventType::Edit);
             foreach ($arTemplateStates as $arTemplateState) {
                 if (is_array($arTemplateState["TEMPLATE_PARAMETERS"])) {
                     foreach ($arTemplateState["TEMPLATE_PARAMETERS"] as $res) {
                         if ($res["Required"] == 1 && empty($res["Default"])) {
                             $result = "Y";
                             break;
                         }
                     }
                     if ($result === 'Y') {
                         break;
                     }
                 }
             }
             $this->_dataCache($dataType, $result);
         }
     }
     return $result === 'Y';
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:26,代码来源:iblock.php

示例6: foreach

        $arFilter[$op . $new_key] = $value;
    }
}
foreach ($arCustomFilter as $FIELD_ID => $arCallback) {
    call_user_func_array($arCallback["callback"], array($arListFields[$FIELD_ID], array("VALUE" => $FIELD_ID), &$arFilter, &$filtered));
    $arCallback["filter"]["filtered"] = $filtered;
}
$arFilter["IBLOCK_ID"] = $arIBlock["ID"];
$arFilter["CHECK_PERMISSIONS"] = $lists_perm >= CListPermissions::CAN_READ ? "N" : "Y";
if (!$arResult["ANY_SECTION"]) {
    $arFilter["SECTION_ID"] = $arResult["SECTION_ID"];
}
$rsElements = CIBlockElement::GetList($grid_sort["sort"], $arFilter, false, $grid_options->GetNavParams(), $arSelect);
if ($arResult["BIZPROC"] == "Y") {
    $arUserGroupsForBP = CUser::GetUserGroup($GLOBALS["USER"]->GetID());
    $arDocumentStatesForBP = CBPWorkflowTemplateLoader::GetDocumentTypeStates(array("iblock", "CIBlockDocument", "iblock_" . $arIBlock["ID"]));
} else {
    $arUserGroupsForBP = array();
}
$arResult["ELEMENTS_CAN_DELETE"] = array();
$arResult["ELEMENTS_CAN_MOVE"] = array();
$arResult["ELEMENTS_ROWS"] = array();
while ($obElement = $rsElements->GetNextElement()) {
    $data = $obElement->GetFields();
    $aCols = array();
    if (!empty($arProperties)) {
        $rsProp = CIBlockElement::GetProperty($arIBlock["ID"], $data["ID"]);
        while ($arProp = $rsProp->Fetch()) {
            $FIELD_ID = "PROPERTY_" . $arProp["ID"];
            if (in_array($FIELD_ID, $arProperties)) {
                $arField = $arResult["FIELDS"][$FIELD_ID];
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php


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