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


PHP CBPDocument::StartWorkflow方法代码示例

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


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

示例1: StartWorkflow

 public function StartWorkflow($ID, $arBizProcParametersValues = false)
 {
     if (!CModule::IncludeModule('bizproc')) {
         return true;
     }
     global $USER;
     $arBizProcWorkflowId = array();
     $bresult = true;
     foreach ($this->arDocumentStates as $arDocumentState) {
         if (strlen($arDocumentState['ID']) <= 0) {
             $arErrorsTmp = array();
             $arBizProcWorkflowId[$arDocumentState['TEMPLATE_ID']] = CBPDocument::StartWorkflow($arDocumentState['TEMPLATE_ID'], array('crm', $this->sDocument, $this->sEntityType . '_' . $ID), $arBizProcParametersValues[$arDocumentState['TEMPLATE_ID']], $arErrorsTmp);
             if (count($arErrorsTmp) > 0) {
                 $this->LAST_ERROR = '';
                 foreach ($arErrorsTmp as $e) {
                     $this->LAST_ERROR .= $e['message'] . '<br />';
                 }
                 $bresult = false;
             }
         }
     }
     if ($bresult) {
         $bizprocIndex = (int) $_REQUEST['bizproc_index'];
         if ($bizprocIndex > 0) {
             for ($i = 1; $i <= $bizprocIndex; $i++) {
                 $bpId = trim($_REQUEST['bizproc_id_' . $i]);
                 $bpTemplateId = intval($_REQUEST['bizproc_template_id_' . $i]);
                 $bpEvent = trim($_REQUEST['bizproc_event_' . $i]);
                 if (strlen($bpEvent) > 0) {
                     if (strlen($bpId) > 0) {
                         if (!array_key_exists($bpId, $this->arDocumentStates)) {
                             continue;
                         }
                     } else {
                         if (!array_key_exists($bpTemplateId, $this->arDocumentStates)) {
                             continue;
                         }
                         $bpId = $arBizProcWorkflowId[$bpTemplateId];
                     }
                     $arErrorTmp = array();
                     CBPDocument::SendExternalEvent($bpId, $bpEvent, array('Groups' => $this->arCurrentUserGroups, 'User' => $USER->GetID()), $arErrorTmp);
                     if (count($arErrorsTmp) > 0) {
                         foreach ($arErrorsTmp as $e) {
                             $this->LAST_ERROR .= $e['message'] . '<br />';
                         }
                         $bresult = false;
                     }
                 }
             }
         }
     }
     return $bresult;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:53,代码来源:crm_bizproc.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: processActionCheckDataElementCreation


//.........这里部分代码省略.........
                         $props[$field["ID"]][$fileId]["del"] = "Y";
                     }
                 }
             }
         } elseif ($field["PROPERTY_TYPE"] == "N") {
             if (is_array($_POST[$fieldId]) && !array_key_exists("VALUE", $_POST[$fieldId])) {
                 $props[$field["ID"]] = array();
                 foreach ($_POST[$fieldId] as $key => $value) {
                     if (is_array($value)) {
                         if (strlen($value["VALUE"])) {
                             $value = str_replace(" ", "", str_replace(",", ".", $value["VALUE"]));
                             if (!is_numeric($value)) {
                                 $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
                                 $this->sendJsonErrorResponse();
                             }
                             $props[$field["ID"]][$key] = doubleval($value);
                         }
                     } else {
                         if (strlen($value)) {
                             $value = str_replace(" ", "", str_replace(",", ".", $value));
                             if (!is_numeric($value)) {
                                 $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
                                 $this->sendJsonErrorResponse();
                             }
                             $props[$field["ID"]][$key] = doubleval($value);
                         }
                     }
                 }
             } else {
                 if (is_array($_POST[$fieldId])) {
                     if (strlen($_POST[$fieldId]["VALUE"])) {
                         $value = str_replace(" ", "", str_replace(",", ".", $_POST[$fieldId]["VALUE"]));
                         if (!is_numeric($value)) {
                             $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
                             $this->sendJsonErrorResponse();
                         }
                         $props[$field["ID"]] = doubleval($value);
                     }
                 } else {
                     if (strlen($_POST[$fieldId])) {
                         $value = str_replace(" ", "", str_replace(",", ".", $_POST[$fieldId]));
                         if (!is_numeric($value)) {
                             $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_VALIDATE_FIELD_ERROR', array('#NAME#' => $field['NAME'])))));
                             $this->sendJsonErrorResponse();
                         }
                         $props[$field["ID"]] = doubleval($value);
                     }
                 }
             }
         } else {
             $props[$field["ID"]] = $_POST[$fieldId];
         }
     }
     $elementData["MODIFIED_BY"] = $this->getUser()->getID();
     unset($elementData["TIMESTAMP_X"]);
     if (!empty($props)) {
         $elementData["PROPERTY_VALUES"] = $props;
     }
     $documentStates = CBPDocument::GetDocumentStates($documentType, null);
     $userId = $this->getUser()->getId();
     $write = CBPDocument::CanUserOperateDocumentType(CBPCanUserOperateOperation::WriteDocument, $userId, $documentType, array('AllUserGroups' => array(), 'DocumentStates' => $documentStates));
     if (!$write) {
         $this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_IS_ACCESS_DENIED_STATUS'))));
         $this->sendJsonErrorResponse();
     }
     $bizprocParametersValues = array();
     foreach ($documentStates as $documentState) {
         if (strlen($documentState["ID"]) <= 0) {
             $errors = array();
             $bizprocParametersValues[$documentState['TEMPLATE_ID']] = CBPDocument::StartWorkflowParametersValidate($documentState['TEMPLATE_ID'], $documentState['TEMPLATE_PARAMETERS'], $documentType, $errors);
             $stringError = '';
             foreach ($errors as $e) {
                 $stringError .= $e['message'] . '<br />';
             }
         }
     }
     if (!empty($stringError)) {
         $this->errorCollection->add(array(new Error($stringError)));
         $this->sendJsonErrorResponse();
     }
     $objectElement = new CIBlockElement();
     $idElement = $objectElement->Add($elementData, false, true, true);
     if ($idElement) {
         $bizProcWorkflowId = array();
         foreach ($documentStates as $documentState) {
             if (strlen($documentState["ID"]) <= 0) {
                 $errorsTmp = array();
                 $bizProcWorkflowId[$documentState['TEMPLATE_ID']] = CBPDocument::StartWorkflow($documentState['TEMPLATE_ID'], array('lists', 'BizprocDocument', $idElement), array_merge($bizprocParametersValues[$documentState['TEMPLATE_ID']], array('TargetUser' => 'user_' . intval($this->getUser()->getID()))), $errorsTmp);
             }
         }
         if (!empty($errorsTmp)) {
             $documentStates = null;
             CBPDocument::AddDocumentToHistory(array('lists', 'BizprocDocument', $idElement), $elementData['NAME'], $this->getUser()->getID());
         }
     } else {
         $this->errorCollection->add(array(new Error($objectElement->LAST_ERROR)));
         $this->sendJsonErrorResponse();
     }
     $this->sendJsonSuccessResponse(array());
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:ajax.php

