Ejemplo n.º 1
0
 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');
     }
 }
Ejemplo n.º 2
0
function databaseActions($databaseActions)
{
    if (sizeof($databaseActions)) {
        //The form required data to be fetched from the database
        for ($index = 0; $index < sizeof($databaseActions); $index++) {
            $predicateValues = $databaseActions[$index]->getPredicateValues();
            $xmlfile = $predicateValues[0]->toString() . '.xml';
            $xmlParser = new XMLtoArray($xmlfile);
            $xmlTree = $xmlParser->process();
            //Package the xml data
            $xmlPackage = xmlPackage::package($xmlTree);
            //Display the data as HTML
            xmlPackage::displayAllData($xmlPackage, $_GET['workflowID'], 'Database Information');
        }
    }
}
Ejemplo n.º 3
0
                } 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
        xmlPackage::displayItem($xmlPackage, $_POST['workflowID'], 'workflow', 'Current workflow item');
    }
}
include_once "includes/commonPages/system_footer.php";
Ejemplo n.º 4
0
<?php

include_once 'includes/configuration/core_configuration.php';
include_once "includes/commonPages/system_header.php";
$result = prolog::lookupUser($_SESSION['valid_user']);
echo 'Knowledge Base data:    ' . $result . '<br>';
$groups = groups::getUserGroupNames($_SESSION['valid_user']);
echo '<br>';
$xmlParser = new XMLtoArray("jobSpecification.xml");
$xmlTree = $xmlParser->process();
//Package the xml data
$xmlPackage = xmlPackage::package($xmlTree);
xmlPackage::displayArchiveItem($xmlPackage, $workflowID, 'workflowarchive', 'Archived Workflow', 'archiveView');
include_once "includes/commonPages/system_footer.php";
Ejemplo n.º 5
0
 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();
 }
Ejemplo n.º 6
0
<?php

include_once 'includes/configuration/core_configuration.php';
include_once "includes/commonPages/system_header.php";
$result = prolog::lookupUser($_SESSION['valid_user']);
echo 'Knowledge Base data:    ' . $result . '<br><br>';
$groups = groups::getUserGroupNames($_SESSION['valid_user']);
$xmlParser = new XMLtoArray("jobSpecification.xml");
$xmlTree = $xmlParser->process();
//Package the xml data
$xmlPackage = xmlPackage::package($xmlTree);
//Display the data as HTML
xmlPackage::displayAll($xmlPackage, 'workflow', 'Active workflow');
echo '<br><br><br><br>';
xmlPackage::displayAllArchive($xmlPackage, 'workflowarchive', 'Archived Workflow', 'archive');
include_once "includes/commonPages/system_footer.php";