Example #1
0
 public function startNextStepsOrComplete()
 {
     //if there are next steps, start them
     $nextStepArray = $this->getNextSteps();
     if (count($nextStepArray) > 0) {
         foreach ($nextStepArray as $nextResourceStep) {
             $nextResourceStep->startStep();
         }
     }
     //check if this branch is complete or if there are still other steps open
     if ($this->getNumberOfOpenSteps() == 0) {
         //if there are no more steps then we can mark the resource complete
         $resource = new Resource(new NamedArguments(array('primaryKey' => $this->resourceID)));
         $resource->completeWorkflow();
     }
 }
Example #2
0
 public function completeStep()
 {
     //mark this step complete
     $this->stepEndDate = date('Y-m-d');
     $this->endLoginID = $_SESSION['loginID'];
     $this->save;
     //if there are next steps, start them
     $nextStepArray = $this->getNextSteps();
     if (count($nextStepArray) > 0) {
         foreach ($nextStepArray as $nextResourceStep) {
             $nextResourceStep->startStep();
         }
     } else {
         //check if it just means that this branch is complete and there are still other steps open
         if ($this->getNumberOfOpenSteps() == 0) {
             //otherwise if there are no more steps then we can mark the resource complete
             $resource = new Resource(new NamedArguments(array('primaryKey' => $this->resourceID)));
             $resource->completeWorkflow();
         }
     }
 }
<?php

if ($_GET['resourceID']) {
    $resourceID = $_GET['resourceID'];
    $resource = new Resource(new NamedArguments(array('primaryKey' => $resourceID)));
    //log who set off the completion
    $resource->workflowRestartLoginID = $loginID;
    $resource->workflowRestartDate = date('Y-m-d');
    try {
        $resource->save();
        //updates status and sends notification
        $resource->completeWorkflow();
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}