示例4: StartRestTime

 public static function StartRestTime($task_name, $doc_id)
 {
     $arErrorsTmp = array();
     $wf = CBPDocument::StartWorkflow(66, array("iblock", "CIBlockDocument", $doc_id), array("TaskName" => $task_name), $arErrorsTmp);
 }
开发者ID:konvita2,项目名称:portal_php,代码行数:5,代码来源:arka_classes.php

示例5: array

                     if (!empty($differences)) {
                         $modifiedFields[] = $fieldName;
                     }
                 }
             } else {
                 if (strcmp((string) $fieldValue, (string) $elementOldData[$fieldName]) !== 0) {
                     $modifiedFields[] = $fieldName;
                 }
             }
         }
     }
     $arBizProcWorkflowId = array();
     foreach ($arDocumentStates as $arDocumentState) {
         if (strlen($arDocumentState["ID"]) <= 0) {
             $arErrorsTmp = array();
             $arBizProcWorkflowId[$arDocumentState["TEMPLATE_ID"]] = CBPDocument::StartWorkflow($arDocumentState["TEMPLATE_ID"], BizProcDocument::getDocumentComplexId($arParams["IBLOCK_TYPE_ID"], $arResult["ELEMENT_ID"]), array_merge($arBizProcParametersValues[$arDocumentState["TEMPLATE_ID"]], array(CBPDocument::PARAM_TAGRET_USER => "user_" . intval($GLOBALS["USER"]->GetID()), CBPDocument::PARAM_MODIFIED_DOCUMENT_FIELDS => $modifiedFields)), $arErrorsTmp);
             foreach ($arErrorsTmp as $e) {
                 $strError .= $e["message"] . "<br />";
             }
         }
     }
 }
 if (!$strError) {
     $bizprocIndex = intval($_REQUEST["bizproc_index"]);
     if ($bizprocIndex > 0) {
         for ($i = 1; $i <= $bizprocIndex; $i++) {
             $bpId = trim($_REQUEST["bizproc_id_" . $i]);
             $bpTemplateId = intval($_REQUEST["bizproc_template_id_" . $i]);
             $bpEvent = trim($_REQUEST["bizproc_event_" . $i]);
             if (strlen($bpEvent) > 0) {
                 if (strlen($bpId) > 0) {
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例6: if

				} // if ($strWarning)

				if ($bBizproc)
				{
					if ($strWarning == '')
					{
						$arBizProcWorkflowId = array();
						foreach ($arDocumentStates as $arDocumentState)
						{
							if (strlen($arDocumentState["ID"]) <= 0)
							{
								$arErrorsTmp = array();

								$arBizProcWorkflowId[$arDocumentState["TEMPLATE_ID"]] = CBPDocument::StartWorkflow(
									$arDocumentState["TEMPLATE_ID"],
									array(MODULE_ID, ENTITY, $ID),
									$arBizProcParametersValues[$arDocumentState["TEMPLATE_ID"]],
									$arErrorsTmp
								);

								if (!empty($arErrorsTmp))
								{
									foreach ($arErrorsTmp as $e)
										$strWarning .= $e["message"]."<br />";
								}
							}
						}
					}

					if ($strWarning == '')
					{
						$bizprocIndex = intval($_REQUEST["bizproc_index"]);
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:32,代码来源:iblock_element_edit.php

示例7: elseif

         if (!empty($_REQUEST["iblock_apply"]) && strlen($SEF_URL) > 0) {
             if (strpos($SEF_URL, "?") === false) {
                 $SEF_URL .= "?edit=Y";
             } elseif (strpos($SEF_URL, "edit=") === false) {
                 $SEF_URL .= "&edit=Y";
             }
             $SEF_URL .= "&CODE=" . $arParams["ID"];
         }
     }
 }
 if ($bBizproc && count($arResult["ERRORS"]) == 0) {
     $arBizProcWorkflowId = array();
     foreach ($arDocumentStates as $arDocumentState) {
         if (strlen($arDocumentState["ID"]) <= 0) {
             $arErrorsTmp = array();
             $arBizProcWorkflowId[$arDocumentState["TEMPLATE_ID"]] = CBPDocument::StartWorkflow($arDocumentState["TEMPLATE_ID"], array("iblock", "CIBlockDocument", $arParams["ID"]), $arBizProcParametersValues[$arDocumentState["TEMPLATE_ID"]], $arErrorsTmp);
             foreach ($arErrorsTmp as $e) {
                 $arResult["ERRORS"][] = $e["message"];
             }
         }
     }
 }
 if ($bBizproc && count($arResult["ERRORS"]) == 0) {
     $arDocumentStates = null;
     CBPDocument::AddDocumentToHistory(array("iblock", "CIBlockDocument", $arParams["ID"]), $arUpdateValues["NAME"], $USER->GetID());
 }
 // redirect to element edit form or to elements list
 if (count($arResult["ERRORS"]) == 0) {
     if (!empty($_REQUEST["iblock_submit_c"])) {
         if (strlen($arParams["LIST_URL"]) > 0) {
             $sRedirectUrl = $arParams["LIST_URL"];
开发者ID:sharapudinov,项目名称:lovestore.top,代码行数:31,代码来源:component.php

示例8: array

     } else {
         $res = $obElement->Add($arElement, false, true, true);
         if ($res) {
             $arResult["ELEMENT_ID"] = $res;
         } else {
             $strError = $obElement->LAST_ERROR;
         }
     }
 }
 if ($bBizproc) {
     if (!$strError) {
         $arBizProcWorkflowId = array();
         foreach ($arDocumentStates as $arDocumentState) {
             if (strlen($arDocumentState["ID"]) <= 0) {
                 $arErrorsTmp = array();
                 $arBizProcWorkflowId[$arDocumentState["TEMPLATE_ID"]] = CBPDocument::StartWorkflow($arDocumentState["TEMPLATE_ID"], BizprocDocument::getDocumentComplexId($arParams["IBLOCK_TYPE_ID"], $arResult["ELEMENT_ID"]), array_merge($arBizProcParametersValues[$arDocumentState["TEMPLATE_ID"]], array("TargetUser" => "user_" . intval($GLOBALS["USER"]->GetID()))), $arErrorsTmp);
                 foreach ($arErrorsTmp as $e) {
                     $strError .= $e["message"] . "<br />";
                 }
             }
         }
     }
     if (!$strError) {
         $bizprocIndex = intval($_REQUEST["bizproc_index"]);
         if ($bizprocIndex > 0) {
             for ($i = 1; $i <= $bizprocIndex; $i++) {
                 $bpId = trim($_REQUEST["bizproc_id_" . $i]);
                 $bpTemplateId = intval($_REQUEST["bizproc_template_id_" . $i]);
                 $bpEvent = trim($_REQUEST["bizproc_event_" . $i]);
                 if (strlen($bpEvent) > 0) {
                     if (strlen($bpId) > 0) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例9: foreach

             }
         }
     }
     $arWorkflowParameters = CBPWorkflowTemplateLoader::CheckWorkflowParameters($workflowTemplate["PARAMETERS"], $arRequest, $documentParameters["DOCUMENT_TYPE"], $arErrorsTmp);
     if (count($arErrorsTmp) > 0) {
         $bCanStartWorkflow = false;
         foreach ($arErrorsTmp as $e) {
             $arError[] = array("id" => "CheckWorkflowParameters", "text" => $e["message"]);
         }
     } else {
         $bCanStartWorkflow = true;
     }
 }
 if ($bCanStartWorkflow) {
     $arErrorsTmp = array();
     $wfId = CBPDocument::StartWorkflow($arParams["TEMPLATE_ID"], $documentParameters["DOCUMENT_ID"], array_merge($arWorkflowParameters, array("TargetUser" => "user_" . intval($GLOBALS["USER"]->GetID()))), $arErrorsTmp);
     if (count($arErrorsTmp) > 0) {
         $arResult["SHOW_MODE"] = "StartWorkflowError";
         foreach ($arErrorsTmp as $e) {
             $arError[] = array("id" => "StartWorkflowError", "text" => "[" . $e["code"] . "] " . $e["message"]);
         }
     } else {
         $arResult["SHOW_MODE"] = "StartWorkflowSuccess";
         if (strlen($arResult["back_url"]) > 0) {
             LocalRedirect(str_replace("#WF#", $wfId, $_REQUEST["back_url"]));
             die;
         }
     }
 } else {
     $p = $_SERVER["REQUEST_METHOD"] == "POST" && strlen($_POST["DoStartParamWorkflow"]) > 0;
     $keys = array_keys($workflowTemplate["PARAMETERS"]);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例10: foreach

             }
         }
     }
     $arWorkflowParameters = CBPWorkflowTemplateLoader::CheckWorkflowParameters($arWorkflowTemplate["PARAMETERS"], $arRequest, $documentType, $arErrorsTmp);
     if (count($arErrorsTmp) > 0) {
         $bCanStartWorkflow = false;
         foreach ($arErrorsTmp as $e) {
             $errorMessage .= $e["message"] . "<br />";
         }
     } else {
         $bCanStartWorkflow = true;
     }
 }
 if ($bCanStartWorkflow) {
     $arErrorsTmp = array();
     $wfId = CBPDocument::StartWorkflow($workflowTemplateId, $documentId, $arWorkflowParameters, $arErrorsTmp);
     if (count($arErrorsTmp) > 0) {
         $showMode = "StartWorkflowError";
         foreach ($arErrorsTmp as $e) {
             $errorMessage .= "[" . $e["code"] . "] " . $e["message"] . "<br />";
         }
     } else {
         $showMode = "StartWorkflowSuccess";
         if (strlen($backUrl) <= 0) {
             $backUrl = "/bitrix/admin/bizproc_log.php?ID=#WF#";
         }
         LocalRedirect(str_replace("#WF#", $wfId, $backUrl));
         die;
     }
 } else {
     $p = $_SERVER["REQUEST_METHOD"] == "POST" && strlen($_POST["DoStartParamWorkflow"]) > 0;
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:bizproc_start.php

示例11: array

         $arWorkflowParameters[$parameterKey] = $arResult["DocumentService"]->GetFieldInputValue($documentType, $arParameter, $parameterKey, $arRequest, $arErrorsTmp);
         if ($arParameter["Required"] && ($arParameter["Multiple"] && count($arWorkflowParameters[$parameterKey]) <= 0 || !$arParameter["Multiple"] && $arWorkflowParameters[$parameterKey] === null)) {
             $arErrorsTmp[] = array("code" => "RequiredValue", "message" => str_replace("#NAME#", $arParameter["Name"], GetMessage("BPCGWTL_INVALID81")), "parameter" => $parameterKey);
         }
         if (count($arErrorsTmp) > 0) {
             $bCanStartWorkflow = false;
             foreach ($arErrorsTmp as $e) {
                 $arResult["ErrorMessage"] .= $e["message"] . "<br />";
             }
         }
     }
 }
 if ($bCanStartWorkflow) {
     $documentId = CBPVirtualDocument::CreateDocument(0, array("IBLOCK_ID" => $arParams["BLOCK_ID"], "NAME" => GetMessage("BPWC_WRC_Z"), "CREATED_BY" => "user_" . $GLOBALS["USER"]->GetID()));
     $arErrorsTmp = array();
     $wfId = CBPDocument::StartWorkflow($workflowTemplateId, array("bizproc", "CBPVirtualDocument", $documentId), array_merge($arWorkflowParameters, array("TargetUser" => "user_" . intval($GLOBALS["USER"]->GetID()))), $arErrorsTmp);
     if (count($arErrorsTmp) > 0) {
         $arResult["ShowMode"] = "StartWorkflowError";
         foreach ($arErrorsTmp as $e) {
             $arResult["ErrorMessage"] .= "[" . $e["code"] . "] " . $e["message"] . "<br />";
         }
     } else {
         $arResult["ShowMode"] = "StartWorkflowSuccess";
         $d = CBPTaskService::GetList(array(), array("WORKFLOW_ID" => $wfId, "USER_ID" => intval($GLOBALS["USER"]->GetID())), false, false, array("ID"));
         if ($r = $d->Fetch()) {
             $backUrl = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASK"], array("task_id" => $r["ID"], "block_id" => $arParams["BLOCK_ID"]));
         } else {
             $backUrl = $arResult["BackUrl"];
         }
         LocalRedirect($backUrl);
         die;
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例12: UpdateListItems


//.........这里部分代码省略.........
                     $arFields['PROPERTY_TaskPriority'] = $arPrior[0];
                 }
                 if ($assigned_to = $arData['AssignedTo']) {
                     if ($USER_ID = $this->__getUser($assigned_to)) {
                         $arFields['PROPERTY_TaskAssignedTo'] = $USER_ID;
                     } else {
                         $obErrorCode->setData('0x81020054');
                         $bUpdate = false;
                     }
                 }
                 if ($bUpdate) {
                     $bConfirm = false;
                     $bComplete = false;
                     if ($arData['_command'] != 'New') {
                         if (false && $arElement['PROPERTY_VERSION'] > $arData['owshiddenversion']) {
                             $obErrorCode->setData('0x81020015');
                             $bUpdate = false;
                         } else {
                             foreach ($arElement as $fld => $value) {
                                 if (substr($fld, 0, 9) == 'PROPERTY_') {
                                     if (!$arFields[$fld] && $fld != 'PROPERTY_TaskFiles') {
                                         $arFields[$fld] = $arElement[$fld];
                                     }
                                 }
                             }
                             $arFields['PROPERTY_VERSION']++;
                         }
                         $statusOld = $this->__GetTaskStatus($arElement['ID'], $arElement['IBLOCK_ID']);
                     } else {
                         $arFields['PROPERTY_VERSION'] = $arData['owshiddenversion'];
                         $statusOld = -1;
                     }
                     if (!$arFields['PROPERTY_TaskPriority']) {
                         $arFields['PROPERTY_TaskPriority'] = 2;
                     }
                     if (!$arFields['PROPERTY_TaskAssignedTo']) {
                         $arFields['PROPERTY_TaskAssignedTo'] = $USER->GetID();
                     } elseif ($arFields['PROPERTY_TaskAssignedTo'] != $USER->GetID()) {
                         $arData['Status'] = 'NotAccepted';
                     }
                     $statusNew = $arData['Status'] ? $arStatusXML_ID[$arData['Status']] : $statusOld;
                     $ID = 0;
                     if ($bUpdate) {
                         $arError = false;
                         if ($arData['_command'] == 'New') {
                             if ($ID = CIntranetTasks::Add($arFields, $arError)) {
                                 $arDocumentStates = CBPDocument::GetDocumentStates(array("intranet", "CIntranetTasksDocument", "x" . $this->IBLOCK_ID), null);
                                 $arDocumentStates = array_values($arDocumentStates);
                                 $pathTemplate = str_replace(array("#USER_ID#", "#TASK_ID#"), array($USER->GetID(), "{=Document:ID}"), COption::GetOptionString("intranet", "path_task_user_entry", "/company/personal/user/#USER_ID#/tasks/task/view/#TASK_ID#/"));
                                 $arErrors = array();
                                 CBPDocument::StartWorkflow($arDocumentStates[0]["TEMPLATE_ID"], array("intranet", "CIntranetTasksDocument", $ID), array("OwnerId" => $arFields['PROPERTY_TaskAssignedTo'], "TaskType" => 'user', "PathTemplate" => $pathTemplate, "ForumId" => COption::GetOptionInt('intranet', 'task_forum_id', 0), "IBlockId" => $this->IBLOCK_ID), $arErrors);
                                 CIntranetTasks::ChangeStatus($ID, $statusNew);
                                 $arReplicationIDs[$ID] = $arData['MetaInfo_ReplicationID'];
                                 $obErrorCode->setData('0x00000000');
                             }
                         } else {
                             if (CIntranetTasks::Update($arData['ID'], $arFields, $arError)) {
                                 if ($statusOld != $statusNew) {
                                     CIntranetTasks::ChangeStatus($arData['ID'], $statusNew);
                                 }
                                 $ID = $arData['ID'];
                                 $obErrorCode->setData('0x00000000');
                             }
                         }
                         if (is_array($arError) && count($arError) > 0) {
                             $ID = 0;
                             $obErrorCode->setData('0x81020014');
                             $bUpdate = false;
                         } else {
                             $taskType = $arElement ? $arElement['taskType'] : 'user';
                             $ownerId = $arElement ? $arElement['ownerId'] : $USER->GetID();
                             $arParams = $arElement ? $arElement['arParams'] : array('PATH_TO_USER_TASKS_TASK' => str_replace(array('#USER_ID#', '#GROUP_ID#', '#TASK_ID#'), array($USER->GetID(), $arSection['XML_ID'], $ID), $arPaths['user']));
                         }
                     }
                 }
             }
         }
         if ($ID > 0) {
             $arResponseRows[$ID] = $obResponseRow;
         } else {
             $arResponseRowsError[] = $obResponseRow;
         }
     }
     $dbRes = CIntranetTasks::GetList(array('ID' => 'ASC'), array('IBLOCK_ID' => $this->IBLOCK_ID, 'ID' => array_keys($arResponseRows)));
     while ($arRes = $dbRes->Fetch()) {
         if ($arResponseRows[$arRes['ID']]) {
             $obRow = $this->__getRow($arRes, $listName, $last_change = 0);
             if ($arReplicationIDs[$arRes['ID']]) {
                 $obRow->setAttribute('ows_MetaInfo_ReplicationID', $arReplicationIDs[$arRes['ID']]);
             }
             $obRow->setAttribute('xmlns:z', "#RowsetSchema");
             $arResponseRows[$arRes['ID']]->addChild($obRow);
             $obResponse->addChild($arResponseRows[$arRes['ID']]);
         }
     }
     foreach ($arResponseRowsError as $obChange) {
         $obResponse->addChild($obChange);
     }
     return array('UpdateListItemsResult' => $obResponse);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:ws_tasks.php

