本文整理汇总了PHP中Tasks::assignUsertoTask方法的典型用法代码示例。如果您正苦于以下问题:PHP Tasks::assignUsertoTask方法的具体用法?PHP Tasks::assignUsertoTask怎么用?PHP Tasks::assignUsertoTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tasks
的用法示例。
在下文中一共展示了Tasks::assignUsertoTask方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Task
$sWS_ROUNDROBIN = $oData->WS_ROUNDROBIN;
$sWE_USR = $oData->WE_USR;
$withWS = $sWE_TYPE == 'WS';
G::LoadClass("system");
try {
$pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP;
G::mk_dir($pathProcess, 0777);
$oTask = new Task();
$TaskFields = $oTask->load($sTASKS);
$WE_EVN_UID = $oTask->getStartingEvent($sTASKS);
if ($TaskFields['TAS_ASSIGN_TYPE'] != 'BALANCED') {
throw new Exception("The task '" . $TaskFields['TAS_TITLE'] . "' doesn't have a valid assignment type. The task needs to have a 'Cyclical Assignment'.");
}
G::LoadClass('tasks');
$oTask = new Tasks();
$user = $oTask->assignUsertoTask($sTASKS);
if ($user == 0) {
throw new Exception(G::LoadTranslation('ID_TASK') . "'" . $TaskFields['TAS_TITLE'] . "'" . G::LoadTranslation('ID_NOT_HAVE_USERS'));
}
$http = G::is_https() ? "https://" : "http://";
$sContent = '';
$infoProcess = new Process();
$resultProcess = $infoProcess->load($sPRO_UID);
if ($withWS) {
//creating sys.info;
$SITE_PUBLIC_PATH = '';
if (file_exists($SITE_PUBLIC_PATH . '')) {
}
//creating the first file
require_once 'classes/model/Dynaform.php';
$oDynaform = new Dynaform();
示例2: throwExceptionIfDataIsInvalid
/**
* Validate the data if they are invalid (INSERT and UPDATE)
*
* @param string $webEntryUid Unique id of Web Entry
* @param string $processUid Unique id of Process
* @param array $arrayData Data
*
* return void Throw exception if data has an invalid value
*/
public function throwExceptionIfDataIsInvalid($webEntryUid, $processUid, array $arrayData)
{
try {
//Set variables
$arrayWebEntryData = $webEntryUid == "" ? array() : $this->getWebEntry($webEntryUid, true);
$flagInsert = $webEntryUid == "" ? true : false;
$arrayDataMain = array_merge($arrayWebEntryData, $arrayData);
//Verify data - Field definition
$process = new \ProcessMaker\BusinessModel\Process();
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, $flagInsert);
if ($arrayDataMain["WE_METHOD"] == "WS") {
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayUserFieldDefinition, $this->arrayFieldNameForException, $flagInsert);
}
//Verify data
if (isset($arrayData["WE_TITLE"])) {
$this->throwExceptionIfExistsTitle($processUid, $arrayData["WE_TITLE"], $this->arrayFieldNameForException["webEntryTitle"], $webEntryUid);
}
if (isset($arrayData["TAS_UID"])) {
$task = new \ProcessMaker\BusinessModel\Task();
$task->throwExceptionIfNotExistsTask($processUid, $arrayData["TAS_UID"], $this->arrayFieldNameForException["taskUid"]);
}
if (isset($arrayData["DYN_UID"])) {
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
$dynaForm->throwExceptionIfNotExistsDynaForm($arrayData["DYN_UID"], $processUid, $this->arrayFieldNameForException["dynaFormUid"]);
}
if ($arrayDataMain["WE_METHOD"] == "WS" && isset($arrayData["USR_UID"])) {
$process->throwExceptionIfNotExistsUser($arrayData["USR_UID"], $this->arrayFieldNameForException["userUid"]);
}
$task = new \Task();
$arrayTaskData = $task->load($arrayDataMain["TAS_UID"]);
if (isset($arrayData["TAS_UID"])) {
if ($arrayTaskData["TAS_START"] == "FALSE") {
throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_IS_NOT_INITIAL_ACTIVITY", array($arrayTaskData["TAS_TITLE"])));
}
if ($arrayTaskData["TAS_ASSIGN_TYPE"] != "BALANCED") {
throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_ACTIVITY_DOES_NOT_HAVE_VALID_ASSIGNMENT_TYPE", array($arrayTaskData["TAS_TITLE"])));
}
}
if ($arrayDataMain["WE_METHOD"] == "WS" && isset($arrayData["TAS_UID"])) {
$task = new \Tasks();
if ($task->assignUsertoTask($arrayData["TAS_UID"]) == 0) {
throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_HAVE_USERS", array($arrayTaskData["TAS_TITLE"])));
}
}
if (isset($arrayData["DYN_UID"])) {
$dynaForm = new \Dynaform();
$arrayDynaFormData = $dynaForm->Load($arrayData["DYN_UID"]);
$step = new \ProcessMaker\BusinessModel\Step();
if (!$step->existsRecord($arrayDataMain["TAS_UID"], "DYNAFORM", $arrayData["DYN_UID"])) {
throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_IS_NOT_ASSIGNED_TO_ACTIVITY", array($arrayDynaFormData["DYN_TITLE"], $arrayTaskData["TAS_TITLE"])));
}
}
if ($arrayDataMain["WE_METHOD"] == "WS" && isset($arrayData["USR_UID"])) {
$user = new \Users();
$arrayUserData = $user->load($arrayData["USR_UID"]);
//Verify if User is assigned to Task
$projectUser = new \ProcessMaker\BusinessModel\ProjectUser();
if (!$projectUser->userIsAssignedToTask($arrayData["USR_UID"], $arrayDataMain["TAS_UID"])) {
throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_HAVE_ACTIVITY_ASSIGNED", array($arrayUserData["USR_USERNAME"], $arrayTaskData["TAS_TITLE"])));
}
}
} catch (\Exception $e) {
throw $e;
}
}