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' );
}
?>

View File

@@ -1,258 +1,273 @@
<html>
<head>
<title> SugarCRM test webservices </title>
<title>SugarCRM test webservices</title>
</head>
<style type="text/css">
ul.krumo-node {
margin: 0px;
padding: 0px;
background-color: white;
}
}
ul.krumo-node ul {
margin-left: 20px;
}
}
* html ul.krumo-node ul {
margin-left: 24px;
}
}
div.krumo-root {
border: solid 1px black;
margin: 1em 0em;
text-align: left;
}
text-align: left;
}
ul.krumo-first {
font: normal 11px tahoma, verdana;
border: solid 1px white;
}
}
li.krumo-child {
display:block;
display: block;
list-style: none;
padding: 0px;
margin: 0px;
overflow:hidden;
}
div.krumo-element {
cursor:default;
display:block;
clear:both;
white-space:nowrap;
overflow: hidden;
}
div.krumo-element {
cursor: default;
display: block;
clear: both;
white-space: nowrap;
background-color: white;
background-image: url(/Krumo/skins/schablon.com/empty.gif);
background-repeat: no-repeat;
background-position: 6px 5px;
padding: 2px 0px 3px 20px;
}
}
* html div.krumo-element {
padding-bottom: 3px;
line-height: 13px;
}
}
a.krumo-name {
color:navy;
color: navy;
font: bold 13px courier new;
line-height:12px;
}
line-height: 12px;
}
</style>
<?php
if ( isset ( $_POST["epr"] ) ) {
$_SESSION['END_POINT'] = $_POST["epr"];
}
$endpoint = isset( $_SESSION['END_POINT'] ) ? $_SESSION['END_POINT'] : 'http://sugar.opensource.colosa.net/soap.php';
if (isset( $_POST["epr"] )) {
$_SESSION['END_POINT'] = $_POST["epr"];
}
$endpoint = isset( $_SESSION['END_POINT'] ) ? $_SESSION['END_POINT'] : 'http://sugar.opensource.colosa.net/soap.php';
$sessionId = isset( $_SESSION['SESSION_ID'] ) ? $_SESSION['SESSION_ID'] : '';
$sessionId = isset( $_SESSION['SESSION_ID'] ) ? $_SESSION['SESSION_ID'] : '';
?>
<form method="post" action="">
<div class="krumo-root">
<ul class="krumo-node krumo-first">
<div class="krumo-element" >
End Point <input type="text" size="80" maxlength="160" name="epr"
value="<?php echo $endpoint ?>" >
<input type="submit" value="change endpoint" name="action">
</div>
</ul>
</div>
</form >
<div class="krumo-root">
<ul class="krumo-node krumo-first">
<div class="krumo-element">
End Point <input type="text" size="80" maxlength="160" name="epr"
value="<?php echo $endpoint ?>"> <input type="submit"
value="change endpoint" name="action">
</div>
</ul>
</div>
</form>
<form method="post" action="">
<div class="krumo-root">
<a class="krumo-name">login</a>
<ul class="krumo-node krumo-first">
<div >
User Id <input type="text" size="16" maxlength="20" name="user" value="admin">
Password <input type="text" size="16" maxlength="20" name="pass" value="sample">
<input type="submit" value="login" name="action">
</div>
</ul>
</div>
</form >
<div class="krumo-root">
<a class="krumo-name">login</a>
<ul class="krumo-node krumo-first">
<div>
User Id <input type="text" size="16" maxlength="20" name="user"
value="admin"> Password <input type="text" size="16" maxlength="20"
name="pass" value="sample"> <input type="submit" value="login"
name="action">
</div>
</ul>
</div>
</form>
<form method="post" action="">
<div class="krumo-root">
<a class="krumo-name">createUser</a>
<ul class="krumo-node krumo-first">
<div class="krumo-element" >
Session Id <input type="text" size="36" maxlength="32" name="sessionid" value="<?php print $sessionId ?>">
</div>
<div class="krumo-element" >
User Id <input type="text" size="16" maxlength="20" name="userid" value="">
<img src="/Krumo/skins/schablon.com/empty.gif" >
First Name <input type="text" size="16" maxlength="20" name="firstname" value="">
<img src="/Krumo/skins/schablon.com/empty.gif" >
Last Name <input type="text" size="16" maxlength="20" name="lastname" value="">
<img src="/Krumo/skins/schablon.com/empty.gif" >
Email <input type="text" size="16" maxlength="20" name="email" value="">
<img src="/Krumo/skins/schablon.com/empty.gif" >
Role <input type="text" size="16" maxlength="20" name="role" value="">
<img src="/Krumo/skins/schablon.com/empty.gif" >
<input type="submit" value="createUser" name="action">
</div>
</ul>
</div>
</form >
<div class="krumo-root">
<a class="krumo-name">createUser</a>
<ul class="krumo-node krumo-first">
<div class="krumo-element">
Session Id <input type="text" size="36" maxlength="32"
name="sessionid" value="<?php print $sessionId ?>">
</div>
<div class="krumo-element">
User Id <input type="text" size="16" maxlength="20" name="userid"
value=""> <img src="/Krumo/skins/schablon.com/empty.gif"> First
Name <input type="text" size="16" maxlength="20" name="firstname"
value=""> <img src="/Krumo/skins/schablon.com/empty.gif"> Last Name
<input type="text" size="16" maxlength="20" name="lastname" value="">
<img src="/Krumo/skins/schablon.com/empty.gif"> Email <input
type="text" size="16" maxlength="20" name="email" value=""> <img
src="/Krumo/skins/schablon.com/empty.gif"> Role <input type="text"
size="16" maxlength="20" name="role" value=""> <img
src="/Krumo/skins/schablon.com/empty.gif"> <input type="submit"
value="createUser" name="action">
</div>
</ul>
</div>
</form>
<form method="post" action="">
<div class="krumo-root">
<a class="krumo-name">assignUserToGroup</a>
<ul class="krumo-node krumo-first">
<div class="krumo-element" >
Session Id <input type="text" size="36" maxlength="32" name="sessionid" value="<?php print $sessionId ?>">
</div>
<div class="krumo-element" >
User Id <input type="text" size="16" maxlength="20" name="userid" value="">
<img src="/Krumo/skins/schablon.com/empty.gif" >
Group Id <input type="text" size="16" maxlength="20" name="groupid" value="">
<input type="submit" value="assignUserToGroup" name="action">
</div>
</ul>
</div>
</form >
<div class="krumo-root">
<a class="krumo-name">assignUserToGroup</a>
<ul class="krumo-node krumo-first">
<div class="krumo-element">
Session Id <input type="text" size="36" maxlength="32"
name="sessionid" value="<?php print $sessionId ?>">
</div>
<div class="krumo-element">
User Id <input type="text" size="16" maxlength="20" name="userid"
value=""> <img src="/Krumo/skins/schablon.com/empty.gif"> Group Id
<input type="text" size="16" maxlength="20" name="groupid" value="">
<input type="submit" value="assignUserToGroup" name="action">
</div>
</ul>
</div>
</form>
<form method="post" action="">
<div class="krumo-root">
<a class="krumo-name">newCase</a>
<ul class="krumo-node krumo-first">
<div class="krumo-element" >
Session Id <input type="text" size="36" maxlength="32" name="sessionid" value="<?php print $sessionId ?>">
</div>
<div class="krumo-element" >
Process Id <input type="text" size="16" maxlength="20" name="processid" value="">
<img src="/Krumo/skins/schablon.com/empty.gif" >
Variables <input type="text" size="16" maxlength="20" name="variables" value="">
<input type="submit" value="newCase" name="action">
</div>
</ul>
</div>
</form >
<div class="krumo-root">
<a class="krumo-name">newCase</a>
<ul class="krumo-node krumo-first">
<div class="krumo-element">
Session Id <input type="text" size="36" maxlength="32"
name="sessionid" value="<?php print $sessionId ?>">
</div>
<div class="krumo-element">
Process Id <input type="text" size="16" maxlength="20"
name="processid" value=""> <img
src="/Krumo/skins/schablon.com/empty.gif"> Variables <input
type="text" size="16" maxlength="20" name="variables" value=""> <input
type="submit" value="newCase" name="action">
</div>
</ul>
</div>
</form>
<?php
if ( ! isset ( $_POST["action"] ) or $_POST["action"] == 'change endpoint' ) {
die;
}
$action = $_POST["action"];
//krumo ($_POST);
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
switch ( $action ) {
case 'login' :
$user = $_POST["user"];
$pass = md5($_POST["pass"]);
$wsdl = $endpoint;
//$client = new SoapClient( $endpoint );
$client = new SoapClient( null, array(
'location' => $endpoint,
'uri' => 'http://www.sugarcrm.com/sugarcrm',
'soap_version' => SOAP_1_1, //SOAP_1_2 - 1.2 not supported by sugar nusoap
'trace' => 1,
'exceptions' => 0,
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5 ) );
$params = array('user_name'=>$user, 'password'=>$pass , 'version'=>'1' );
$result = $client->__SoapCall('login', array('user_auth'=>$params, 'application_name'=>'ProcessMaker'));
if ( $result->error->number == 0 ) {
$_SESSION['SESSION_ID'] = $result->id;
$session = $result->id;
$res = $client->__getFunctions();
krumo ( $res );
$params = array('session'=>$result->id);
$res = $client->__SoapCall('is_user_admin', array($session) );
if ( $res == 1 ) print "is Administrator user";
if (! isset( $_POST["action"] ) or $_POST["action"] == 'change endpoint') {
die();
}
$action = $_POST["action"];
//krumo ($_POST);
$first_name = 'juan';
$last_name = 'perez';
$phone = '7235131';
$fax = '2454545';
$companyname = 'ABC company';
$prod_desc = 'descripcion del prod 1 ';
$user_guid = '';
$set_entry_params = array(
'session' => $session,
'module_name' => 'Leads',
'name_value_list'=>array(
array('name'=>'last_name', 'value'=> $last_name ),
array('name'=>'status', 'value'=> 'New' ),
array('name'=>'phone_work', 'value'=> $phone ),
array('name'=>'phone_fax', 'value'=> $fax ),
array('name'=>'account_name', 'value'=> $companyname ),
array('name'=>'lead_source', 'value'=> 'Web Site' ),
array('name'=>'description', 'value'=> $prod_desc ),
array('name'=>'email1', 'value'=> 'juan@colosa.com' ),
array('name'=>'assigned_user_id', 'value'=> $user_guid )));
$res = $client->__SoapCall('set_entry', $set_entry_params );
krumo ( $res );
ini_set( "soap.wsdl_cache_enabled", "0" ); // disabling WSDL cache
//$query = "contacts.email1 != '' ";
//$orderby = 'email1 desc ';
$query = '';
$orderby = '';
$fields = array('id','first_name','last_name','account_name','account_id','email1','phone_work' );
$params = array($session, 'Leads', $query, $orderby, 0, $fields, 100, false );
$res = $client->__SoapCall('get_entry_list', $params );
krumo ($res);
}
break;
case 'processList' :
$wsdl = PATH_METHODS . "services" . PATH_SEP . "pmos.wsdl";
$endpoint = $wsdl;
$client = new SoapClient( $endpoint );
$params = array('sessionId'=> $sessionId );
$result = $client->__SoapCall('processesList', array($params));
krumo ( $result );
die;
break;
default :
krumo ( $_POST );die;
}
switch ($action) {
case 'login':
$user = $_POST["user"];
$pass = md5( $_POST["pass"] );
$wsdl = $endpoint;
//$client = new SoapClient( $endpoint );
$client = new SoapClient( null, array ('location' => $endpoint,'uri' => 'http://www.sugarcrm.com/sugarcrm','soap_version' => SOAP_1_1, //SOAP_1_2 - 1.2 not supported by sugar nusoap
'trace' => 1,'exceptions' => 0,'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5
) );
$params = array ('user_name' => $user,'password' => $pass,'version' => '1'
);
$result = $client->__SoapCall( 'login', array ('user_auth' => $params,'application_name' => 'ProcessMaker'
) );
if ($result->error->number == 0) {
$_SESSION['SESSION_ID'] = $result->id;
$session = $result->id;
$res = $client->__getFunctions();
krumo( $res );
$params = array ('session' => $result->id
);
$res = $client->__SoapCall( 'is_user_admin', array ($session
) );
if ($res == 1)
print "is Administrator user";
$first_name = 'juan';
$last_name = 'perez';
$phone = '7235131';
$fax = '2454545';
$companyname = 'ABC company';
$prod_desc = 'descripcion del prod 1 ';
$user_guid = '';
$set_entry_params = array ('session' => $session,'module_name' => 'Leads',
'name_value_list' => array (array ('name' => 'last_name','value' => $last_name
),array ('name' => 'status','value' => 'New'
),array ('name' => 'phone_work','value' => $phone
),array ('name' => 'phone_fax','value' => $fax
),array ('name' => 'account_name','value' => $companyname
),array ('name' => 'lead_source','value' => 'Web Site'
),array ('name' => 'description','value' => $prod_desc
),array ('name' => 'email1','value' => 'juan@colosa.com'
),array ('name' => 'assigned_user_id','value' => $user_guid
)
)
);
$res = $client->__SoapCall( 'set_entry', $set_entry_params );
krumo( $res );
//$query = "contacts.email1 != '' ";
//$orderby = 'email1 desc ';
$query = '';
$orderby = '';
$fields = array ('id','first_name','last_name','account_name','account_id','email1','phone_work'
);
$params = array ($session,'Leads',$query,$orderby,0,$fields,100,false
);
$res = $client->__SoapCall( 'get_entry_list', $params );
krumo( $res );
}
break;
case 'processList':
$wsdl = PATH_METHODS . "services" . PATH_SEP . "pmos.wsdl";
$endpoint = $wsdl;
$client = new SoapClient( $endpoint );
$params = array ('sessionId' => $sessionId
);
$result = $client->__SoapCall( 'processesList', array ($params
) );
krumo( $result );
die();
break;
default:
krumo( $_POST );
die();
}
?>
<div class="krumo-root">
<ul class="krumo-node krumo-first">
<li class="krumo-child">
<div class="krumo-element" >
status_code
(<em class="krumo-type">Integer</em>)
<strong class="krumo-integer"><?php echo $result->error->number ?></strong>
</div>
<div class="krumo-element" >
message
(<em class="krumo-type">string</em>)
<strong class="krumo-integer"><?php echo $result->error->name ?></strong>
</div>
<div class="krumo-element" >
timestamp
(<em class="krumo-type">string</em>)
<strong class="krumo-integer"><?php echo $result->error->description ?></strong>
</div>
</li>
<div class="krumo-element">
status_code (<em class="krumo-type">Integer</em>) <strong
class="krumo-integer"><?php echo $result->error->number ?></strong>
</div>
<div class="krumo-element">
message (<em class="krumo-type">string</em>) <strong
class="krumo-integer"><?php echo $result->error->name ?></strong>
</div>
<div class="krumo-element">
timestamp (<em class="krumo-type">string</em>) <strong
class="krumo-integer"><?php echo $result->error->description ?></strong>
</div>
</li>
</ul>
</div>

