Esempio n. 1
0
 /**
  * @return array of actionPackets
  * @param $planList Array of graphNodes
  * @desc Returns the next actions and the plans associated with them
  */
 function findNextActions($planList, $updateHistory)
 {
     $currentActions = array();
     $planListSize = sizeof($planList);
     for ($index = 0; $index < $planListSize; $index++) {
         //At the goal state we will stop generating nextNodes
         if ($planList[$index]->getCurrentNode()) {
             $packet = new actionPacket($planList[$index]->getCurrentNode());
             if ($updateHistory) {
                 //Note progression along the graph
                 $planList[$index]->progress();
             } else {
                 $planList[$index]->progressWithoutHistory();
             }
             $packet->addPlan($planList[$index]);
             array_push($currentActions, $packet);
         }
     }
     return $currentActions;
 }
Esempio n. 2
0
    /**
     * @return void
     * @param CoreWorkflowDatPacket $coreWorkflowDataPacket
     * @desc Displays the HTML for the each workflow item
    */
    function html_displayXML($coreWorkflowDataPacket)
    {
        $tdClass = 'helpBod';
        $planGroups = array();
        $formName = '';
        workflowDisplayHTML::workflowState($coreWorkflowDataPacket->getWorkflowId(), $coreWorkflowDataPacket->getData(), false);
        //Fetch plans from the database
        $planGraphList = graphPlanDatabaseAccess::getPlanGraphList($coreWorkflowDataPacket->getworkflowid());
        $possibleActions = actionPacket::processLoop($planGraphList, $coreWorkflowDataPacket->getworkflowid());
        if (sizeof($possibleActions)) {
            //Actions have been fouund
            $possibleActionsSize = sizeof($possibleActions);
            for ($actionPacketIndex = 0; $actionPacketIndex < $possibleActionsSize; $actionPacketIndex++) {
                $currentAction = $possibleActions[$actionPacketIndex]->getAction();
                $data = $currentAction->getData();
                $entryTimepoint = $currentAction->getName();
                $vars = $data[0]->getPredicateValues();
                $formName = $vars[0]->toString();
                $workflowCreator = $vars[1]->toString();
                //Convert into string form
                array_push($planGroups, $vars[2]->toString());
                //Check if this is a loop re-entry point
                if ($possibleActions[$actionPacketIndex]->checkForLoopReentry($entryTimepoint)) {
                    //Check we have not already save the state
                    if (!graphPlanDatabaseAccess::stateAlreadyUpdated($coreWorkflowDataPacket->getworkflowid(), $formName)) {
                        graphPlanDatabaseAccess::savePlanState($planGraphList, $coreWorkflowDataPacket->getworkflowid(), $formName);
                    }
                }
            }
            //Fetch the groups the user is a member of
            $groups = groups::getUserGroupNames($_SESSION['valid_user']);
            $groupString = "";
            $superuser = false;
            //Compare against the groups specified in the plans
            $groupsSize = sizeof($groups);
            for ($index = 0; $index < $groupsSize; $index++) {
                if ($groups[$index] == 'superuser') {
                    $superuser = true;
                } else {
                    $groupString .= $groups[$index];
                }
            }
            if (!$superuser) {
                $match = arrays::searchArray($planGroups, $groups);
            } else {
                $match = $planGroups[0];
            }
            ?>
		
	<td class="<?php 
            echo $tdClass;
            ?>
" width="172"><?php 
            echo string::sentence($formName);
            ?>
</td>
        
	<td class="<?php 
            echo $tdClass;
            ?>
" width="100"> <?php 
            echo string::sentence($workflowCreator);
            ?>
 </td>
        
	<td class="<?php 
            echo $tdClass;
            ?>
"> <?php 
            echo time::arrangedate($coreWorkflowDataPacket->getDate());
            ?>
 </td>

	<?php 
            workflowDisplayHTML::buttons($coreWorkflowDataPacket->getWorkflowId(), $match, $planGroups, $formName);
        }
    }
Esempio n. 3
0
 function processLoop($planGraphList, $workflowID)
 {
     //Find the next Actions
     $possibleActions = planComparison::compareActions($planGraphList, false);
     $loopResult = actionPacket::checkActionPacketsForLoop($possibleActions);
     if ($loopResult['loop']) {
         //Check to see if we are looping
         systemMessages::message("Workflow is Looping!");
         $planGraphList = graphPlanDatabaseAccess::getPlanState($workflowID, $loopResult['formName']);
         graphPlanDatabaseAccess::updatePlanGraphList($workflowID, $planGraphList);
         $possibleActions = planComparison::compareActions($planGraphList, false);
     }
     return $possibleActions;
 }