Example #1
0
 public function startTaskEndProcessToBpmnEvent($objectBpmnType, $objectUid, $objectBouX, $objectBouY, $objectBouWidth, $objectBouHeight, $eventName, $eventType, $condition = "")
 {
     try {
         $eventBouWidth = 35;
         $eventBouHeight = $eventBouWidth;
         $eventBouWidth2 = (int) ($eventBouWidth / 2);
         $eventBouHeight2 = (int) ($eventBouHeight / 2);
         $eventBouHeight12 = (int) ($eventBouWidth / 12);
         //
         $objectBouWidth2 = (int) ($objectBouWidth / 2);
         $objectBouWidth4 = (int) ($objectBouWidth / 4);
         //Event
         if ($objectBpmnType == "bpmnGateway" && $eventType == "END") {
             //Gateway
             $eventBouX = $objectBouX + $objectBouWidth + $objectBouWidth4;
             $eventBouY = $objectBouY + (int) ($objectBouHeight / 2) - $eventBouHeight2;
         } else {
             //Activity
             $eventBouX = $objectBouX + $objectBouWidth2 - $eventBouWidth2;
             $eventBouY = $eventType == "START" ? $objectBouY - $eventBouHeight - $eventBouHeight2 : $objectBouY + $objectBouHeight + $eventBouHeight2 + $eventBouHeight12;
         }
         $arrayData = array("EVN_NAME" => $eventName, "EVN_TYPE" => $eventType, "EVN_MARKER" => "EMPTY", "BOU_X" => $eventBouX, "BOU_Y" => $eventBouY, "BOU_WIDTH" => $eventBouWidth, "BOU_HEIGHT" => $eventBouHeight);
         $eventUid = $this->bp->addEvent($arrayData);
         //Flow
         if ($objectBpmnType == "bpmnGateway" && $eventType == "END") {
             //Gateway
             $flowX1 = $objectBouX + $objectBouWidth;
             $flowY1 = $objectBouY + (int) ($objectBouHeight / 2);
             $flowX2 = $eventBouX;
             $flowY2 = $eventBouY + $eventBouHeight2;
         } else {
             //Activity
             $flowX1 = $objectBouX + $objectBouWidth2;
             $flowY1 = $eventType == "START" ? $objectBouY - $eventBouHeight + $eventBouHeight2 : $objectBouY + $objectBouHeight;
             $flowX2 = $flowX1;
             $flowY2 = $eventType == "START" ? $objectBouY : $objectBouY + $objectBouHeight + $eventBouHeight2 + $eventBouHeight12;
         }
         $arrayData = array("FLO_TYPE" => "SEQUENCE", "FLO_ELEMENT_ORIGIN" => $eventType == "START" ? $eventUid : $objectUid, "FLO_ELEMENT_ORIGIN_TYPE" => $eventType == "START" ? "bpmnEvent" : $objectBpmnType, "FLO_ELEMENT_DEST" => $eventType == "START" ? $objectUid : $eventUid, "FLO_ELEMENT_DEST_TYPE" => $eventType == "START" ? $objectBpmnType : "bpmnEvent", "FLO_IS_INMEDIATE" => 1, "FLO_CONDITION" => $condition, "FLO_X1" => $flowX1, "FLO_Y1" => $flowY1, "FLO_X2" => $flowX2, "FLO_Y2" => $flowY2, "FLO_STATE" => json_encode(array(array("x" => $flowX1, "y" => $flowY1), array("x" => $flowX1, "y" => $flowY2 - 5), array("x" => $flowX2, "y" => $flowY2 - 5), array("x" => $flowX2, "y" => $flowY2))));
         $flowUid = $this->bp->addFlow($arrayData);
         //Return
         return $eventUid;
     } catch (\Exception $e) {
         throw $e;
     }
 }
Example #2
0
    public function addEvent($data)
    {
        if (! array_key_exists("EVN_TYPE", $data)) {
            throw new \RuntimeException("Required param \"EVN_TYPE\" is missing.");
        }

        $eventUid = parent::addEvent($data);
        $event = \BpmnEventPeer::retrieveByPK($eventUid);

        //// create case scheduler
        //if ($event && $event->getEvnMarker() == "TIMER" && $event->getEvnType() == "START") {
        //    $this->wp->addCaseScheduler($eventUid);
        //}
        //
        //// create web entry
        //if ($event && $event->getEvnMarker() == "MESSAGE" && $event->getEvnType() == "START") {
        //    $this->wp->addWebEntry($eventUid);
        //}

        return $eventUid;
    }