function lookupUser($user) { $script = 'knowledgeBaseCGI.pl'; $action = 'lookup'; debug::message($user); $user = string::low($user); $groupPredicates[0] = new prologString($user); $constructList = new prologConstructCollection(); //Add predicate to construct collection $constructList->addConstruct(new prologPredicate('get_post_value', $groupPredicates)); $userList = $constructList->toArray(); $filename = prolog::transferToProlog($user, $userList); return prolog::exec($script, $action, $filename); }
function javaScriptConstraint($elementName = '', $functionMode = '', $value = '') { $this->elementName = $elementName; debug::message('MODE:' . $functionMode); switch ($functionMode) { case 'presence': $this->constraint = "!=''"; break; case 'match': $matchValue = $value[3]->toString(); $this->constraint = "== '{$matchValue}'"; break; case 'function': $functionPredicateValues = $value[3]->getPredicateValues(); $predicateName = $value[3]->getPredicateName(); debug::message('Function: ' . $predicateName); switch ($predicateName) { case 'lessThan': $this->constraint = '<' . $functionPredicateValues[0]->toString(); break; case 'greaterThanOrEqual': $this->constraint = '>=' . $functionPredicateValues[0]->toString(); break; } } }
function transferFormPosts($_POST) { $keys = array_keys($_POST); for ($count = 0; $count < sizeof($_POST); $count++) { debug::message($keys[$count]); debug::message('->'); debug::message($_POST[$keys[$count]]); debug::message('<br>'); } }
static function stop() { self::$stopTime = microtime(true); //将获取的时间赋给成员属性$stopTime if (Config::config('debug')) { //显示DEBUG信息 debug::message(); } // if(Extension_Loaded('zlib')&&GZIP===TRUE)Ob_End_Flush(); }
function progressWithoutHistory() { //Not at the goal NODE! if ($this->currentPosition != 't') { $newoptions = $this->planGraph->findConnections($this->currentPosition); debug::message('<br>AT(' . $this->currentPosition . ')-->'); debug::message('( ' . $newoptions . ' )<br>'); $this->currentPosition = $newoptions; } }
function updateDatabases($xmlPackage, $workflowId, $formData, $goal) { global $db; $db = connect($xmlPackage->getDb()); debug::message("connect to db:" . $xmlPackage->getDb() . '<br>'); $newDataItem = new coreWorkflowDataPacket($workflowId, array()); $tables = $xmlPackage->getTables(); if (sizeof($tables) > 0) { //For each table for ($tableIndex = 0; $tableIndex < sizeof($tables); $tableIndex++) { $table = $tables[$tableIndex]->getTableName(); $valsArray['workflowId'] = $workflowId; $fields = $tables[$tableIndex]->getDbFields(); //The fields specificed for ($index = 0; $index < sizeof($fields); $index++) { $field = $fields[$index]; $valsArray[$field] = addslashes($formData[$field]); } //Does this workflow item already exist in the table $sql_query = "workflowId='{$workflowId}'"; if (dbpear::numRecords($table, "{$sql_query}")) { $keyName = dbs::getprimarykey($table); $keyValue = dbpear::selAttribute($keyName, $table, $sql_query); dbs::updaterecord($table, $valsArray, $keyName, $keyValue); } else { dbs::irrecord($table, $valsArray, false); } $db = connect('iWFMS'); } $xmlParser = new XMLtoArray("jobSpecification.xml"); $xmlTree = $xmlParser->process(); //Package the xml data $xmlPackage = xmlPackage::package($xmlTree); if (!$goal) { //We are not at the goal node //Display the data as HTML xmlPackage::displayItem($xmlPackage, $workflowId, 'workflow', 'Current workflow item'); } else { //We are at the goal node xmlPackage::displayArchiveItem($xmlPackage, $workflowId, 'workflowArchive', 'Current archived workflow item', 'archive'); } } else { $xmlParser = new XMLtoArray("jobSpecification.xml"); $xmlTree = $xmlParser->process(); //Package the xml data $xmlPackage = xmlPackage::package($xmlTree); //Display the data as HTML xmlPackage::displayItem($xmlPackage, $workflowId, 'workflow', 'Current workflow item'); } }
function toArray() { $resultArray = array(); $resultIndex = 0; if ($this->regularExpression) { //Display regular expression predicate $predicateVars[0] = new prologAtom($this->typename); $predicateVars[1] = new prologList($this->regularExpression); $regPredicate = new prologPredicate($this->regularExpressionPredicate, $predicateVars); $resultArray[$resultIndex] = $regPredicate->toString() . ".\n"; debug::message($resultArray[$resultIndex]); $resultIndex++; } for ($index = 0; $index < sizeof($this->ruleList); $index++) { $typeRule = $this->ruleList[$index]; //Display rule $resultArray[$resultIndex] = $typeRule->toString(); $resultIndex++; } return $resultArray; }
/** * @return array representing XML file contents * @desc Reads the xml file in and parses it */ function process() { $count = 0; debug::message("XML spec: " . $this->file . '<br>'); $fp = XMLtoArray::openXML(); while ($data = fread($fp, 4096)) { debug::message("\n" . $data . "\n"); $this->parse($data); $count = $count - 1; } return $this->stack; }
/** * @return boolean * @param $object1 prologPredicate * @param $object2 prologPredicate * @desc compares whether two predicates are equal */ function compare($object1, $object2) { debug::message($object1->toString() . "==" . $object2->toString() . '<br><br>'); return $object1->toString() == $object2->toString(); }
systemMessages::message("Goal node reached!"); } else { //Only one action packet should be returned $plans = $selectedActionPacket->getPlans(); $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");
</tr> </table> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td class="outliner"><img src="images/spacer.gif" border="0" width="1" height="1"></td> </tr> </table></td> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0" border="0" > <tr> <td width="1" class="outliner"><img src="images/spacer.gif" border="0" width="1" height="1"></td> <td class="footerAndHeadercolour"> </td> <td class="footerAndHeadercolour" align="right"> Processing time:<?php echo time::stoptiming(); ?> </td> <td width="1" class="outliner"><img src="images/spacer.gif" border="0" width="1" height="1"></td> </tr> <tr> <td colspan="4" class="outliner"><img src="images/spacer.gif" border="0" width="1" height="1"></td> </tr> </table> </body> </html> <?php if ($db != '') { debug::message("disconnecting from database"); $db->disconnect(); }
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()); }
/** * @return unknown * @param unknown $predicateVars * @desc Enter description here... */ function __convertStringsToObjects($predicateVars) { $predicateValObjects = array(); for ($indexVals = 0; $indexVals < sizeof($predicateVars); $indexVals++) { debug::message($predicateVars[$indexVals]); //The string represents a predicate if (prologPredicate::__isPredicate($predicateVars[$indexVals])) { $predicateValObjects[$indexVals] = new prologPredicate($predicateVars[$indexVals]); } elseif (preg_match("/\\[[^\\]]*\\]/", $predicateVars[$indexVals])) { //This is a List $predicateValObjects[$indexVals] = new prologList($predicateVars[$indexVals]); //print_r($predicateValObjects[$indexVals]); } else { //This is a atom $predicateValObjects[$indexVals] = new prologAtom($predicateVars[$indexVals]); } } return $predicateValObjects; }
function displayAllData($xmlPackage, $workflowID, $title) { global $db; $db = connect($xmlPackage->getDb()); debug::message("connect to db:" . $xmlPackage->getDb() . '<br>'); workflowDisplayHTML::dataTableHead($xmlPackage->getDisplayFields(), "", $title); //workflowDisplayHTML::tableMainOpen(); xmlPackage::__testDatabaseFields(array($workflowID), array(''), $xmlPackage, 'data'); workflowDisplayHTML::tableMainClose(); }
function irrecordArray($table, $valsarray, $showkey) { if ($table && sizeof($valsarray)) { $vals = ''; //Generate column names $cols = dbs::genfieldnames($table, $showkey); $cols = preg_replace('/`|\\s/', '', $cols); //Break up into an array $keyarray = arrays::array_explode($cols, ","); //$valsarray_size = sizeof($valsarray); $valsarray_size = sizeof($keyarray); $sql = "INSERT INTO `{$table}` (" . $cols . ") VALUES"; for ($valueIndex = 0; $valueIndex < sizeof($valsarray); $valueIndex++) { $vals = ''; for ($index = 0; $index < $valsarray_size; $index++) { if ($index != 0) { $vals .= ","; } $vals .= "'" . $valsarray[$valueIndex][$keyarray[$index]] . "'"; } if ($valueIndex != sizeof($valsarray) - 1) { $sql .= "(" . $vals . "),"; } else { $sql .= "(" . $vals . ")"; } } debug::message($sql . '<br><br>'); $result = mysql_query($sql) or die("Couldna execute record insert/replace - " . mysql_errno() . ": " . mysql_error()); return mysql_insert_id(); } return false; }