本文整理汇总了PHP中CBPRuntime::SendExternalEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPRuntime::SendExternalEvent方法的具体用法?PHP CBPRuntime::SendExternalEvent怎么用?PHP CBPRuntime::SendExternalEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPRuntime
的用法示例。
在下文中一共展示了CBPRuntime::SendExternalEvent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnEvent
public static function OnEvent($workflowId, $eventName, $arEventParameters = array())
{
$num = func_num_args();
if ($num > 3) {
for ($i = 3; $i < $num; $i++) {
$arEventParameters[] = func_get_arg($i);
}
}
if ($arEventParameters["EntityId"] != null && $arEventParameters["EntityId"] != $arEventParameters[0]) {
return;
}
try {
CBPRuntime::SendExternalEvent($workflowId, $eventName, $arEventParameters);
} catch (Exception $e) {
}
}
示例2: OnUnlockDocument
public static function OnUnlockDocument($workflowId, $eventName, $documentId = array())
{
CBPRuntime::SendExternalEvent($workflowId, $eventName, array());
}
示例3: PostTaskForm
public static function PostTaskForm($arTask, $userId, $arRequest, &$arErrors, $userName = "", $realUserId = null)
{
$arErrors = array();
try {
$userId = intval($userId);
if ($userId <= 0) {
throw new CBPArgumentNullException("userId");
}
$arEventParameters = array("USER_ID" => $userId, "REAL_USER_ID" => $realUserId, "USER_NAME" => $userName, "COMMENT" => isset($arRequest["task_comment"]) ? $arRequest["task_comment"] : '');
if (isset($arRequest['INLINE_USER_STATUS']) && $arRequest['INLINE_USER_STATUS'] != CBPTaskUserStatus::Ok) {
throw new CBPNotSupportedException(GetMessage("BPAA_ACT_NO_ACTION"));
}
CBPRuntime::SendExternalEvent($arTask["WORKFLOW_ID"], $arTask["ACTIVITY_NAME"], $arEventParameters);
return true;
} catch (Exception $e) {
$arErrors[] = array("code" => $e->getCode(), "message" => $e->getMessage(), "file" => $e->getFile() . " [" . $e->getLine() . "]");
}
return false;
}
示例4: PostTaskForm
public static function PostTaskForm($arTask, $userId, $arRequest, &$arErrors, $userName = "", $realUserId = null)
{
$arErrors = array();
$runtime = CBPRuntime::GetRuntime();
$runtime->StartRuntime();
$documentService = $runtime->GetService("DocumentService");
try {
$userId = intval($userId);
if ($userId <= 0) {
throw new CBPArgumentNullException("userId");
}
$arEventParameters = array("USER_ID" => $userId, "REAL_USER_ID" => $realUserId, "USER_NAME" => $userName, "COMMENT" => $arRequest["task_comment"], "RESPONCE" => array());
if ($arTask["PARAMETERS"] && is_array($arTask["PARAMETERS"]) && count($arTask["PARAMETERS"]) > 0 && $arTask["PARAMETERS"]["REQUEST"] && is_array($arTask["PARAMETERS"]["REQUEST"]) && count($arTask["PARAMETERS"]["REQUEST"]) > 0) {
$arRequest = $_REQUEST;
foreach ($_FILES as $k => $v) {
if (array_key_exists("name", $v)) {
if (is_array($v["name"])) {
$ks = array_keys($v["name"]);
for ($i = 0, $cnt = count($ks); $i < $cnt; $i++) {
$ar = array();
foreach ($v as $k1 => $v1) {
$ar[$k1] = $v1[$ks[$i]];
}
$arRequest[$k][] = $ar;
}
} else {
$arRequest[$k] = $v;
}
}
}
foreach ($arTask["PARAMETERS"]["REQUEST"] as $parameter) {
$arErrorsTmp = array();
$arEventParameters["RESPONCE"][$parameter["Name"]] = $documentService->GetFieldInputValue($arTask["PARAMETERS"]["DOCUMENT_TYPE"], $parameter, $parameter["Name"], $arRequest, $arErrorsTmp);
if (count($arErrorsTmp) > 0) {
$m = "";
foreach ($arErrorsTmp as $e) {
$m .= $e["message"] . "<br />";
}
throw new CBPArgumentException($m);
}
if (CBPHelper::getBool($parameter['Required']) && CBPHelper::isEmptyValue($arEventParameters['RESPONCE'][$parameter['Name']])) {
throw new CBPArgumentNullException($parameter["Name"], str_replace("#PARAM#", htmlspecialcharsbx($parameter["Title"]), GetMessage("BPRIA_ARGUMENT_NULL")));
}
}
}
CBPRuntime::SendExternalEvent($arTask["WORKFLOW_ID"], $arTask["ACTIVITY_NAME"], $arEventParameters);
return true;
} catch (Exception $e) {
$arErrors[] = array("code" => $e->getCode(), "message" => $e->getMessage(), "file" => $e->getFile() . " [" . $e->getLine() . "]");
}
return false;
}
示例5: PostTaskForm
public static function PostTaskForm($arTask, $userId, $arRequest, &$arErrors, $userName = "")
{
$arErrors = array();
try {
$userId = intval($userId);
if ($userId <= 0) {
throw new CBPArgumentNullException("userId");
}
$arEventParameters = array("USER_ID" => $userId, "USER_NAME" => $userName, "COMMENT" => $arRequest["task_comment"]);
if (strlen($arRequest["approve"]) > 0) {
$arEventParameters["APPROVE"] = true;
} elseif (strlen($arRequest["nonapprove"]) > 0) {
$arEventParameters["APPROVE"] = false;
} else {
throw new CBPNotSupportedException(GetMessage("BPAA_ACT_NO_ACTION"));
}
CBPRuntime::SendExternalEvent($arTask["WORKFLOW_ID"], $arTask["ACTIVITY_NAME"], $arEventParameters);
return true;
} catch (Exception $e) {
$arErrors[] = array("code" => $e->getCode(), "message" => $e->getMessage(), "file" => $e->getFile() . " [" . $e->getLine() . "]");
}
return false;
}
示例6: SendExternalEvent
/**
* Метод отправляет событие рабочему потоку.
*
* @param string $workflowId - код рабочего потока.
* @param string $workflowEvent - событие.
* @param array $arParameters - параметры события.
* @param array $arErrors - массив ошибок, которые произошли при отправке события в виде array(array("code" => код_ошибки, "message" => сообщение, "file" => путь_к_файлу), ...).
*/
public function SendExternalEvent($workflowId, $workflowEvent, $arParameters, &$arErrors)
{
$arErrors = array();
try
{
CBPRuntime::SendExternalEvent($workflowId, $workflowEvent, $arParameters);
}
catch(Exception $e)
{
$arErrors[] = array(
"code" => $e->getCode(),
"message" => $e->getMessage(),
"file" => $e->getFile()." [".$e->getLine()."]"
);
}
}