本文整理汇总了PHP中CBPWorkflowTemplateLoader::GetLoader方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPWorkflowTemplateLoader::GetLoader方法的具体用法?PHP CBPWorkflowTemplateLoader::GetLoader怎么用?PHP CBPWorkflowTemplateLoader::GetLoader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPWorkflowTemplateLoader
的用法示例。
在下文中一共展示了CBPWorkflowTemplateLoader::GetLoader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Delete
public static function Delete($id)
{
$loader = CBPWorkflowTemplateLoader::GetLoader();
$loader->DeleteTemplate($id);
self::cleanTemplateCache($id);
}
示例2: CreateWorkflow
/**
* Creates new workflow instance from the specified template.
*
* @param int $workflowTemplateId - ID of the workflow template
* @param string $documentId - ID of the document
* @param mixed $workflowParameters - Optional parameters of the created workflow instance
* @param array|null $parentWorkflow - Parent Workflow information.
* @return CBPWorkflow
* @throws CBPArgumentNullException
* @throws CBPArgumentOutOfRangeException
* @throws Exception
* @throws \Bitrix\Main\ArgumentNullException
*/
public function CreateWorkflow($workflowTemplateId, $documentId, $workflowParameters = array(), $parentWorkflow = null)
{
$workflowTemplateId = intval($workflowTemplateId);
if ($workflowTemplateId <= 0) {
throw new Exception("workflowTemplateId");
}
$arDocumentId = CBPHelper::ParseDocumentId($documentId);
$limit = \Bitrix\Main\Config\Option::get("bizproc", "limit_simultaneous_processes", "0");
if (intval($limit) > 0) {
if (CBPStateService::CountDocumentWorkflows($documentId) >= $limit) {
throw new Exception(GetMessage("BPCGDOC_LIMIT_SIMULTANEOUS_PROCESSES", array("#NUM#" => $limit)));
}
}
if (!$this->isStarted) {
$this->StartRuntime();
}
$workflowId = uniqid("", true);
if ($parentWorkflow) {
$this->addWorkflowToChain($workflowId, $parentWorkflow);
if ($this->checkWorkflowRecursion($workflowId, $workflowTemplateId)) {
throw new Exception(GetMessage("BPCGDOC_WORKFLOW_RECURSION_LOCK"));
}
}
$workflow = new CBPWorkflow($workflowId, $this);
$loader = CBPWorkflowTemplateLoader::GetLoader();
list($rootActivity, $workflowVariablesTypes, $workflowParametersTypes) = $loader->LoadWorkflow($workflowTemplateId);
if ($rootActivity == null) {
throw new Exception("EmptyRootActivity");
}
//if (!is_a($rootActivity, "IBPRootActivity"))
// throw new Exception("RootActivityIsNotAIBPRootActivity");
foreach (GetModuleEvents("bizproc", "OnCreateWorkflow", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($workflowTemplateId, $documentId, &$workflowParameters));
}
$workflow->Initialize($rootActivity, $arDocumentId, $workflowParameters, $workflowVariablesTypes, $workflowParametersTypes, $workflowTemplateId);
$starterUserId = 0;
if (isset($workflowParameters[CBPDocument::PARAM_TAGRET_USER])) {
$starterUserId = intval(substr($workflowParameters[CBPDocument::PARAM_TAGRET_USER], strlen("user_")));
}
$this->arServices["StateService"]->AddWorkflow($workflowId, $workflowTemplateId, $arDocumentId, $starterUserId);
$this->arWorkflows[$workflowId] = $workflow;
return $workflow;
}
示例3: CreateWorkflow
/**
* Creates new workflow instance from the specified template.
*
* @param int $workflowTemplateId - ID of the workflow template
* @param string $documentId - ID of the document
* @param mixed $workflowParameters - Optional parameters of the created workflow instance
* @return CBPWorkflow
*/
public function CreateWorkflow($workflowTemplateId, $documentId, $workflowParameters = array())
{
$workflowTemplateId = intval($workflowTemplateId);
if ($workflowTemplateId <= 0) {
throw new Exception("workflowTemplateId");
}
$arDocumentId = CBPHelper::ParseDocumentId($documentId);
if (!$this->isStarted) {
$this->StartRuntime();
}
$workflowId = uniqid("", true);
$workflow = new CBPWorkflow($workflowId, $this);
$loader = CBPWorkflowTemplateLoader::GetLoader();
list($rootActivity, $workflowVariablesTypes, $workflowParametersTypes) = $loader->LoadWorkflow($workflowTemplateId);
if ($rootActivity == null) {
throw new Exception("EmptyRootActivity");
}
//if (!is_a($rootActivity, "IBPRootActivity"))
// throw new Exception("RootActivityIsNotAIBPRootActivity");
$events = GetModuleEvents("bizproc", "OnCreateWorkflow");
while ($arEvent = $events->Fetch()) {
ExecuteModuleEventEx($arEvent, array($workflowTemplateId, $documentId, &$workflowParameters));
}
$workflow->Initialize($rootActivity, $arDocumentId, $workflowParameters, $workflowVariablesTypes, $workflowParametersTypes);
$starterUserId = 0;
if (array_key_exists("TargetUser", $workflowParameters)) {
$starterUserId = intval(substr($workflowParameters["TargetUser"], strlen("user_")));
}
$this->arServices["StateService"]->AddWorkflow($workflowId, $workflowTemplateId, $arDocumentId, $starterUserId);
$this->arWorkflows[$workflowId] = $workflow;
return $workflow;
}