CODE STYLE, workflow/engine/methods/services/

FILES:
cases_StartExternal.php
demoSoap.php
login_getStarted.php
processHeartBeat_Ajax.php
soap.php
soap2.php
unavailableService.php
upload.php
webdav.php
wsdl.php
wsdl2.php
wso2.php
xpdl.php
This commit is contained in:
jennylee
2012-10-17 14:21:55 -04:00
parent 9b55347f30
commit 665fd4d25d
13 changed files with 1528 additions and 1497 deletions

View File

@@ -1,66 +1,57 @@
<?php
try {
require_once ( "classes/model/Task.php" );
require_once ( "classes/model/Users.php" );
G::LoadClass('case');
G::LoadClass('derivation');
try {
require_once ("classes/model/Task.php");
require_once ("classes/model/Users.php");
G::LoadClass( 'case' );
G::LoadClass( 'derivation' );
$oTask = new Task();
$TaskFields = $oTask->load( $_POST['TASKS'] );
$oTask = new Task();
$TaskFields = $oTask->load( $_POST['TASKS'] );
$aDerivation['NEXT_TASK'] = $TaskFields;
$oDerivation = new Derivation();
$deriva = $oDerivation->getNextAssignedUser($aDerivation);
$aDerivation['NEXT_TASK'] = $TaskFields;
$oDerivation = new Derivation();
$deriva = $oDerivation->getNextAssignedUser( $aDerivation );
$oCase = new Cases();
$aData = $oCase->startCase( $_POST['TASKS'], $deriva['USR_UID'] );
$oCase = new Cases();
$aData = $oCase->startCase( $_POST['TASKS'], $deriva['USR_UID'] );
$case = $oCase->loadCase( $aData['APPLICATION'], 1 );
$case = $oCase->loadCase($aData['APPLICATION'], 1);
$Fields = array ();
$Fields['APP_NUMBER'] = $case['APP_NUMBER'];
$Fields['APP_PROC_STATUS'] = 'draft';
$Fields['APP_DATA'] = $_POST['form'];
$Fields['DEL_INDEX'] = 1;
$Fields['TAS_UID'] = $_POST['TASKS'];
//$Fields = $oCase->loadCase($aData['APPLICATION'], 1);
$oCase->updateCase( $aData['APPLICATION'], $Fields );
$Fields = array();
$Fields['APP_NUMBER'] = $case['APP_NUMBER'];
$Fields['APP_PROC_STATUS'] = 'draft';
$Fields['APP_DATA'] = $_POST['form'];
$Fields['DEL_INDEX'] = 1;
$Fields['TAS_UID'] = $_POST['TASKS'];
//$Fields = $oCase->loadCase($aData['APPLICATION'], 1);
$oCase->updateCase( $aData['APPLICATION'], $Fields );
$s = 0;
if (isset( $_SERVER['HTTP_REFERER'] )) {
$dir = explode( '?', $_SERVER['HTTP_REFERER'] );
if ($dir[1] == '__flag__=1') {
$s = 1;
} else {
$dire = explode( '&', $dir[1] );
for ($i = 0; $i <= count( $dire ); $i ++) {
if ($dire[$i] == '__flag__=1')
$s = 1;
}
}
$s=0;
if(isset($_SERVER['HTTP_REFERER']))
{
$dir = explode('?', $_SERVER['HTTP_REFERER']);
if($dir[1]=='__flag__=1')
{ $s=1;
}
else
{
$dire = explode('&', $dir[1]);
for($i=0; $i<=count($dire); $i++)
{
if($dire[$i]=='__flag__=1')
$s=1;
}
}
//if(strpos($_SERVER['HTTP_REFERER'],'?') !== false)
if ($s == 1) {
G::header( 'location: ' . $_SERVER['HTTP_REFERER'] );
} else {
G::header( 'location: ' . $_SERVER['HTTP_REFERER'] . '?__flag__=1' );
}
} else
echo G::LoadTranslation( 'ID_REQUEST_SENT' );
//if(strpos($_SERVER['HTTP_REFERER'],'?') !== false)
if($s==1)
{ G::header('location: ' . $_SERVER['HTTP_REFERER']);
}
else
{ G::header('location: ' . $_SERVER['HTTP_REFERER'] . '?__flag__=1');
}
}
else
echo G::LoadTranslation('ID_REQUEST_SENT');
} catch (Exception $e) {
$G_PUBLISH = new Publisher();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish' );
}
}
catch ( Exception $e ) {
$G_PUBLISH = new Publisher;
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish' );
}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -1,37 +1,35 @@
<?php
/**
* login_getStarted.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
$G_PUBLISH = new Publisher;
$oTemplatePower = new TemplatePower(PATH_TPL . 'services/login_getStarted.html');
$oTemplatePower->prepare();
/*
$oTemplatePower->newBlock('users');
$oTemplatePower->assign('USR_UID', $aUser['USR_UID']);
$oTemplatePower->assign('USR_FULLNAME', $aData['USR_FIRSTNAME'] . ' ' . $aData['USR_LASTNAME'] . ' (' . $aData['USR_USERNAME'] . ')');
*/
$G_PUBLISH->AddContent('template', '', '', '', $oTemplatePower);
G::RenderPage('publish','raw');
?>
<?php
/**
* login_getStarted.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
$G_PUBLISH = new Publisher();
$oTemplatePower = new TemplatePower( PATH_TPL . 'services/login_getStarted.html' );
$oTemplatePower->prepare();
/*
$oTemplatePower->newBlock('users');
$oTemplatePower->assign('USR_UID', $aUser['USR_UID']);
$oTemplatePower->assign('USR_FULLNAME', $aData['USR_FIRSTNAME'] . ' ' . $aData['USR_LASTNAME'] . ' (' . $aData['USR_USERNAME'] . ')');
*/
$G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower );
G::RenderPage( 'publish', 'raw' );

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
<?php
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'services/serviceMessage', '', array() , '');
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'services/serviceMessage', '', array (), '' );
G::RenderPage( 'publish' );
?>