View File

@@ -12,26 +12,24 @@
*
* 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.
*
*/
$G_PUBLISH = new Publisher;
$oTemplatePower = new TemplatePower(PATH_TPL . 'services/login_getStarted.html');
$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_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower );
G::RenderPage('publish','raw');
G::RenderPage( 'publish', 'raw' );
?>

View File

@@ -1,140 +1,143 @@
<?php
$request = isset($_REQUEST['action'])? $_REQUEST['action'] : "";
G::LoadClass('serverConfiguration');
$request = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : "";
G::LoadClass( 'serverConfiguration' );
$oServerConf = &serverConf::getSingleton();
$oServerConf->setHeartbeatProperty('HB_BEAT_URL', 'http://heartbeat.processmaker.com/syspmLicenseSrv/en/green/services/beat', 'HEART_BEAT_CONF');
$oServerConf->setHeartbeatProperty( 'HB_BEAT_URL', 'http://heartbeat.processmaker.com/syspmLicenseSrv/en/green/services/beat', 'HEART_BEAT_CONF' );
switch ($request) {
case 'processInformation':
try{
$heartBeatUrl = $oServerConf->getHeartbeatProperty('HB_BEAT_URL','HEART_BEAT_CONF');
//Test connection
if(!(validateConnectivity($heartBeatUrl))){
$oServerConf->setHeartbeatProperty('HB_NEXT_BEAT_DATE',strtotime ( "+1 day" ),'HEART_BEAT_CONF');
throw new Exception("Heartbeat::No connection");
}
//Build Data to be sent
$params=buildData();
try {
$heartBeatUrl = $oServerConf->getHeartbeatProperty( 'HB_BEAT_URL', 'HEART_BEAT_CONF' );
//Test connection
if (! (validateConnectivity( $heartBeatUrl ))) {
$oServerConf->setHeartbeatProperty( 'HB_NEXT_BEAT_DATE', strtotime( "+1 day" ), 'HEART_BEAT_CONF' );
throw new Exception( "Heartbeat::No connection" );
}
//Build Data to be sent
$params = buildData();
//Send the information
postHeartBeat($params);
//Send the information
postHeartBeat( $params );
} catch (Exception $e) {
G::pr($e->getMessage());
G::pr( $e->getMessage() );
}
break;
break;
}
function validateConnectivity($url){
ini_set('allow_url_fopen', 1);
$sContent = file_get_conditional_contents($url);
$sw_connect=true;
//if ($sContent == '' || $sContent === false || strpos ( $sContent, 'address location' ) === false ) { 4
if ($sContent == '' || $sContent === false ) {
$sw_connect=false;
}
return $sw_connect;
function validateConnectivity ($url)
{
ini_set( 'allow_url_fopen', 1 );
$sContent = file_get_conditional_contents( $url );
$sw_connect = true;
//if ($sContent == '' || $sContent === false || strpos ( $sContent, 'address location' ) === false ) { 4
if ($sContent == '' || $sContent === false) {
$sw_connect = false;
}
return $sw_connect;
}
function file_get_conditional_contents($szURL){
function file_get_conditional_contents ($szURL)
{
$pCurl = curl_init ();
curl_setopt ( $pCurl, CURLOPT_URL, $szURL );
curl_setopt ( $pCurl, CURLOPT_RETURNTRANSFER, true );
curl_setopt ( $pCurl, CURLOPT_HEADER, true );
curl_setopt ( $pCurl, CURLOPT_FOLLOWLOCATION, false );
curl_setopt ( $pCurl, CURLOPT_AUTOREFERER, true );
$pCurl = curl_init();
curl_setopt( $pCurl, CURLOPT_URL, $szURL );
curl_setopt( $pCurl, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $pCurl, CURLOPT_HEADER, true );
curl_setopt( $pCurl, CURLOPT_FOLLOWLOCATION, false );
curl_setopt( $pCurl, CURLOPT_AUTOREFERER, true );
//To avoid SSL error
curl_setopt ( $pCurl, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt ( $pCurl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt( $pCurl, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt( $pCurl, CURLOPT_SSL_VERIFYPEER, 0 );
//To avoid timeouts
curl_setopt ( $pCurl, CURLOPT_CONNECTTIMEOUT, 10 );
curl_setopt ( $pCurl, CURLOPT_TIMEOUT, 20 );
curl_setopt( $pCurl, CURLOPT_CONNECTTIMEOUT, 10 );
curl_setopt( $pCurl, CURLOPT_TIMEOUT, 20 );
curl_setopt ( $pCurl, CURLOPT_NOPROGRESS, false);
curl_setopt ( $pCurl, CURLOPT_VERBOSE, true);
curl_setopt( $pCurl, CURLOPT_NOPROGRESS, false );
curl_setopt( $pCurl, CURLOPT_VERBOSE, true );
//Apply proxy settings
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
curl_setopt($pCurl, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
if ($sysConf['proxy_port'] != '') {
curl_setopt($pCurl, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
}
if ($sysConf['proxy_user'] != '') {
curl_setopt($pCurl, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
}
curl_setopt($pCurl, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt( $pCurl, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '') );
if ($sysConf['proxy_port'] != '') {
curl_setopt( $pCurl, CURLOPT_PROXYPORT, $sysConf['proxy_port'] );
}
if ($sysConf['proxy_user'] != '') {
curl_setopt( $pCurl, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '') );
}
curl_setopt( $pCurl, CURLOPT_HTTPHEADER, array ('Expect:'
) );
}
$szContents = curl_exec($pCurl);
$aInfo = curl_getinfo($pCurl);
$szContents = curl_exec( $pCurl );
$aInfo = curl_getinfo( $pCurl );
$curl_session = curl_getinfo($pCurl, CURLINFO_HTTP_CODE);
$headers = curl_getinfo ( $pCurl );
$header = substr ( $szContents, 0, $headers ['header_size'] );
$content = substr ( $szContents, $headers ['header_size'] );
$curl_session = curl_getinfo( $pCurl, CURLINFO_HTTP_CODE );
$headers = curl_getinfo( $pCurl );
$header = substr( $szContents, 0, $headers['header_size'] );
$content = substr( $szContents, $headers['header_size'] );
if($aInfo['http_code'] === 200)
{
if ($aInfo['http_code'] === 200) {
return $content;
}
return false;
}
function buildData(){
require_once ("classes/model/Users.php");
G::LoadClass("serverConfiguration");
G::LoadClass("system");
function buildData ()
{
require_once ("classes/model/Users.php");
$oServerConf = &serverConf::getSingleton();
G::LoadClass( "serverConfiguration" );
G::LoadClass( "system" );
$oServerConf = &serverConf::getSingleton();
$os = '';
if (file_exists ( '/etc/redhat-release' )) {
$fnewsize = filesize ( '/etc/redhat-release' );
$fp = fopen ( '/etc/redhat-release', 'r' );
$os = trim ( fread ( $fp, $fnewsize ) );
fclose ( $fp );
if (file_exists( '/etc/redhat-release' )) {
$fnewsize = filesize( '/etc/redhat-release' );
$fp = fopen( '/etc/redhat-release', 'r' );
$os = trim( fread( $fp, $fnewsize ) );
fclose( $fp );
}
$os .= " (" . PHP_OS . ")";
$params = array ();
$params ['ip'] = getenv ( 'SERVER_ADDR' );
$oServerConf->setHeartbeatProperty('HB_BEAT_INDEX',intval($oServerConf->getHeartbeatProperty('HB_BEAT_INDEX','HEART_BEAT_CONF'))+1,'HEART_BEAT_CONF');
$params = array ();
$params['ip'] = getenv( 'SERVER_ADDR' );
$oServerConf->setHeartbeatProperty( 'HB_BEAT_INDEX', intval( $oServerConf->getHeartbeatProperty( 'HB_BEAT_INDEX', 'HEART_BEAT_CONF' ) ) + 1, 'HEART_BEAT_CONF' );
$params ['index'] = $oServerConf->getHeartbeatProperty('HB_BEAT_INDEX','HEART_BEAT_CONF');//$this->index;
$params ['beatType'] = is_null($oServerConf->getHeartbeatProperty('HB_BEAT_TYPE','HEART_BEAT_CONF'))?"starting":$oServerConf->getHeartbeatProperty('HB_BEAT_TYPE','HEART_BEAT_CONF');//1;//$this->beatType;
$params ['date'] = date ( 'Y-m-d H:i:s' );
$params ['host'] = getenv ( 'SERVER_NAME' );
$params ['os'] = $os;
$params ['webserver'] = getenv ( 'SERVER_SOFTWARE' );
$params ['php'] = phpversion ();
$params ['pmVersion'] = System::getVersion();
if(class_exists('pmLicenseManager')){
$params ['pmProduct'] = 'PMEE';
}else{
$params ['pmProduct'] = 'PMCE';
$params['index'] = $oServerConf->getHeartbeatProperty( 'HB_BEAT_INDEX', 'HEART_BEAT_CONF' ); //$this->index;
$params['beatType'] = is_null( $oServerConf->getHeartbeatProperty( 'HB_BEAT_TYPE', 'HEART_BEAT_CONF' ) ) ? "starting" : $oServerConf->getHeartbeatProperty( 'HB_BEAT_TYPE', 'HEART_BEAT_CONF' ); //1;//$this->beatType;
$params['date'] = date( 'Y-m-d H:i:s' );
$params['host'] = getenv( 'SERVER_NAME' );
$params['os'] = $os;
$params['webserver'] = getenv( 'SERVER_SOFTWARE' );
$params['php'] = phpversion();
$params['pmVersion'] = System::getVersion();
if (class_exists( 'pmLicenseManager' )) {
$params['pmProduct'] = 'PMEE';
} else {
$params['pmProduct'] = 'PMCE';
}
$params ['logins'] = $oServerConf->logins;
$params ['workspaces'] = serialize ( $oServerConf->getWSList () );
$params ['plugins'] = serialize ( $oServerConf->getPluginsList () );
$params ['dbVersion'] = $oServerConf->getDBVersion();
$params['logins'] = $oServerConf->logins;
$params['workspaces'] = serialize( $oServerConf->getWSList() );
$params['plugins'] = serialize( $oServerConf->getPluginsList() );
$params['dbVersion'] = $oServerConf->getDBVersion();
//$params ['errors'] = serialize( $oServerConf->errors );
if($licInfo=$oServerConf->getProperty('LICENSE_INFO')){
$params ['license'] = serialize ( $licInfo );
if ($licInfo = $oServerConf->getProperty( 'LICENSE_INFO' )) {
$params['license'] = serialize( $licInfo );
}
///////
$criteria = new Criteria("workflow");
$criteria = new Criteria( "workflow" );
$criteria->addSelectColumn("COUNT(USERS.USR_UID) AS USERS_NUMBER");
$criteria->add(UsersPeer::USR_UID, null, Criteria::ISNOTNULL);
$criteria->addSelectColumn( "COUNT(USERS.USR_UID) AS USERS_NUMBER" );
$criteria->add( UsersPeer::USR_UID, null, Criteria::ISNOTNULL );
$rs = UsersPeer::doSelectRS($criteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs = UsersPeer::doSelectRS( $criteria );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->next();
$row = $rs->getRow();
@@ -143,14 +146,13 @@ function buildData(){
///////
$ee = null;
if (file_exists(PATH_PLUGINS . "enterprise" . PATH_SEP . "VERSION")) {
$ee = trim(file_get_contents(PATH_PLUGINS . "enterprise" . PATH_SEP . "VERSION"));
}
else {
$pluginRegistry = &PMPluginRegistry::getSingleton();
$details = $pluginRegistry->getPluginDetails("enterprise.php");
if (file_exists( PATH_PLUGINS . "enterprise" . PATH_SEP . "VERSION" )) {
$ee = trim( file_get_contents( PATH_PLUGINS . "enterprise" . PATH_SEP . "VERSION" ) );
} else {
$pluginRegistry = &PMPluginRegistry::getSingleton();
$details = $pluginRegistry->getPluginDetails( "enterprise.php" );
$ee = (!($details == null))? $details->iVersion : null;
$ee = (! ($details == null)) ? $details->iVersion : null;
}
$params["ee"] = $ee;
@@ -161,67 +163,68 @@ function buildData(){
$pluginRegistry = &PMPluginRegistry::getSingleton();
$arrayAddon = array();
$arrayAddon = array ();
if (file_exists(PATH_DATA_SITE . "ee")) {
$arrayAddon = unserialize(trim(file_get_contents(PATH_DATA_SITE . "ee")));
if (file_exists( PATH_DATA_SITE . "ee" )) {
$arrayAddon = unserialize( trim( file_get_contents( PATH_DATA_SITE . "ee" ) ) );
$arrayAddon["enterprise"] = array("sFilename" => "enterprise-1.tar");
$arrayAddon["enterprise"] = array ("sFilename" => "enterprise-1.tar"
);
}
foreach ($arrayAddon as $addon) {
$sFileName = substr($addon["sFilename"], 0, strpos($addon["sFilename"], "-"));
$sFileName = substr( $addon["sFilename"], 0, strpos( $addon["sFilename"], "-" ) );
if (file_exists(PATH_PLUGINS . $sFileName . ".php")) {
$addonDetails = $pluginRegistry->getPluginDetails($sFileName . ".php");
$enabled = 0;
if (file_exists( PATH_PLUGINS . $sFileName . ".php" )) {
$addonDetails = $pluginRegistry->getPluginDetails( $sFileName . ".php" );
$enabled = 0;
if ($addonDetails) {
$enabled = ($addonDetails->enabled)? 1 : 0;
if ($addonDetails) {
$enabled = ($addonDetails->enabled) ? 1 : 0;
}
if ($enabled == 1) {
$addonEnabledNumber = $addonEnabledNumber + 1;
}
$addonNumber = $addonNumber + 1;
}
if ($enabled == 1) {
$addonEnabledNumber = $addonEnabledNumber + 1;
}
$addonNumber = $addonNumber + 1;
}
}
$params["addonNumber"] = $addonNumber;
$params["addonEnabledNumber"] = $addonEnabledNumber;
///////
$licenseID = null;
$licenseID = null;
$licenseType = null;
$licenseDomainWorkspace = null;
$licenseNumber = 0;
if (file_exists(PATH_PLUGINS . "enterprise" . PATH_SEP . "class.pmLicenseManager.php") && class_exists('enterprisePlugin')) {
$licenseManager = &pmLicenseManager::getSingleton();
if (file_exists( PATH_PLUGINS . "enterprise" . PATH_SEP . "class.pmLicenseManager.php" ) && class_exists( 'enterprisePlugin' )) {
$licenseManager = &pmLicenseManager::getSingleton();
preg_match("/^license_(.*).dat$/", $licenseManager->file, $matches);
preg_match( "/^license_(.*).dat$/", $licenseManager->file, $matches );
$licenseID = $matches[1];
$licenseType = $licenseManager->type;
$licenseDomainWorkspace = $licenseManager->info["DOMAIN_WORKSPACE"];
$licenseID = $matches[1];
$licenseType = $licenseManager->type;
$licenseDomainWorkspace = $licenseManager->info["DOMAIN_WORKSPACE"];
///////
$criteria = new Criteria("workflow");
///////
$criteria = new Criteria( "workflow" );
$criteria->addSelectColumn("COUNT(LICENSE_MANAGER.LICENSE_UID) AS LICENSE_NUMBER");
$criteria->add(LicenseManagerPeer::LICENSE_UID, null, Criteria::ISNOTNULL);
$criteria->addSelectColumn( "COUNT(LICENSE_MANAGER.LICENSE_UID) AS LICENSE_NUMBER" );
$criteria->add( LicenseManagerPeer::LICENSE_UID, null, Criteria::ISNOTNULL );
$rs = LicenseManagerPeer::doSelectRS($criteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next();
$row = $rs->getRow();
$rs = LicenseManagerPeer::doSelectRS( $criteria );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->next();
$row = $rs->getRow();
///////
$licenseNumber = ($row["LICENSE_NUMBER"] > 0)? $row["LICENSE_NUMBER"] : count(glob(PATH_DATA_SITE . "licenses" . PATH_SEP . "*.dat"));
///////
$licenseNumber = ($row["LICENSE_NUMBER"] > 0) ? $row["LICENSE_NUMBER"] : count( glob( PATH_DATA_SITE . "licenses" . PATH_SEP . "*.dat" ) );
}
$params["licenseID"] = $licenseID;
$params["licenseID"] = $licenseID;
$params["licenseType"] = $licenseType;
$params["licenseDomainWorkspace"] = $licenseDomainWorkspace;
$params["licenseNumber"] = $licenseNumber;
@@ -229,66 +232,71 @@ function buildData(){
///////
return $params;
}
function postHeartBeat($params) {
if(is_array($params)){
//No matter what happens with the result let's set the nextBeat to 2 hours from now
G::LoadClass ( 'serverConfiguration' );
$oServerConf = & serverConf::getSingleton ();
$oServerConf->setHeartbeatProperty('HB_NEXT_BEAT_DATE',strtotime ( "+2 hour" ),'HEART_BEAT_CONF');
$nextBeatDate = $oServerConf->getHeartbeatProperty('HB_NEXT_BEAT_DATE','HEART_BEAT_CONF');
$heartBeatUrl = $oServerConf->getHeartbeatProperty('HB_BEAT_URL','HEART_BEAT_CONF');
function postHeartBeat ($params)
{
if (is_array( $params )) {
//No matter what happens with the result let's set the nextBeat to 2 hours from now
G::LoadClass( 'serverConfiguration' );
$oServerConf = & serverConf::getSingleton();
$oServerConf->setHeartbeatProperty( 'HB_NEXT_BEAT_DATE', strtotime( "+2 hour" ), 'HEART_BEAT_CONF' );
$nextBeatDate = $oServerConf->getHeartbeatProperty( 'HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF' );
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $heartBeatUrl );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt ( $ch, CURLOPT_HEADER, true );
curl_setopt ( $ch, CURLOPT_FOLLOWLOCATION, false );
curl_setopt ( $ch, CURLOPT_AUTOREFERER, true );
//To avoid SSL error
curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
$heartBeatUrl = $oServerConf->getHeartbeatProperty( 'HB_BEAT_URL', 'HEART_BEAT_CONF' );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $params );
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $heartBeatUrl );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_HEADER, true );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
//To avoid SSL error
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 );
//To avoid timeouts
curl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT, 10 );
curl_setopt ( $ch, CURLOPT_TIMEOUT, 20 );
curl_setopt( $ch, CURLOPT_POST, 1 );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $params );
//To avoid timeouts
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 10 );
curl_setopt( $ch, CURLOPT_TIMEOUT, 20 );
//Apply proxy settings
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
curl_setopt( $ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '') );
if ($sysConf['proxy_port'] != '') {
curl_setopt( $ch, CURLOPT_PROXYPORT, $sysConf['proxy_port'] );
}
if ($sysConf['proxy_user'] != '') {
curl_setopt( $ch, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '') );
}
curl_setopt( $ch, CURLOPT_HTTPHEADER, array ('Expect:'
) );
}
$response = curl_exec( $ch );
$curl_session = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
$headers = curl_getinfo( $ch );
$header = substr( $response, 0, $headers['header_size'] );
$content = substr( $response, $headers['header_size'] );
curl_close( $ch );
if ($headers['http_code'] == 200) {
$oServerConf->setHeartbeatProperty( 'HB_BEAT_TYPE', 'beat', 'HEART_BEAT_CONF' );
$oServerConf->resetLogins();
$oServerConf->setHeartbeatProperty( 'HB_NEXT_BEAT_DATE', strtotime( "+7 day" ), 'HEART_BEAT_CONF' );
//Reset Errors
} else {
//Catch the error
$oServerConf->setHeartbeatProperty( 'HB_NEXT_BEAT_DATE', strtotime( "+1 day" ), 'HEART_BEAT_CONF' );
}
//Apply proxy settings
$sysConf = System::getSystemConfiguration();
if ($sysConf['proxy_host'] != '') {
curl_setopt($ch, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
if ($sysConf['proxy_port'] != '') {
curl_setopt($ch, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
}
if ($sysConf['proxy_user'] != '') {
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
}
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
}
$response = curl_exec ( $ch );
$curl_session = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$headers = curl_getinfo ( $ch );
$header = substr ( $response, 0, $headers ['header_size'] );
$content = substr ( $response, $headers ['header_size'] );
curl_close ( $ch );
if ($headers ['http_code'] == 200) {
$oServerConf->setHeartbeatProperty('HB_BEAT_TYPE','beat','HEART_BEAT_CONF');
$oServerConf->resetLogins ();
$oServerConf->setHeartbeatProperty('HB_NEXT_BEAT_DATE',strtotime ( "+7 day" ),'HEART_BEAT_CONF');
//Reset Errors
} else {
//Catch the error
$oServerConf->setHeartbeatProperty('HB_NEXT_BEAT_DATE',strtotime ( "+1 day" ),'HEART_BEAT_CONF');
}
}
/*
$ch = curl_init ();
@@ -329,4 +337,5 @@ function buildData(){
$this->saveSingleton ();
*/
}
}

View File

@@ -1,449 +1,466 @@
<?php
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
ini_set( "soap.wsdl_cache_enabled", "0" ); // disabling WSDL cache
$wsdl = PATH_METHODS . "services" . PATH_SEP . "pmos.wsdl";
require_once ( "classes/model/Application.php" );
require_once ( "classes/model/AppDelegation.php" );
require_once ( "classes/model/AppThread.php" );
require_once ( "classes/model/Dynaform.php" );
require_once ( "classes/model/Groupwf.php" );
require_once ( "classes/model/InputDocument.php" );
require_once ( "classes/model/Language.php" );
require_once ( "classes/model/OutputDocument.php" );
require_once ( "classes/model/Process.php" );
require_once ( "classes/model/ReportTable.php");
require_once ( "classes/model/ReportVar.php");
require_once ( "classes/model/Step.php" );
require_once ( "classes/model/StepTrigger.php" );
require_once ( "classes/model/Task.php" );
require_once ( "classes/model/TaskUser.php" );
require_once ( "classes/model/Triggers.php" );
require_once ( "classes/model/Users.php" );
require_once ( "classes/model/Session.php" );
require_once ( "classes/model/Content.php" );
$wsdl = PATH_METHODS . "services" . PATH_SEP . "pmos.wsdl";
function login( $params ) {
G::LoadClass('wsBase');
$ws = new wsBase ();
require_once ("classes/model/Application.php");
require_once ("classes/model/AppDelegation.php");
require_once ("classes/model/AppThread.php");
require_once ("classes/model/Dynaform.php");
require_once ("classes/model/Groupwf.php");
require_once ("classes/model/InputDocument.php");
require_once ("classes/model/Language.php");
require_once ("classes/model/OutputDocument.php");
require_once ("classes/model/Process.php");
require_once ("classes/model/ReportTable.php");
require_once ("classes/model/ReportVar.php");
require_once ("classes/model/Step.php");
require_once ("classes/model/StepTrigger.php");
require_once ("classes/model/Task.php");
require_once ("classes/model/TaskUser.php");
require_once ("classes/model/Triggers.php");
require_once ("classes/model/Users.php");
require_once ("classes/model/Session.php");
require_once ("classes/model/Content.php");
function login ($params)
{
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->login( $params->userid, $params->password );
return $res->getPayloadArray ( );
}
return $res->getPayloadArray();
}
function ProcessList( $params ) {
$x = ifPermission( $params->sessionId, 'PM_FACTORY');
function ProcessList ($params)
{
$x = ifPermission( $params->sessionId, 'PM_FACTORY' );
//if you are not an admin user, then this function will return only
//your valid process
if ( $x==0 ) {
G::LoadClass('sessions');
$oSessions = new Sessions();
$session = $oSessions->getSessionUser($params->sessionId);
$userId = $session['USR_UID'];
if ($x == 0) {
G::LoadClass( 'sessions' );
$oSessions = new Sessions();
$session = $oSessions->getSessionUser( $params->sessionId );
$userId = $session['USR_UID'];
G::LoadClass('wsBase');
$ws = new wsBase ();
$res = $ws->processListVerified( $userId );
return $res;
}
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->processListVerified( $userId );
return $res;
}
G::LoadClass('wsBase');
$ws = new wsBase ();
$res = $ws->processList( );
return array("processes" => $res );
}
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->processList();
return array ("processes" => $res
);
}
function RoleList( $params ) {
$x = ifPermission( $params->sessionId, 'PM_USERS');
if($x==0)
{
$result[] = array ( 'guid' => 24, 'name' => 'You do not have privileges' );
return $result;
}
function RoleList ($params)
{
$x = ifPermission( $params->sessionId, 'PM_USERS' );
if ($x == 0) {
$result[] = array ('guid' => 24,'name' => 'You do not have privileges'
);
return $result;
}
G::LoadClass('wsBase');
$ws = new wsBase ();
$res = $ws->roleList( );
return array("roles" => $res );
}
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->roleList();
return array ("roles" => $res
);
}
function GroupList( $params ) {
$x = ifPermission( $params->sessionId, 'PM_USERS');
if($x==0)
{
$result[] = array ( 'guid' => 24, 'name' => 'You do not have privileges' );
return $result;
}
function GroupList ($params)
{
$x = ifPermission( $params->sessionId, 'PM_USERS' );
if ($x == 0) {
$result[] = array ('guid' => 24,'name' => 'You do not have privileges'
);
return $result;
}
G::LoadClass('wsBase');
$ws = new wsBase ();
$res = $ws->groupList( );
return array("groups" => $res );
}
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->groupList();
return array ("groups" => $res
);
}
function CaseList( $params ) {
ifSessionExpiredBreakThis($params->sessionId);
$x = ifPermission( $params->sessionId, 'PM_CASES');
if($x==0)
{
G::LoadClass('wsResponse');
return new wsResponse (9, 'Session expired');
}
function CaseList ($params)
{
ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' );
if ($x == 0) {
G::LoadClass( 'wsResponse' );
return new wsResponse( 9, 'Session expired' );
}
G::LoadClass('sessions');
G::LoadClass( 'sessions' );
$oSessions = new Sessions();
$session = $oSessions->getSessionUser($params->sessionId);
$userId = $session['USR_UID'];
$session = $oSessions->getSessionUser( $params->sessionId );
$userId = $session['USR_UID'];
G::LoadClass('wsBase');
$ws = new wsBase ();
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->caseList( $userId );
return array("cases" => $res );
}
return array ("cases" => $res
);
}
function UserList( $params ) {
$x = ifPermission( $params->sessionId, 'PM_USERS');
if($x==0)
{
$result[] = array ( 'guid' => 24, 'name' => 'You do not have privileges' );
return $result;
}
function UserList ($params)
{
$x = ifPermission( $params->sessionId, 'PM_USERS' );
if ($x == 0) {
$result[] = array ('guid' => 24,'name' => 'You do not have privileges'
);
return $result;
}
G::LoadClass('wsBase');
$ws = new wsBase ();
$res = $ws->userList( );
return array("users" => $res );
}
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->userList();
return array ("users" => $res
);
}
function SendMessage( $params ) {
ifSessionExpiredBreakThis($params->sessionId);
$x = ifPermission( $params->sessionId, 'PM_CASES');
if($x==0)
{ G::LoadClass('wsResponse');
$result = new wsResponse (24, "You do not have privileges");
return $result;
}
G::LoadClass('wsBase');
$ws = new wsBase ();
$res = $ws->sendMessage( $params->caseId,
$params->from,
$params->to,
$params->cc,
$params->bcc,
$params->subject,
$params->template);
return $res->getPayloadArray ( ) ;
}
function SendMessage ($params)
{
ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' );
if ($x == 0) {
G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" );
return $result;
}
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->sendMessage( $params->caseId, $params->from, $params->to, $params->cc, $params->bcc, $params->subject, $params->template );
return $res->getPayloadArray();
}
function getCaseInfo( $params ) {
ifSessionExpiredBreakThis($params->sessionId);
$x = ifPermission( $params->sessionId, 'PM_CASES');
if($x==0)
{ G::LoadClass('wsResponse');
$result = new wsResponse (24, "You do not have privileges");
return $result;
}
G::LoadClass('wsBase');
$ws = new wsBase ();
function getCaseInfo ($params)
{
ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' );
if ($x == 0) {
G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" );
return $result;
}
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->getCaseInfo( $params->caseId, $params->delIndex );
return $res;
}
return $res;
}
function SendVariables( $params ) {
ifSessionExpiredBreakThis($params->sessionId);
$x = ifPermission( $params->sessionId, 'PM_CASES');
if($x==0)
{ G::LoadClass('wsResponse');
$result = new wsResponse (24, "You do not have privileges");
return $result;
function SendVariables ($params)
{
ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' );
if ($x == 0) {
G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" );
return $result;
}
G::LoadClass('wsBase');
$ws = new wsBase ();
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$variables = $params->variables;
if ( is_object ($variables) ) {
$Fields[ $variables->name ]= $variables->value ;
}
if ( is_array ( $variables) ) {
foreach ( $variables as $key=>$val ){
$name = $val->name;
$value = $val->value;
eval('$Fields[ ' . $val->name . ' ]= $val->value ;');
}
}
$params->variables = $Fields;
$res = $ws->sendVariables($params->caseId, $params->variables);
return $res->getPayloadArray ( ) ;
}
function GetVariables( $params ) {
ifSessionExpiredBreakThis($params->sessionId);
$x = ifPermission( $params->sessionId, 'PM_CASES');
if($x==0)
{ G::LoadClass('wsResponse');
$result = new wsResponse (24, "You do not have privileges");
return $result;
if (is_object( $variables )) {
$Fields[$variables->name] = $variables->value;
}
G::LoadClass('wsBase');
$ws = new wsBase ();
$res = $ws->getVariables($params->caseId, $params->variables);
return array("variables" => $res );
}
function DerivateCase( $params ) {
ifSessionExpiredBreakThis($params->sessionId);
$x = ifPermission( $params->sessionId, 'PM_CASES');
if($x==0)
{ G::LoadClass('wsResponse');
$result = new wsResponse (24, "You do not have privileges");
return $result;
if (is_array( $variables )) {
foreach ($variables as $key => $val) {
$name = $val->name;
$value = $val->value;
eval( '$Fields[ ' . $val->name . ' ]= $val->value ;' );
}
}
$params->variables = $Fields;
$res = $ws->sendVariables( $params->caseId, $params->variables );
return $res->getPayloadArray();
}
function GetVariables ($params)
{
ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' );
if ($x == 0) {
G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" );
return $result;
}
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->getVariables( $params->caseId, $params->variables );
return array ("variables" => $res
);
}
function DerivateCase ($params)
{
ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' );
if ($x == 0) {
G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" );
return $result;
}
$oSession = new Sessions();
$user = $oSession->getSessionUser($params->sessionId);
$user = $oSession->getSessionUser( $params->sessionId );
G::LoadClass('wsBase');
$ws = new wsBase ();
$res = $ws->derivateCase($user['USR_UID'], $params->caseId, $params->delIndex);
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->derivateCase( $user['USR_UID'], $params->caseId, $params->delIndex );
return $res;
//return $res->getPayloadArray ( );
}
}
function executeTrigger ( $params ) {
ifSessionExpiredBreakThis($params->sessionId);
$x = ifPermission( $params->sessionId, 'PM_CASES');
if($x==0)
{ G::LoadClass('wsResponse');
$result = new wsResponse (24, "You do not have privileges");
return $result;
}
function executeTrigger ($params)
{
ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' );
if ($x == 0) {
G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" );
return $result;
}
$oSession = new Sessions();
$user = $oSession->getSessionUser($params->sessionId);
$oSession = new Sessions();
$user = $oSession->getSessionUser( $params->sessionId );
G::LoadClass('wsBase');
$ws = new wsBase ();
$delIndex = ( isset ( $params->delIndex ) ) ? $params->delIndex : 1 ;
$res = $ws->executeTrigger( $user['USR_UID'], $params->caseId, $params->triggerIndex, $delIndex);
return $res->getPayloadArray ( );
}
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$delIndex = (isset( $params->delIndex )) ? $params->delIndex : 1;
$res = $ws->executeTrigger( $user['USR_UID'], $params->caseId, $params->triggerIndex, $delIndex );
return $res->getPayloadArray();
}
function NewCaseImpersonate( $params ) {
ifSessionExpiredBreakThis($params->sessionId);
$x = ifPermission( $params->sessionId, 'PM_CASES');
if($x==0)
{ G::LoadClass('wsResponse');
$result = new wsResponse (24, "You do not have privileges");
return $result;
}
G::LoadClass('wsBase');
$ws = new wsBase ();
function NewCaseImpersonate ($params)
{
ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' );
if ($x == 0) {
G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" );
return $result;
}
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$variables = $params->variables;
foreach ( $variables as $key=>$val ){
$name = $val->name;
foreach ($variables as $key => $val) {
$name = $val->name;
$value = $val->value;
eval('$Fields[ ' . $val->name . ' ]= $val->value ;');
eval( '$Fields[ ' . $val->name . ' ]= $val->value ;' );
}
$params->variables = $Fields;
$res = $ws->newCaseImpersonate($params->processId, $params->userId, $params->variables);
return $res->getPayloadArray ( ) ;
}
$res = $ws->newCaseImpersonate( $params->processId, $params->userId, $params->variables );
return $res->getPayloadArray();
}
function NewCase( $params ) {
G::LoadClass('wsBase');
G::LoadClass('sessions');
ifSessionExpiredBreakThis($params->sessionId);
$x = ifPermission( $params->sessionId, 'PM_CASES');
if($x==0)
{
G::LoadClass('wsResponse');
$result = new wsResponse (24, "You do not have privileges");
function NewCase ($params)
{
G::LoadClass( 'wsBase' );
G::LoadClass( 'sessions' );
ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' );
if ($x == 0) {
G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" );
return $result;
}
}
$oSessions = new Sessions();
$session = $oSessions->getSessionUser($params->sessionId);
$userId = $session['USR_UID'];
$variables = $params->variables;
$session = $oSessions->getSessionUser( $params->sessionId );
$userId = $session['USR_UID'];
$variables = $params->variables;
if (!isset($params->variables) ) {
$variables = array();
$Fields = array();
}
else {
if ( is_object ($variables) ) {
/*foreach ( $variables as $key=>$val ) {
$name = $val->name;
$value = $val->value;
$Fields[ $val->name ]= $val->value ;
}*/
$Fields[ $variables->name ]= $variables->value ;
}
if ( is_array ( $variables) ) {
foreach ( $variables as $key=>$val ) {
$name = $val->name;
$value = $val->value;
if (!is_object($val->value))
{
eval('$Fields[ ' . $val->name . ' ]= $val->value ;');
}
else
{
if (is_array($val->value->item)) {
$i = 1;
foreach ($val->value->item as $key1 => $val1) {
if (isset($val1->value)) {
if (is_array($val1->value->item)) {
foreach ($val1->value->item as $key2 => $val2) {
$Fields[$val->name][$i][$val2->key] = $val2->value;
}
}
}
$i++;
}
}
}
if (! isset( $params->variables )) {
$variables = array ();
$Fields = array ();
} else {
if (is_object( $variables )) {
/*foreach ( $variables as $key=>$val ) {
$name = $val->name;
$value = $val->value;
$Fields[ $val->name ]= $val->value ;
}*/
$Fields[$variables->name] = $variables->value;
}
if (is_array( $variables )) {
foreach ($variables as $key => $val) {
$name = $val->name;
$value = $val->value;
if (! is_object( $val->value )) {
eval( '$Fields[ ' . $val->name . ' ]= $val->value ;' );
} else {
if (is_array( $val->value->item )) {
$i = 1;
foreach ($val->value->item as $key1 => $val1) {
if (isset( $val1->value )) {
if (is_array( $val1->value->item )) {
foreach ($val1->value->item as $key2 => $val2) {
$Fields[$val->name][$i][$val2->key] = $val2->value;
}
}
}
$i ++;
}
}
}
}
}
}
}
$params->variables = $Fields;
//$result = new wsResponse (900, print_r($params->variables,1));
//return $result;
$ws = new wsBase ();
$res = $ws->newCase($params->processId, $userId, $params->taskId, $params->variables);
return $res;
}
$ws = new wsBase();
$res = $ws->newCase( $params->processId, $userId, $params->taskId, $params->variables );
return $res;
}
function AssignUserToGroup( $params ) {
ifSessionExpiredBreakThis($params->sessionId);
$x = ifPermission( $params->sessionId, 'PM_USERS');
if($x==0)
{ G::LoadClass('wsResponse');
$result = new wsResponse (24, "You do not have privileges");
return $result;
}
G::LoadClass('sessions');
$sessions = new Sessions;
$user=$sessions->getSessionUser($params->sessionId);
if(!is_array($user))
{ G::LoadClass('wsResponse');
return new wsResponse (3, 'User not registered in the system');
}
function AssignUserToGroup ($params)
{
ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_USERS' );
if ($x == 0) {
G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" );
return $result;
}
G::LoadClass( 'sessions' );
$sessions = new Sessions();
$user = $sessions->getSessionUser( $params->sessionId );
if (! is_array( $user )) {
G::LoadClass( 'wsResponse' );
return new wsResponse( 3, 'User not registered in the system' );
}
G::LoadClass('wsBase');
$ws = new wsBase ();
$res = $ws->assignUserToGroup( $params->userId, $params->groupId);
return $res->getPayloadArray ( ) ;
}
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->assignUserToGroup( $params->userId, $params->groupId );
return $res->getPayloadArray();
}
function CreateUser( $params ) {
ifSessionExpiredBreakThis($params->sessionId);
$x = ifPermission( $params->sessionId, 'PM_USERS');
if($x==0)
{ G::LoadClass('wsResponse');
$result = new wsResponse (24, "You do not have privileges");
return $result;
}
G::LoadClass('wsBase');
$ws = new wsBase ();
$res = $ws->createUser( $params->userId, $params->firstname, $params->lastname, $params->email, $params->role, $params->password);
return $res->getPayloadArray ( ) ;
}
function CreateUser ($params)
{
ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_USERS' );
if ($x == 0) {
G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" );
return $result;
}
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->createUser( $params->userId, $params->firstname, $params->lastname, $params->email, $params->role, $params->password );
return $res->getPayloadArray();
}
function TaskList( $params ) {
$x = ifPermission( $params->sessionId, 'PM_CASES');
if($x==0)
{
$result[] = array ( 'guid' => 24, 'name' => 'You do not have privileges' );
return $result;
}
G::LoadClass('wsBase');
G::LoadClass('sessions');
$ws = new wsBase ();
function TaskList ($params)
{
$x = ifPermission( $params->sessionId, 'PM_CASES' );
if ($x == 0) {
$result[] = array ('guid' => 24,'name' => 'You do not have privileges'
);
return $result;
}
G::LoadClass( 'wsBase' );
G::LoadClass( 'sessions' );
$ws = new wsBase();
$oSessions = new Sessions();
$session = $oSessions->getSessionUser($params->sessionId);
$userId = $session['USR_UID'];
$session = $oSessions->getSessionUser( $params->sessionId );
$userId = $session['USR_UID'];
$res = $ws->taskList( $userId );
return array("tasks" => $res );
}
return array ("tasks" => $res
);
}
function TaskCase( $params ) {
ifSessionExpiredBreakThis($params->sessionId);
$x = ifPermission( $params->sessionId, 'PM_CASES');
if($x==0)
{
$result[] = array ( 'guid' => 24, 'name' => 'You do not have privileges' );
return $result;
}
G::LoadClass('wsBase');
$ws = new wsBase ();
function TaskCase ($params)
{
ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' );
if ($x == 0) {
$result[] = array ('guid' => 24,'name' => 'You do not have privileges'
);
return $result;
}
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->taskCase( $params->caseId );
return array("taskCases" => $res );
}
return array ("taskCases" => $res
);
}
function ReassignCase( $params ) {
ifSessionExpiredBreakThis($params->sessionId);
function ReassignCase ($params)
{
ifSessionExpiredBreakThis( $params->sessionId );
//G::LoadClass('wsResponse');
//return new wsResponse (1, print_r($params,1));
G::LoadClass('wsBase');
$ws = new wsBase ();
$res = $ws->reassignCase($params->sessionId, $params->caseId, $params->delIndex, $params->userIdSource, $params->userIdTarget );
return $res ;
}
G::LoadClass( 'wsBase' );
$ws = new wsBase();
$res = $ws->reassignCase( $params->sessionId, $params->caseId, $params->delIndex, $params->userIdSource, $params->userIdTarget );
return $res;
}
function ifSessionExpiredBreakThis($sessionId){ #added By Erik AO <erik@colosa.com> in datetime 26.06.2008 10:00:00
G::LoadClass('sessions');
$oSessions = new Sessions();
$session = $oSessions->verifySession($sessionId);
if($session == '') {
G::LoadClass('wsResponse');
return new wsResponse (9, 'Session expired');
function ifSessionExpiredBreakThis ($sessionId)
{ #added By Erik AO <erik@colosa.com> in datetime 26.06.2008 10:00:00
G::LoadClass( 'sessions' );
$oSessions = new Sessions();
$session = $oSessions->verifySession( $sessionId );
if ($session == '') {
G::LoadClass( 'wsResponse' );
return new wsResponse( 9, 'Session expired' );
}
}
function ifPermission ($sessionId, $permission)
{
global $RBAC;
$RBAC->initRBAC();
G::LoadClass( 'sessions' );
$oSession = new Sessions();
$user = $oSession->getSessionUser( $sessionId );
$oRBAC = RBAC::getSingleton();
$oRBAC->loadUserRolePermission( $oRBAC->sSystem, $user['USR_UID'] );
$aPermissions = $oRBAC->aUserInfo[$oRBAC->sSystem]['PERMISSIONS'];
$sw = 0;
foreach ($aPermissions as $aPermission) {
if ($aPermission['PER_CODE'] == $permission) {
$sw = 1;
}
}
function ifPermission( $sessionId, $permission ){
global $RBAC;
$RBAC->initRBAC();
G::LoadClass('sessions');
$oSession = new Sessions();
$user = $oSession->getSessionUser($sessionId);
$oRBAC = RBAC::getSingleton();
$oRBAC->loadUserRolePermission($oRBAC->sSystem, $user['USR_UID']);
$aPermissions = $oRBAC->aUserInfo[$oRBAC->sSystem]['PERMISSIONS'];
$sw=0;
foreach ($aPermissions as $aPermission) {
if ($aPermission['PER_CODE'] == $permission)
{
$sw=1;
}
}
return $sw;
}
}
return $sw;
}
$server = new SoapServer( $wsdl );
$server->addFunction("Login");
$server->addFunction("ProcessList");
$server->addFunction("CaseList");
$server->addFunction("RoleList");
$server->addFunction("GroupList");
$server->addFunction("UserList");
$server->addFunction("SendMessage");
$server->addFunction("SendVariables");
$server->addFunction("GetVariables");
$server->addFunction("DerivateCase");
$server->addFunction("executeTrigger");
$server->addFunction("NewCaseImpersonate");
$server->addFunction("NewCase");
$server->addFunction("AssignUserToGroup");
$server->addFunction("CreateUser");
$server->addFunction("getCaseInfo");
$server->addFunction("TaskList");
$server->addFunction("TaskCase");
$server->addFunction("ReassignCase");
$server->addFunction( "Login" );
$server->addFunction( "ProcessList" );
$server->addFunction( "CaseList" );
$server->addFunction( "RoleList" );
$server->addFunction( "GroupList" );
$server->addFunction( "UserList" );
$server->addFunction( "SendMessage" );
$server->addFunction( "SendVariables" );
$server->addFunction( "GetVariables" );
$server->addFunction( "DerivateCase" );
$server->addFunction( "executeTrigger" );
$server->addFunction( "NewCaseImpersonate" );
$server->addFunction( "NewCase" );
$server->addFunction( "AssignUserToGroup" );
$server->addFunction( "CreateUser" );
$server->addFunction( "getCaseInfo" );
$server->addFunction( "TaskList" );
$server->addFunction( "TaskCase" );
$server->addFunction( "ReassignCase" );
$server->handle();

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');
}
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;
}
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;
}
return true;
}
header('WWW-Authenticate: Basic realm="'.$realm.'"');
header('HTTP/1.0 401 Unauthorized');
die('401 Unauthorized');
return FALSE;
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';
$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 );
$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;");
header( "Content-Type: application/xml;" );
print $content;
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';
$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';
$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 );
$content = str_replace( "___SOAP_ADDRESS___", $endpoint, $content );
header("Content-Type: application/xml;");
header( "Content-Type: application/xml;" );
print $content;
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>";