public function addTask(array $arrayTaskData) { try { //Task $taskUid = parent::addTask($arrayTaskData); //BPMN //Activity $arrayActivityType = array( "NORMAL" => "TASK", "ADHOC" => "TASK", "SUBPROCESS" => "SUB_PROCESS" ); $activityBouX = (int)($arrayTaskData["TAS_POSX"]); $activityBouY = (int)($arrayTaskData["TAS_POSY"]); $activityBouWidth = (int)($arrayTaskData["TAS_WIDTH"]); $activityBouHeight = (int)($arrayTaskData["TAS_HEIGHT"]); $arrayData = array( "ACT_UID" => $taskUid, "ACT_NAME" => $arrayTaskData["TAS_TITLE"], "ACT_TYPE" => $arrayActivityType[$arrayTaskData["TAS_TYPE"]], "BOU_X" => $activityBouX, "BOU_Y" => $activityBouY, "BOU_WIDTH" => $activityBouWidth, "BOU_HEIGHT" => $activityBouHeight ); $activityUid = $this->bp->addActivity($arrayData); if ($arrayTaskData["TAS_START"] == "TRUE") { $eventUid = $this->startTaskEndProcessToBpmnEvent( "bpmnActivity", $activityUid, $activityBouX, $activityBouY, $activityBouWidth, $activityBouHeight, "", "START" ); } //Return return $taskUid; } catch (\Exception $e) { throw $e; } }
public function createTaskByElement($elementUid, $elementType, $key) { try { if (isset($this->arrayElementTaskRelation[$elementUid])) { $taskUid = $this->arrayElementTaskRelation[$elementUid]; } else { $taskPosX = 0; $taskPosY = 0; $flow = \BpmnFlow::findOneBy(array( \BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $elementUid, \BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => $elementType )); if (!is_null($flow)) { $arrayFlowData = $flow->toArray(); $taskPosX = (int)($arrayFlowData["FLO_X1"]); $taskPosY = (int)($arrayFlowData["FLO_Y1"]); } else { $flow = \BpmnFlow::findOneBy(array( \BpmnFlowPeer::FLO_ELEMENT_DEST => $elementUid, \BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE => $elementType )); if (!is_null($flow)) { $arrayFlowData = $flow->toArray(); $taskPosX = (int)($arrayFlowData["FLO_X2"]); $taskPosY = (int)($arrayFlowData["FLO_Y2"]); } } $prefix = $this->arrayTaskAttribute[$key]["prefix"]; $taskType = $this->arrayTaskAttribute[$key]["type"]; $taskUid = $this->wp->addTask(array( "TAS_UID" => $prefix . substr(Util\Common::generateUID(), (32 - strlen($prefix)) * -1), "TAS_TYPE" => $taskType, "TAS_TITLE" => $taskType, "TAS_POSX" => $taskPosX, "TAS_POSY" => $taskPosY )); if ($elementType == "bpmnEvent" && in_array($key, array("end-message-event", "start-message-event", "intermediate-catch-message-event")) ) { if (in_array($key, array("start-message-event", "intermediate-catch-message-event"))) { //Task - User //Assign to admin $task = new \Tasks(); $result = $task->assignUser($taskUid, "00000000000000000000000000000001", 1); } } //Element-Task-Relation - Create $elementTaskRelation = new \ProcessMaker\BusinessModel\ElementTaskRelation(); $arrayResult = $elementTaskRelation->create( $this->wp->getUid(), array( "ELEMENT_UID" => $elementUid, "ELEMENT_TYPE" => $elementType, "TAS_UID" => $taskUid ) ); //Array - Add element $this->arrayElementTaskRelation[$elementUid] = $taskUid; } //Return return $taskUid; } catch (\Exception $e) { throw $e; } }