function actionTest($planList, $messages, $conditionID, $conditionMode) { $IDPosition = 0; $modePosition = 1; $valuePosition = 2; $match = false; $index = -1; while ($index < sizeof($planList) - 1 && !$match) { $index++; $actionNode = $planList[$index]->getAction(); $actionNodeData = $actionNode->getData(); $edgeProgression = $actionNodeData[0]; $edgeActionValues = $edgeProgression->getPredicateValues(); //$condition = $edgeActionValues[sizeof($edgeActionValues)-1]; //$conditionValues = $condition->getPredicateValues(); $conditionValue = $edgeActionValues[$valuePosition]->toString(); //Examine the message $message = planningAgent::see($messages, $conditionID); //Finding the matching action packet $match = planningAgent::doit($planList[$index], $conditionMode, $conditionValue, $messages, $message, $conditionID); } if (!$match) { errors::errorMessage("No progression was found!"); } else { //Check the chosen action packet if ($planList[$index]->atGoal()) { //At goal node planArchieving::archive($_POST['workflowID']); systemMessages::message("Goal Node reached!"); } } return $planList[$index]; }
$newPlannerProgress = planAction::fetchNextAction($plans); $action = node::getNodeData($newPlannerProgress[1]); if ($action->getPredicateName() != 'edgeProgression') { $match = true; } else { } $plannerProgress = $newPlannerProgress; $newPlannerProgress = array(); } } } debug::message("edge progression test :" . $edgeProgressionResult); if ($edgeProgressionResult) { if (!$goal) { //No point in updating plans if we have reached the goal planningAgent::updatePlans($plans); } $xmlParser = new XMLtoArray($_POST['formName'] . '.xml'); $xmlTree = $xmlParser->process(); //Package the xml data into objects $xmlPackage = xmlPackage::package($xmlTree); //Display the data as HTML xmlDatabase::updateDatabases($xmlPackage, $_POST['workflowID'], $_POST, $goal); } else { //no progress errors::errorMessage("Progression to a new workflow stage failed!"); $xmlParser = new XMLtoArray("jobSpecification.xml"); $xmlTree = $xmlParser->process(); //Package the xml data $xmlPackage = xmlPackage::package($xmlTree); //Display the data as HTML
function conditionBehaviour($progressResult) { $actionList = $progressResult['actionNames']; $action = $actionList[sizeof($actionList) - 1]; $predicateName = $action->getPredicateName(); switch ($predicateName) { case 'entry': //Javascript conditional debug::message('JavaScript Plan Actions'); $resultArray = planningJavaScript::actOnJavascriptPlanActions($progressResult['actionPackets']); $actionPackets = $resultArray['actionPackets']; break; case 'formEntry': //Role based conditional debug::message('Role based decision Actions'); //Select the plans that follow the role of the users accessing the form if (!isset($_GET['group'])) { //This test is a serverside conditional $selectGraphs = planningAgent::actionTest($progressResult['actionPackets'], $_POST, 'group', 'match'); } else { // This test is a clientside conditional $selectGraphs = planningAgent::actionTest($progressResult['actionPackets'], $_GET, 'group', 'match'); } $actionPackets = $selectGraphs; //$progressResult = planAction::findRequiredActions($selectGraphs->getPlans(),"formSubmission"); break; } if (isset($resultArray)) { return array('actionList' => $actionList, 'plans' => $actionPackets, 'javaConstraints' => $resultArray['constraints']); } return array('actionList' => $actionList, 'plans' => $actionPackets, 'javaConstraints' => array()); }