Esempio n. 1
0
 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());
 }