View File

@@ -12,15 +12,14 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
@@ -31,137 +30,128 @@
* if the post attached file has error code 0 continue in other case nothing to do.
*/
if (isset($_FILES) && $_FILES["ATTACH_FILE"]["error"] == 0) {
try{
G::LoadClass("case");
if (isset( $_FILES ) && $_FILES["ATTACH_FILE"]["error"] == 0) {
try {
G::LoadClass( "case" );
$folderId = "";
$fileTags = "";
if (isset($_POST["DOC_UID"]) && $_POST["DOC_UID"] != -1) {
if (isset( $_POST["DOC_UID"] ) && $_POST["DOC_UID"] != - 1) {
//The document is of an Specific Input Document. Get path and Tag information
require_once ("classes/model/AppFolder.php");
require_once ("classes/model/InputDocument.php");
$oInputDocument = new InputDocument();
$aID = $oInputDocument->load($_POST["DOC_UID"]);
$aID = $oInputDocument->load( $_POST["DOC_UID"] );
//Get the Custom Folder ID (create if necessary)
$oFolder = new AppFolder();
$folderId = $oFolder->createFromPath($aID["INP_DOC_DESTINATION_PATH"], $_POST["APPLICATION"]);
$oFolder = new AppFolder();
$folderId = $oFolder->createFromPath( $aID["INP_DOC_DESTINATION_PATH"], $_POST["APPLICATION"] );
//Tags
$fileTags = $oFolder->parseTags($aID["INP_DOC_TAGS"], $_POST["APPLICATION"]);
$fileTags = $oFolder->parseTags( $aID["INP_DOC_TAGS"], $_POST["APPLICATION"] );
}
$oAppDocument = new AppDocument();
if (isset($_POST["APP_DOC_UID"]) && trim($_POST["APP_DOC_UID"]) != "") {
if (isset( $_POST["APP_DOC_UID"] ) && trim( $_POST["APP_DOC_UID"] ) != "") {
//Update
echo "[update]";
$aFields["APP_DOC_UID"] = $_POST["APP_DOC_UID"];
$aFields["DOC_VERSION"] = $_POST["DOC_VERSION"];
$aFields["APP_DOC_UID"] = $_POST["APP_DOC_UID"];
$aFields["DOC_VERSION"] = $_POST["DOC_VERSION"];
$aFields["APP_DOC_FILENAME"] = $_FILES["ATTACH_FILE"]["name"];
if (isset($_POST["APPLICATION"])) {
if (isset( $_POST["APPLICATION"] )) {
$aFields["APP_UID"] = $_POST["APPLICATION"];
}
if (isset($_POST["INDEX"])) {
if (isset( $_POST["INDEX"] )) {
$aFields["DEL_INDEX"] = $_POST["INDEX"];
}
if (isset($_POST["USR_UID"])) {
if (isset( $_POST["USR_UID"] )) {
$aFields["USR_UID"] = $_POST["USR_UID"];
}
if (isset($_POST["DOC_UID"])) {
if (isset( $_POST["DOC_UID"] )) {
$aFields["DOC_UID"] = $_POST["DOC_UID"];
}
if (isset($_POST["APP_DOC_TYPE"])) {
if (isset( $_POST["APP_DOC_TYPE"] )) {
$aFields["APP_DOC_TYPE"] = $_POST["APP_DOC_TYPE"];
}
$aFields["APP_DOC_CREATE_DATE"] = date("Y-m-d H:i:s");
$aFields["APP_DOC_COMMENT"] = (isset($_POST["COMMENT"]))? $_POST["COMMENT"] : "";
$aFields["APP_DOC_TITLE"] = (isset($_POST["TITLE"]))? $_POST["TITLE"] : "";
$aFields["APP_DOC_CREATE_DATE"] = date( "Y-m-d H:i:s" );
$aFields["APP_DOC_COMMENT"] = (isset( $_POST["COMMENT"] )) ? $_POST["COMMENT"] : "";
$aFields["APP_DOC_TITLE"] = (isset( $_POST["TITLE"] )) ? $_POST["TITLE"] : "";
//$aFields["FOLDER_UID"] = $folderId,
//$aFields["APP_DOC_TAGS"] = $fileTags
$aFields["APP_DOC_FIELDNAME"] = $_POST["APP_DOC_FIELDNAME"];
} else {
//New record
$aFields = array(
"APP_UID" => $_POST["APPLICATION"],
"DEL_INDEX" => $_POST["INDEX"],
"USR_UID" => $_POST["USR_UID"],
"DOC_UID" => $_POST["DOC_UID"],
"APP_DOC_TYPE" => $_POST["APP_DOC_TYPE"],
"APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"),
"APP_DOC_COMMENT" => (isset($_POST["COMMENT"]))? $_POST["COMMENT"] : "",
"APP_DOC_TITLE" => (isset($_POST["TITLE"]))? $_POST["TITLE"] : "",
"APP_DOC_FILENAME" => (isset($_FILES["ATTACH_FILE"]["name"]))? $_FILES["ATTACH_FILE"]["name"] : "",
"FOLDER_UID" => $folderId,
"APP_DOC_TAGS" => $fileTags,
"APP_DOC_FIELDNAME" => $_POST["APP_DOC_FIELDNAME"]
$aFields = array ("APP_UID" => $_POST["APPLICATION"],"DEL_INDEX" => $_POST["INDEX"],"USR_UID" => $_POST["USR_UID"],"DOC_UID" => $_POST["DOC_UID"],"APP_DOC_TYPE" => $_POST["APP_DOC_TYPE"],"APP_DOC_CREATE_DATE" => date( "Y-m-d H:i:s" ),"APP_DOC_COMMENT" => (isset( $_POST["COMMENT"] )) ? $_POST["COMMENT"] : "","APP_DOC_TITLE" => (isset( $_POST["TITLE"] )) ? $_POST["TITLE"] : "","APP_DOC_FILENAME" => (isset( $_FILES["ATTACH_FILE"]["name"] )) ? $_FILES["ATTACH_FILE"]["name"] : "","FOLDER_UID" => $folderId,"APP_DOC_TAGS" => $fileTags,"APP_DOC_FIELDNAME" => $_POST["APP_DOC_FIELDNAME"]
);
}
$oAppDocument->create($aFields);
$oAppDocument->create( $aFields );
$sAppUid = $oAppDocument->getAppUid();
$sAppDocUid = $oAppDocument->getAppDocUid();
$sAppUid = $oAppDocument->getAppUid();
$sAppDocUid = $oAppDocument->getAppDocUid();
$iDocVersion = $oAppDocument->getDocVersion();
$info = pathinfo($oAppDocument->getAppDocFilename());
$ext = (isset($info["extension"]))? $info["extension"] : "";
$info = pathinfo( $oAppDocument->getAppDocFilename() );
$ext = (isset( $info["extension"] )) ? $info["extension"] : "";
//Save the file
echo $sPathName = PATH_DOCUMENT . $sAppUid . PATH_SEP;
echo $sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $ext;
print G::uploadFile($_FILES["ATTACH_FILE"]["tmp_name"], $sPathName, $sFileName);
print("* The file " . $_FILES["ATTACH_FILE"]["name"] . " was uploaded successfully in case " . $sAppUid . " as input document..\n");
print G::uploadFile( $_FILES["ATTACH_FILE"]["tmp_name"], $sPathName, $sFileName );
print ("* The file " . $_FILES["ATTACH_FILE"]["name"] . " was uploaded successfully in case " . $sAppUid . " as input document..\n") ;
//Get current Application Fields
$application = new Application();
$appFields = $application->Load($_POST["APPLICATION"]);
$appFields = unserialize($appFields["APP_DATA"]);
$appFields = $application->Load( $_POST["APPLICATION"] );
$appFields = unserialize( $appFields["APP_DATA"] );
$_SESSION["APPLICATION"] = $appFields["APPLICATION"];
$_SESSION["PROCESS"] = $appFields["PROCESS"];
$_SESSION["TASK"] = $appFields["TASK"];
$_SESSION["INDEX"] = $appFields["INDEX"];
$_SESSION["USER_LOGGED"] = $appFields["USER_LOGGED"]; //$_POST["USR_UID"]
$_SESSION["APPLICATION"] = $appFields["APPLICATION"];
$_SESSION["PROCESS"] = $appFields["PROCESS"];
$_SESSION["TASK"] = $appFields["TASK"];
$_SESSION["INDEX"] = $appFields["INDEX"];
$_SESSION["USER_LOGGED"] = $appFields["USER_LOGGED"]; //$_POST["USR_UID"]
//$_SESSION["USR_USERNAME"] = $appFields["USR_USERNAME"];
//$_SESSION["STEP_POSITION"] = 0;
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = &PMPluginRegistry::getSingleton();
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists("uploadDocumentData")) {
$triggerDetail = $oPluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT);
$documentData = new uploadDocumentData($_POST["APPLICATION"], $_POST["USR_UID"], $sPathName . $sFileName, $aFields["APP_DOC_FILENAME"], $sAppDocUid, $iDocVersion);
$uploadReturn = $oPluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData);
if ($oPluginRegistry->existsTrigger( PM_UPLOAD_DOCUMENT ) && class_exists( "uploadDocumentData" )) {
$triggerDetail = $oPluginRegistry->getTriggerInfo( PM_UPLOAD_DOCUMENT );
$documentData = new uploadDocumentData( $_POST["APPLICATION"], $_POST["USR_UID"], $sPathName . $sFileName, $aFields["APP_DOC_FILENAME"], $sAppDocUid, $iDocVersion );
$uploadReturn = $oPluginRegistry->executeTriggers( PM_UPLOAD_DOCUMENT, $documentData );
if ($uploadReturn) {
$aFields["APP_DOC_PLUGIN"] = $triggerDetail->sNamespace;
if (!isset($aFields["APP_DOC_UID"])) {
if (! isset( $aFields["APP_DOC_UID"] )) {
$aFields["APP_DOC_UID"] = $sAppDocUid;
}
if (!isset($aFields["DOC_VERSION"])) {
if (! isset( $aFields["DOC_VERSION"] )) {
$aFields["DOC_VERSION"] = $iDocVersion;
}
$oAppDocument->update($aFields);
$oAppDocument->update( $aFields );
unlink($sPathName . $sFileName);
unlink( $sPathName . $sFileName );
}
}
//End plugin
} catch (Exception $e) {
print($e->getMessage());
print ($e->getMessage()) ;
}
}

View File

@@ -1,51 +1,52 @@
<?php
ini_set("default_charset", "UTF-8");
ini_set( "default_charset", "UTF-8" );
function AuthenticationBasicHTTP($realm ) {
if (empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['REDIRECT_REMOTE_USER'])) {
header('WWW-Authenticate: Basic realm="'.$realm.'"');
header('HTTP/1.0 401 Unauthorized');
die('401 Unauthorized');
}
global $RBAC;
$uid = $RBAC->VerifyLogin($_SERVER['PHP_AUTH_USER'] , $_SERVER['PHP_AUTH_PW'] );
if ( $uid > 0 ) {
// Asign the uid of user to userloggedobj
$RBAC->loadUserRolePermission($RBAC->sSystem, $uid);
$res = $RBAC->userCanAccess('PM_WEBDAV');
if ($res != 1 ) {
if ($res == -2)
$msg = G::LoadTranslation ('ID_USER_HAVENT_RIGHTS_SYSTEM');
else
$msg = G::LoadTranslation ('ID_USER_HAVENT_RIGHTS_PAGE');
header('WWW-Authenticate: Basic realm="'.$realm.'"');
header('HTTP/1.0 401 ' . $msg );
die('401 ' . $msg);
return FALSE;
die;
}
return TRUE;
}
function AuthenticationBasicHTTP ($realm)
{
if (empty( $_SERVER['PHP_AUTH_USER'] ) && empty( $_SERVER['REDIRECT_REMOTE_USER'] )) {
header( 'WWW-Authenticate: Basic realm="' . $realm . '"' );
header( 'HTTP/1.0 401 Unauthorized' );
die( '401 Unauthorized' );
}
header('WWW-Authenticate: Basic realm="'.$realm.'"');
header('HTTP/1.0 401 Unauthorized');
die('401 Unauthorized');
return FALSE;
global $RBAC;
$uid = $RBAC->VerifyLogin( $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] );
if ($uid > 0) {
// Asign the uid of user to userloggedobj
$RBAC->loadUserRolePermission( $RBAC->sSystem, $uid );
$res = $RBAC->userCanAccess( 'PM_WEBDAV' );
if ($res != 1) {
if ($res == - 2)
$msg = G::LoadTranslation( 'ID_USER_HAVENT_RIGHTS_SYSTEM' );
else
$msg = G::LoadTranslation( 'ID_USER_HAVENT_RIGHTS_PAGE' );
header( 'WWW-Authenticate: Basic realm="' . $realm . '"' );
header( 'HTTP/1.0 401 ' . $msg );
die( '401 ' . $msg );
return false;
die();
}
return true;
}
header( 'WWW-Authenticate: Basic realm="' . $realm . '"' );
header( 'HTTP/1.0 401 Unauthorized' );
die( '401 Unauthorized' );
return false;
}
$realm = 'ProcessMaker Filesystem for Workspace ' . SYS_SYS;
$realm = 'ProcessMaker Filesystem for Workspace ' . SYS_SYS;
# Choice an authentification type Digest or Basic
//AuthenticationDigestHTTP($realm, $users, $phpcgi);
AuthenticationBasicHTTP($realm );
# Choice an authentification type Digest or Basic
//AuthenticationDigestHTTP($realm, $users, $phpcgi);
AuthenticationBasicHTTP( $realm );
G::LoadClass ( "webdav" );
G::LoadClass( "webdav" );
$server = new ProcessMakerWebDav();
$server = new ProcessMakerWebDav();
# Real path of your site
$server->ServeRequest( "");
# Real path of your site
$server->ServeRequest( "" );

View File

@@ -1,14 +1,13 @@
<?php
$filewsdl = PATH_METHODS . 'services'. PATH_SEP . 'pmos.wsdl';
$content = file_get_contents( $filewsdl );
$lang = defined ('SYS_LANG') ? SYS_LANG : 'en';
$endpoint = 'http://' .$_SERVER['SERVER_NAME'] . ':' .$_SERVER['SERVER_PORT'] .
'/sys' .SYS_SYS.'/' .$lang . '/classic/services/soap';
//print $endpoint; die;
$content = str_replace ( "___SOAP_ADDRESS___", $endpoint, $content );
header("Content-Type: application/xml;");
print $content;
$filewsdl = PATH_METHODS . 'services' . PATH_SEP . 'pmos.wsdl';
$content = file_get_contents( $filewsdl );
$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
$endpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . SYS_SYS . '/' . $lang . '/classic/services/soap';
//print $endpoint; die;
$content = str_replace( "___SOAP_ADDRESS___", $endpoint, $content );
header( "Content-Type: application/xml;" );
print $content;

View File

@@ -1,15 +1,14 @@
<?php
$filewsdl = PATH_METHODS . 'services'. PATH_SEP . 'pmos2.wsdl';
$content = file_get_contents( $filewsdl );
$lang = defined ('SYS_LANG') ? SYS_LANG : 'en';
$http = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ) ? 'https' : 'http';
$endpoint = $http . '://' .$_SERVER['SERVER_NAME'] . ':' .$_SERVER['SERVER_PORT'] .
'/sys' .SYS_SYS.'/' .$lang . '/classic/services/soap2';
$filewsdl = PATH_METHODS . 'services' . PATH_SEP . 'pmos2.wsdl';
$content = file_get_contents( $filewsdl );
$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
$http = (isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
$endpoint = $http . '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . SYS_SYS . '/' . $lang . '/classic/services/soap2';
$content = str_replace( "___SOAP_ADDRESS___", $endpoint, $content );
header( "Content-Type: application/xml;" );
print $content;
$content = str_replace ( "___SOAP_ADDRESS___", $endpoint, $content );
header("Content-Type: application/xml;");
print $content;

View File

@@ -1,46 +1,47 @@
<?php
function wsBaseLogin( $username, $password ) {
G::LoadClass('wsBase');
$ws = new wsBase ();
function wsBaseLogin ($username, $password)
{
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->login( $username, $password );
return $res->getPayloadArray ( ) ;
}
return $res->getPayloadArray();
}
function wsBaseProcessList( $studentName ) {
G::LoadClass('wsBase');
$ws = new wsBase ();
$result = $ws->processList ();
//$result[] = array ( 'guid' => 'a' . $studentName , 'name' => 'bc' );
//$result[] = array ( 'guid' => '2a' , 'name' => '2bc' . $studentName );
//$result[] = array ( 'guid' => '2a' , 'name' => '2bc' . $studentName );
return array("processes"=> $result);
function wsBaseProcessList ($studentName)
{
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$result = $ws->processList();
//$result[] = array ( 'guid' => 'a' . $studentName , 'name' => 'bc' );
//$result[] = array ( 'guid' => '2a' , 'name' => '2bc' . $studentName );
//$result[] = array ( 'guid' => '2a' , 'name' => '2bc' . $studentName );
return array ("processes" => $result
);
//return array ( "status_code" => 12, "message" => 'abx', "timestamp" => 'aa' );
}
}
/* Map of the service operation "ExamResult" to php function "ExamResult" */
$operations = array( "processesList" => "wsBaseProcessList",
"login" => "wsBaseLogin"
);
$operations = array ("processesList" => "wsBaseProcessList","login" => "wsBaseLogin"
);
/* just tell your function parameters should be in mixed format,
that is here parameter will be the string with the name in it*/
$opParams = array("wsBaseProcessList" => "MIXED",
"wsBaseLogin" => "MIXED");
$opParams = array ("wsBaseProcessList" => "MIXED","wsBaseLogin" => "MIXED"
);
//$wsdl = PATH_METHODS . "services" . PATH_SEP . "pmos.wsdl";
$wsdl = "/home/fernando/processmaker/trunk/workflow/engine/methods/services/pmos.wsdl";
echo $wsdl;
echo file_get_contents($wsdl);
echo file_get_contents( $wsdl );
die();
/* Created the WSService */
$svr = new WSService(array("wsdl" => $wsdl ,
"operations" => $operations,
"opParams" => $opParams));
$svr = new WSService( array ("wsdl" => $wsdl,"operations" => $operations,"opParams" => $opParams
) );
/* Reply the client */
$svr->reply();
die;
die();

View File

@@ -1,184 +1,201 @@
<?php
function addNodox($obj, $padre, $indice, $contenido='', $atributos='')
function addNodox ($obj, $padre, $indice, $contenido = '', $atributos = '')
{
if (is_object($padre)) {
if ($contenido=='') {
$nodo = $obj->createElement($indice);
if (is_object( $padre )) {
if ($contenido == '') {
$nodo = $obj->createElement( $indice );
} else {
$nodo = $obj->createElement($indice, $contenido);
$nodo = $obj->createElement( $indice, $contenido );
}
$padre->appendChild($nodo);
$padre->appendChild( $nodo );
} else {
if ($contenido=='') {
$nodo = $obj->createElement($indice);
if ($contenido == '') {
$nodo = $obj->createElement( $indice );
} else {
$nodo = $obj->createElement($indice, $contenido);
$nodo = $obj->createElement( $indice, $contenido );
}
$obj->appendChild($nodo);
$obj->appendChild( $nodo );
}
if (is_array($atributos)) {
if (is_array( $atributos )) {
foreach ($atributos as $key => $value) {
$atributo = $obj->createAttribute($key);
$nodo->appendChild($atributo);
$atributo = $obj->createAttribute( $key );
$nodo->appendChild( $atributo );
$texto = $obj->createTextNode($value);
$atributo->appendChild($texto);
$texto = $obj->createTextNode( $value );
$atributo->appendChild( $texto );
}
}
return $nodo;
}
function derivationRules($aRoute, $doc, $nodo_derivationrule)
function derivationRules ($aRoute, $doc, $nodo_derivationrule)
{
$tam = count($aRoute);
$c=0;
switch ($aRoute[$c]['ROU_TYPE'])
{
$tam = count( $aRoute );
$c = 0;
switch ($aRoute[$c]['ROU_TYPE']) {
case 'SEQUENTIAL':
$nodo_routeType = addNodox($doc, $nodo_derivationrule, 'Sequential', '', '');
$nodo_nexttask = addNodox($doc, $nodo_routeType, 'NextTask', '', '');
if ($aRoute[$c]['ROU_NEXT_TASK'] != -1) {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'TaskRef', '',
array('TaskId'=> 'ID'.$aRoute[$c]['ROU_NEXT_TASK']));
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'Sequential', '', '' );
$nodo_nexttask = addNodox( $doc, $nodo_routeType, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'End', '', '');
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
}
break;
case 'EVALUATE':
$nodo_routeType = addNodox($doc, $nodo_derivationrule, 'Evaluations', '', '');
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'Evaluations', '', '' );
while ($c < $tam) {
$nodo_evaluation= addNodox($doc, $nodo_routeType, 'Evaluation', '', array('Condition'=> $aRoute[$c]['ROU_CONDITION']));
$nodo_nexttask = addNodox($doc, $nodo_evaluation, 'NextTask', '', '');
if ($aRoute[$c]['ROU_NEXT_TASK'] != -1) {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'TaskRef', '', array('TaskId'=> 'ID'.$aRoute[$c]['ROU_NEXT_TASK']));
$nodo_evaluation = addNodox( $doc, $nodo_routeType, 'Evaluation', '', array ('Condition' => $aRoute[$c]['ROU_CONDITION']
) );
$nodo_nexttask = addNodox( $doc, $nodo_evaluation, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'End', '', '');
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
}
$c++;
$c ++;
}
break;
case 'SELECT':
$nodo_routeType = addNodox($doc, $nodo_derivationrule, 'Selections', '', '');
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'Selections', '', '' );
while ($c < $tam) {
$nodo_selection= addNodox($doc, $nodo_routeType, 'Selection', '', array('Description'=> $aRoute[$c]['ROU_CONDITION']));
$nodo_nexttask = addNodox($doc, $nodo_selection, 'NextTask', '', '');
if ($aRoute[$c]['ROU_NEXT_TASK'] != -1) {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'TaskRef', '', array('TaskId'=> 'ID'.$aRoute[$c]['ROU_NEXT_TASK']));
$nodo_selection = addNodox( $doc, $nodo_routeType, 'Selection', '', array ('Description' => $aRoute[$c]['ROU_CONDITION']
) );
$nodo_nexttask = addNodox( $doc, $nodo_selection, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'End', '', '');
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
}
$c++;
$c ++;
}
break;
case 'PARALLEL':
$nodo_routeType = addNodox($doc, $nodo_derivationrule, 'ParallelForks', '', '');
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'ParallelForks', '', '' );
while ($c < $tam) {
$nodo_parallelfork= addNodox($doc, $nodo_routeType, 'ParallelFork', '', '');
$nodo_nexttask = addNodox($doc, $nodo_parallelfork, 'NextTask', '', '');
$nodo_parallelfork = addNodox( $doc, $nodo_routeType, 'ParallelFork', '', '' );
$nodo_nexttask = addNodox( $doc, $nodo_parallelfork, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != -1) {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'TaskRef', '', array('TaskId'=> 'ID'.$aRoute[$c]['ROU_NEXT_TASK']));
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'End', '', '');
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
}
$c++;
$c ++;
}
break;
case 'PARALLEL-BY-EVALUATION':
$nodo_routeType = addNodox($doc, $nodo_derivationrule, 'ParallelForksByEvaluation', '', '');
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'ParallelForksByEvaluation', '', '' );
while ($c < $tam) {
$nodo_evaluation= addNodox($doc, $nodo_routeType, 'Evaluation', '', array('Condition'=> $aRoute[$c]['ROU_CONDITION']));
$nodo_nexttask = addNodox($doc, $nodo_evaluation, 'NextTask', '', '');
if ($aRoute[$c]['ROU_NEXT_TASK'] != -1) {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'TaskRef', '', array('TaskId'=> 'ID'.$aRoute[$c]['ROU_NEXT_TASK']));
$nodo_evaluation = addNodox( $doc, $nodo_routeType, 'Evaluation', '', array ('Condition' => $aRoute[$c]['ROU_CONDITION']
) );
$nodo_nexttask = addNodox( $doc, $nodo_evaluation, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'End', '', '');
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
}
$c++;
$c ++;
}
break;
case 'SEC-JOIN':
$nodo_routeType = addNodox($doc, $nodo_derivationrule, 'ParallelJoin', '', '');
$nodo_nexttask = addNodox($doc, $nodo_routeType, 'NextTask', '', '');
if ($aRoute[$c]['ROU_NEXT_TASK'] != -1) {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'TaskRef', '', array('TaskId'=> 'ID'.$aRoute[$c]['ROU_NEXT_TASK']));
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'ParallelJoin', '', '' );
$nodo_nexttask = addNodox( $doc, $nodo_routeType, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'End', '', '');
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
}
break;
}
}
/****-_--__---___----___---__--_-****/
/**
* **-_--__---___----___---__--_-***
*/
G::LoadClass('tasks');
G::LoadClass( 'tasks' );
require_once 'classes/model/Process.php';
$doc = new DOMDocument('1.0', 'UTF-8');
$nodo_padre = addNodox($doc, '', 'Processes', '', array('xmlns:xsi'=>'http://www.w3.org/2001/XMLSchema-instance','xsi:noNamespaceSchemaLocation'=>'ColosaSchema.xsd'));
$doc = new DOMDocument( '1.0', 'UTF-8' );
$nodo_padre = addNodox( $doc, '', 'Processes', '', array ('xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance','xsi:noNamespaceSchemaLocation' => 'ColosaSchema.xsd'
) );
$aProcesses = array();
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(ProcessPeer::PRO_UID);
$aProcesses = array ();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( ProcessPeer::PRO_UID );
//$oCriteria->add(ProcessPeer::PRO_STATUS, 'DISABLED', Criteria::NOT_EQUAL);
//$oCriteria->add(ProcessPeer::PRO_UID, '946679494980c3d0ba0814088444708');
$oDataset = ProcessPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset = ProcessPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$oProcess = new Process();
while ($aRow = $oDataset->getRow()) {
$aProcess = $oProcess->load($aRow['PRO_UID']);
$nodo_process = addNodox($doc, $nodo_padre, 'Process', '', array('Title'=> $aProcess['PRO_TITLE'],'Description'=> $aProcess['PRO_DESCRIPTION']));
$nodo_tasks = addNodox($doc, $nodo_process, 'Tasks', '', '');
$aProcess = $oProcess->load( $aRow['PRO_UID'] );
$nodo_process = addNodox( $doc, $nodo_padre, 'Process', '', array ('Title' => $aProcess['PRO_TITLE'],'Description' => $aProcess['PRO_DESCRIPTION']
) );
$nodo_tasks = addNodox( $doc, $nodo_process, 'Tasks', '', '' );
$oTask = new Tasks();
$aTasks= $oTask->getAllTasks($aProcess['PRO_UID']);
$aTasks = $oTask->getAllTasks( $aProcess['PRO_UID'] );
foreach ($aTasks as $key => $value) {
//print_r($value); echo "<br>";
$aRoute = $oTask->getRoute($aProcess['PRO_UID'], $value['TAS_UID']);
$aRoute = $oTask->getRoute( $aProcess['PRO_UID'], $value['TAS_UID'] );
//print_r($aRoute[0]['ROU_UID']); echo "<hr>";
/*foreach($aRoute as $k => $v)
echo $k."-->".$v."<br>";
*/
if ($value['TAS_TYPE']=='NORMAL') {
$ini = ($value['TAS_START']=='TRUE') ? 'true' : 'false';
if ($value['TAS_TYPE'] == 'NORMAL') {
$ini = ($value['TAS_START'] == 'TRUE') ? 'true' : 'false';
$nodo_task = addNodox($doc, $nodo_tasks, 'Task', '', array('Title'=> $value['TAS_TITLE'],'Description'=> $value['TAS_DESCRIPTION'],'Id'=> 'ID'.$value['TAS_UID'],'StartingTask'=> $ini));
$nodo_coordinates = addNodox($doc, $nodo_task, 'Coordinates', '', array('XCoordinate'=> $value['TAS_POSX'],'YCoordinate'=> $value['TAS_POSY']));
$nodo_derivationrule = addNodox($doc, $nodo_task, 'DerivationRule', '', '');
$nodo_task = addNodox( $doc, $nodo_tasks, 'Task', '', array ('Title' => $value['TAS_TITLE'],'Description' => $value['TAS_DESCRIPTION'],'Id' => 'ID' . $value['TAS_UID'],'StartingTask' => $ini
) );
$nodo_coordinates = addNodox( $doc, $nodo_task, 'Coordinates', '', array ('XCoordinate' => $value['TAS_POSX'],'YCoordinate' => $value['TAS_POSY']
) );
$nodo_derivationrule = addNodox( $doc, $nodo_task, 'DerivationRule', '', '' );
derivationRules($aRoute, $doc, $nodo_derivationrule);
derivationRules( $aRoute, $doc, $nodo_derivationrule );
$nodo_assignmentrules = addNodox($doc, $nodo_task, 'AssignmentRules', '', '');
$nodo_cyclicalassignment = addNodox($doc, $nodo_assignmentrules, 'CyclicalAssignment', '', '');
$nodo_timingcontrol = addNodox($doc, $nodo_task, 'TimingControl', '', array('TaskDuration'=> $value['TAS_DURATION']));
$nodo_permissions = addNodox($doc, $nodo_task, 'Permissions', '', '');
$nodo_caselabels = addNodox($doc, $nodo_task, 'CaseLabels', '', '');
$nodo_notifications = addNodox($doc, $nodo_task, 'Notifications', '', '');
$nodo_assignmentrules = addNodox( $doc, $nodo_task, 'AssignmentRules', '', '' );
$nodo_cyclicalassignment = addNodox( $doc, $nodo_assignmentrules, 'CyclicalAssignment', '', '' );
$nodo_timingcontrol = addNodox( $doc, $nodo_task, 'TimingControl', '', array ('TaskDuration' => $value['TAS_DURATION']
) );
$nodo_permissions = addNodox( $doc, $nodo_task, 'Permissions', '', '' );
$nodo_caselabels = addNodox( $doc, $nodo_task, 'CaseLabels', '', '' );
$nodo_notifications = addNodox( $doc, $nodo_task, 'Notifications', '', '' );
} else {
require_once ( "classes/model/SubProcess.php" );
$oCriteria = new Criteria('workflow');
$oCriteria->add(SubProcessPeer::PRO_PARENT, $value['PRO_UID']);
$oCriteria->add(SubProcessPeer::TAS_PARENT, $value['TAS_UID']);
$oDataset = SubProcessPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
require_once ("classes/model/SubProcess.php");
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( SubProcessPeer::PRO_PARENT, $value['PRO_UID'] );
$oCriteria->add( SubProcessPeer::TAS_PARENT, $value['TAS_UID'] );
$oDataset = SubProcessPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aRow = $oDataset->getRow();
$nodo_task = addNodox($doc, $nodo_tasks, 'SubProcess', '', array('Title'=> $value['TAS_TITLE'],'Description'=> $value['TAS_DESCRIPTION'],'Id'=> 'ID'.$value['TAS_UID'], 'ProcessRef'=>$aRow['PRO_UID']));
$nodo_coordinates = addNodox($doc, $nodo_task, 'Coordinates', '', array('XCoordinate'=> $value['TAS_POSX'],'YCoordinate'=> $value['TAS_POSY']));
$nodo_derivationrule = addNodox($doc, $nodo_task, 'DerivationRule', '', '');
$nodo_task = addNodox( $doc, $nodo_tasks, 'SubProcess', '', array ('Title' => $value['TAS_TITLE'],'Description' => $value['TAS_DESCRIPTION'],'Id' => 'ID' . $value['TAS_UID'],'ProcessRef' => $aRow['PRO_UID']
) );
$nodo_coordinates = addNodox( $doc, $nodo_task, 'Coordinates', '', array ('XCoordinate' => $value['TAS_POSX'],'YCoordinate' => $value['TAS_POSY']
) );
$nodo_derivationrule = addNodox( $doc, $nodo_task, 'DerivationRule', '', '' );
derivationRules($aRoute, $doc, $nodo_derivationrule);
derivationRules( $aRoute, $doc, $nodo_derivationrule );
}
}
$oDataset->next();
}
//die;
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$doc->save(PATH_METHODS.'services/test_xpdl.xml');
$doc->formatOutput = true;
$doc->save( PATH_METHODS . 'services/test_xpdl.xml' );
echo "xml for xpdl creado!!!<br>";