示例13: array

     				$logID = CSocNetLog::Add($arSoFields, false);
     
     				if (intval($logID) > 0)
     					CSocNetLog::Update($logID, array("TMP_ID" => $logID));
     
     				CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID);
     			}
     */
 }
 if ($bBizproc) {
     if (!$strError) {
         $arBizProcWorkflowId = array();
         foreach ($arDocumentStates as $arDocumentState) {
             if (strlen($arDocumentState["ID"]) <= 0) {
                 $arErrorsTmp = array();
                 $arBizProcWorkflowId[$arDocumentState["TEMPLATE_ID"]] = CBPDocument::StartWorkflow($arDocumentState["TEMPLATE_ID"], array("iblock", "CIBlockDocument", $arResult["ELEMENT_ID"]), array_merge($arBizProcParametersValues[$arDocumentState["TEMPLATE_ID"]], array("TargetUser" => "user_" . intval($GLOBALS["USER"]->GetID()))), $arErrorsTmp);
                 foreach ($arErrorsTmp as $e) {
                     $strError .= $e["message"] . "<br />";
                 }
             }
         }
     }
     if (!$strError) {
         $bizprocIndex = intval($_REQUEST["bizproc_index"]);
         if ($bizprocIndex > 0) {
             for ($i = 1; $i <= $bizprocIndex; $i++) {
                 $bpId = trim($_REQUEST["bizproc_id_" . $i]);
                 $bpTemplateId = intval($_REQUEST["bizproc_template_id_" . $i]);
                 $bpEvent = trim($_REQUEST["bizproc_event_" . $i]);
                 if (strlen($bpEvent) > 0) {
                     if (strlen($bpId) > 0) {
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:31,代码来源:component.php

示例14: array

 }
 if (CModule::IncludeModule('bizproc')) {
     if (CBPDocument::GetNumberOfWorkflowTemplatesForDocumentType(array("iblock", "CIBlockDocument", "iblock_" . $IBLOCK_ID)) <= 0) {
         CBPDocument::AddDefaultWorkflowTemplates(array("iblock", "CIBlockDocument", "iblock_" . $IBLOCK_ID));
     }
     $TEMPLATE_ID = 0;
     $dbWorkflowTemplate = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => array("iblock", "CIBlockDocument", "iblock_" . $IBLOCK_ID), "SYSTEM_CODE" => "status.php", "ACTIVE" => "Y"), false, false, array("ID"));
     if ($arWorkflowTemplate = $dbWorkflowTemplate->Fetch()) {
         $TEMPLATE_ID = $arWorkflowTemplate["ID"];
     }
     $arElement = array("IBLOCK_ID" => $IBLOCK_ID, "NAME" => GetMessage("DEMO_IBLOCK_CONTENT_ARTICLES_NAME"), "PREVIEW_TEXT" => GetMessage("DEMO_IBLOCK_CONTENT_ARTICLES_PREVIEW_TEXT"), "WF_STATUS_ID" => 2, "WF_NEW" => "Y", "PROPERTY_VALUES" => array("KEYWORDS" => GetMessage("DEMO_IBLOCK_CONTENT_ARTICLES_KEYWORDS"), "THEMES" => 4));
     $obElement = new CIBlockElement();
     $element_id = $obElement->Add($arElement);
     if ($element_id && $TEMPLATE_ID > 0) {
         $arErrorsTmp = array();
         $bpId = CBPDocument::StartWorkflow($TEMPLATE_ID, array("iblock", "CIBlockDocument", $element_id), array("Creators" => array("author"), "Approvers" => array(1)), $arErrorsTmp);
         if (count($arErrorsTmp) <= 0) {
             $arDocumentStates = CBPDocument::GetDocumentStates(array("iblock", "CIBlockDocument", "iblock_" . $IBLOCK_ID), array("iblock", "CIBlockDocument", $element_id));
             $arCurrentUserGroups = $GLOBALS["USER"]->GetUserGroupArray();
             $arCurrentUserGroups[] = "Author";
             $arEvents = CBPDocument::GetAllowableEvents($GLOBALS["USER"]->GetID(), $arCurrentUserGroups, array_pop($arDocumentStates));
             CBPDocument::SendExternalEvent($bpId, $arEvents[0]["NAME"], array("Groups" => $arCurrentUserGroups, "User" => $GLOBALS["USER"]->GetID()), $arErrorTmp);
         }
     }
 }
 //Include language one more time (after forum creation)
 __IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/" . basename(__FILE__)));
 //Create directory and copy files
 $search = array("#IBLOCK.ID(XML_ID=content-articles)#", "#IBLOCK.ID(XML_ID=content-news)#", "#MODULE.INSTALLED(ID=forum)#", "#FORUM.ID(NAME=content-articles)#");
 $replace = array($IBLOCK_ID, CIBlockCMLImport::GetIBlockByXML_ID("content-news"), IsModuleInstalled("forum") ? "Y" : "N", $arForum["ID"]);
 DEMO_IBlock_CopyFiles("/public/content/articles/", "/content/articles/", false, $search, $replace);
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:content-articles.php

示例15: StartWorkflowsExecuting

 /**
  * Метод - просто агрегатор действий, запускающий БП и выполняющий события
  *
  * @param string $documentId - код документа.
  * @param array $arDocumentStates - массив шаблонов БП документа.
  * @param array $arBizProcParametersValues - массив входных параметров для шаблонов.
  * @param array $arUserGroups - массив групп пользователей.
  * @param array $arErrors - массив ошибок.
  */
 public function StartWorkflowsExecuting($documentId, $arDocumentStates, $arBizProcParametersValues, $arUserGroups, &$arErrors)
 {
     $documentId = $documentId;
     $arErrors = array();
     $arBizProcWorkflowId = array();
     $arDocumentStates = is_array($arDocumentStates) ? $arDocumentStates : array();
     $arBizProcParametersValues = is_array($arBizProcParametersValues) ? $arBizProcParametersValues : array();
     $arUserGroups = is_array($arUserGroups) ? $arUserGroups : array();
     foreach ($arDocumentStates as $arDocumentState) {
         if (strlen($arDocumentState["ID"]) <= 0) {
             $arErrorsTmp = array();
             $arBizProcWorkflowId[$arDocumentState["TEMPLATE_ID"]] = CBPDocument::StartWorkflow($arDocumentState["TEMPLATE_ID"], $documentId, $arBizProcParametersValues[$arDocumentState["TEMPLATE_ID"]], $arErrorsTmp);
             foreach ($arErrorsTmp as $e) {
                 $arError[] = array("id" => "bizproc_start_workflow", "text" => $e["message"]);
             }
         }
     }
     if (empty($arError) && intval($_REQUEST["bizproc_index"]) > 0) {
         if (empty($arUserGroups)) {
             $arUserGroups = call_user_func_array(array($this->wfParams['DOCUMENT_TYPE'][1], "GetUserGroups"), array(null, $documentId, $GLOBALS["USER"]->GetID()));
         }
         $bizprocIndex = intval($_REQUEST["bizproc_index"]);
         for ($i = 1; $i <= $bizprocIndex; $i++) {
             $bpId = trim($_REQUEST["bizproc_id_" . $i]);
             $bpTemplateId = intval($_REQUEST["bizproc_template_id_" . $i]);
             $bpEvent = trim($_REQUEST["bizproc_event_" . $i]);
             if (strlen($bpEvent) > 0) {
                 if (strlen($bpId) > 0) {
                     if (!array_key_exists($bpId, $arDocumentStates)) {
                         continue;
                     }
                 } else {
                     if (!array_key_exists($bpTemplateId, $arDocumentStates)) {
                         continue;
                     }
                     $bpId = $arBizProcWorkflowId[$bpTemplateId];
                 }
                 $arErrorTmp = array();
                 CBPDocument::SendExternalEvent($bpId, $bpEvent, array("Groups" => $arUserGroups, "User" => $GLOBALS["USER"]->GetID()), $arErrorTmp);
                 foreach ($arErrorsTmp as $e) {
                     $arError[] = array("id" => "bizproc_send_external_event", "text" => $e["message"]);
                 }
             }
         }
     }
     return empty($arError);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:56,代码来源:iblockbizproc.php


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