本文整理汇总了PHP中Cases::executeTriggers方法的典型用法代码示例。如果您正苦于以下问题:PHP Cases::executeTriggers方法的具体用法?PHP Cases::executeTriggers怎么用?PHP Cases::executeTriggers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cases
的用法示例。
在下文中一共展示了Cases::executeTriggers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newCase
/**
* new Case begins a new case under the name of the logged-in user.
*
* @param string $processId
* @param string $userId
* @param string $taskId
* @param string $variables
* @param int $executeTriggers : Optional parameter. The execution all triggers of the task, according to your steps, 1 yes 0 no.
* @return $result will return an object
*/
public function newCase($processId, $userId, $taskId, $variables, $executeTriggers = 0)
{
//$executeTriggers, this parameter is not important, it may be the last parameter in the method
$g = new G();
try {
$g->sessionVarSave();
$_SESSION["PROCESS"] = $processId;
$_SESSION["TASK"] = $taskId;
$_SESSION["USER_LOGGED"] = $userId;
$Fields = array ();
if (is_array( $variables ) && count( $variables ) > 0) {
$Fields = $variables;
}
$oProcesses = new Processes();
$pro = $oProcesses->processExists( $processId );
if (! $pro) {
$result = new wsResponse( 11, G::loadTranslation( 'ID_INVALID_PROCESS' ) . " " . $processId );
$g->sessionVarRestore();
return $result;
}
$oCase = new Cases();
$startingTasks = $oCase->getStartCases( $userId );
array_shift( $startingTasks ); //remove the first row, the header row
$founded = '';
$tasksInThisProcess = 0;
$validTaskId = $taskId;
foreach ($startingTasks as $key => $val) {
if ($val['pro_uid'] == $processId) {
$tasksInThisProcess ++;
//.........这里部分代码省略.........
示例2: addCasesInputDocument
/**
* Get data of Cases InputDocument
*
* @param string $applicationUid
* @param string $taskUid
* @param string $appDocComment
* @param string $inputDocumentUid
* @param string $userUid
*
* return array Return an array with data of an InputDocument
*/
public function addCasesInputDocument($applicationUid, $taskUid, $appDocComment, $inputDocumentUid, $userUid)
{
try {
if ((isset( $_FILES['form'] )) && ($_FILES['form']['error'] != 0)) {
$code = $_FILES['form']['error'];
switch ($code) {
case UPLOAD_ERR_INI_SIZE:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_INI_SIZE' );
break;
case UPLOAD_ERR_FORM_SIZE:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_FORM_SIZE' );
break;
case UPLOAD_ERR_PARTIAL:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_PARTIAL' );
break;
case UPLOAD_ERR_NO_FILE:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_NO_FILE' );
break;
case UPLOAD_ERR_NO_TMP_DIR:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_NO_TMP_DIR' );
break;
case UPLOAD_ERR_CANT_WRITE:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_CANT_WRITE' );
break;
case UPLOAD_ERR_EXTENSION:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_EXTENSION' );
break;
default:
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_UNKNOWN' );
break;
}
\G::SendMessageText( $message, "ERROR" );
$backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] );
\G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] );
die();
}
\G::LoadClass("case");
$appDocUid = \G::generateUniqueID();
$docVersion = '';
$appDocType = 'INPUT';
$case = new \Cases();
$delIndex = \AppDelegation::getCurrentIndex($applicationUid);
$case->thisIsTheCurrentUser($applicationUid, $delIndex, $userUid, "REDIRECT", "casesListExtJs");
//Load the fields
$arrayField = $case->loadCase($applicationUid);
$arrayField["APP_DATA"] = array_merge($arrayField["APP_DATA"], \G::getSystemConstants());
//Triggers
$arrayTrigger = $case->loadTriggers($taskUid, "INPUT_DOCUMENT", $inputDocumentUid, "AFTER");
//Add Input Document
if (empty($_FILES)) {
throw new \Exception(\G::LoadTranslation("ID_CASES_INPUT_FILENAME_DOES_NOT_EXIST"));
}
if (!$_FILES["form"]["error"]) {
$_FILES["form"]["error"] = 0;
}
if (isset($_FILES) && isset($_FILES["form"]) && count($_FILES["form"]) > 0) {
$appDocUid = $case->addInputDocument($inputDocumentUid,
$appDocUid,
$docVersion,
$appDocType,
$appDocComment,
'',
$applicationUid,
$delIndex,
$taskUid,
$userUid,
"xmlform",
$_FILES["form"]["name"],
$_FILES["form"]["error"],
$_FILES["form"]["tmp_name"]);
}
//Trigger - Execute after - Start
$arrayField["APP_DATA"] = $case->executeTriggers ($taskUid,
"INPUT_DOCUMENT",
$inputDocumentUid,
"AFTER",
$arrayField["APP_DATA"]);
//Trigger - Execute after - End
//Save data
$arrayData = array();
$arrayData["APP_NUMBER"] = $arrayField["APP_NUMBER"];
//$arrayData["APP_PROC_STATUS"] = $arrayField["APP_PROC_STATUS"];
$arrayData["APP_DATA"] = $arrayField["APP_DATA"];
$arrayData["DEL_INDEX"] = $delIndex;
$arrayData["TAS_UID"] = $taskUid;
$case->updateCase($applicationUid, $arrayData);
return($this->getCasesInputDocument($applicationUid, $userUid, $appDocUid));
} catch (\Exception $e) {
throw $e;
//.........这里部分代码省略.........
示例3: array
$_SESSION["TRIGGER_DEBUG"]["DATA"] = array();
$_SESSION["TRIGGER_DEBUG"]["TRIGGERS_NAMES"] = array();
$_SESSION["TRIGGER_DEBUG"]["TRIGGERS_VALUES"] = array();
$_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] = count($arrayTrigger);
$_SESSION["TRIGGER_DEBUG"]["TIME"] = "AFTER";
if ($_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] > 0) {
$_SESSION["TRIGGER_DEBUG"]["TRIGGERS_NAMES"] = $case->getTriggerNames($arrayTrigger);
$_SESSION["TRIGGER_DEBUG"]["TRIGGERS_VALUES"] = $arrayTrigger;
}
//Add Input Document
if (isset($_FILES) && isset($_FILES["form"]) && count($_FILES["form"]) > 0) {
$appDocUid = $case->addInputDocument($inputDocumentUid, $appDocUid, $docVersion, $appDocType, $appDocComment, $actionType, $_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["TASK"], $_SESSION["USER_LOGGED"], "xmlform", $_FILES["form"]["name"]["APP_DOC_FILENAME"], $_FILES["form"]["error"]["APP_DOC_FILENAME"], $_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"]);
}
if ($_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] > 0) {
//Trigger - Execute after - Start
$arrayField["APP_DATA"] = $case->executeTriggers($_SESSION["TASK"], "INPUT_DOCUMENT", $inputDocumentUid, "AFTER", $arrayField["APP_DATA"]);
//Trigger - Execute after - End
}
//Save data
$arrayData = array();
$arrayData["APP_NUMBER"] = $arrayField["APP_NUMBER"];
//$arrayData["APP_PROC_STATUS"] = $arrayField["APP_PROC_STATUS"];
$arrayData["APP_DATA"] = $arrayField["APP_DATA"];
$arrayData["DEL_INDEX"] = $_SESSION["INDEX"];
$arrayData["TAS_UID"] = $_SESSION["TASK"];
$case->updateCase($_SESSION["APPLICATION"], $arrayData);
//go to the next step
//if (!isset($_POST['form']['MORE'])) {
if (false) {
$aNextStep = $case->getNextStep($_SESSION["PROCESS"], $_SESSION["APPLICATION"], $_SESSION["INDEX"], $_SESSION["STEP_POSITION"]);
$_SESSION['STEP_POSITION'] = $aNextStep['POSITION'];