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

@@ -15,7 +15,6 @@
$oCase = new Cases(); $oCase = new Cases();
$aData = $oCase->startCase( $_POST['TASKS'], $deriva['USR_UID'] ); $aData = $oCase->startCase( $_POST['TASKS'], $deriva['USR_UID'] );
$case = $oCase->loadCase( $aData['APPLICATION'], 1 ); $case = $oCase->loadCase( $aData['APPLICATION'], 1 );
$Fields = array (); $Fields = array ();
@@ -28,39 +27,31 @@
$oCase->updateCase( $aData['APPLICATION'], $Fields ); $oCase->updateCase( $aData['APPLICATION'], $Fields );
$s = 0; $s = 0;
if(isset($_SERVER['HTTP_REFERER'])) if (isset( $_SERVER['HTTP_REFERER'] )) {
{
$dir = explode( '?', $_SERVER['HTTP_REFERER'] ); $dir = explode( '?', $_SERVER['HTTP_REFERER'] );
if($dir[1]=='__flag__=1') if ($dir[1] == '__flag__=1') {
{ $s=1; $s = 1;
} } else {
else
{
$dire = explode( '&', $dir[1] ); $dire = explode( '&', $dir[1] );
for($i=0; $i<=count($dire); $i++) for ($i = 0; $i <= count( $dire ); $i ++) {
{
if ($dire[$i] == '__flag__=1') if ($dire[$i] == '__flag__=1')
$s = 1; $s = 1;
} }
} }
//if(strpos($_SERVER['HTTP_REFERER'],'?') !== false) //if(strpos($_SERVER['HTTP_REFERER'],'?') !== false)
if($s==1) if ($s == 1) {
{ G::header('location: ' . $_SERVER['HTTP_REFERER']); G::header( 'location: ' . $_SERVER['HTTP_REFERER'] );
} else {
G::header( 'location: ' . $_SERVER['HTTP_REFERER'] . '?__flag__=1' );
} }
else } else
{ G::header('location: ' . $_SERVER['HTTP_REFERER'] . '?__flag__=1');
}
}
else
echo G::LoadTranslation( 'ID_REQUEST_SENT' ); echo G::LoadTranslation( 'ID_REQUEST_SENT' );
} } catch (Exception $e) {
catch ( Exception $e ) { $G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher;
$aMessage['MESSAGE'] = $e->getMessage(); $aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish' ); G::RenderPage( 'publish' );
} }
?>

View File

@@ -8,21 +8,26 @@ ul.krumo-node {
padding: 0px; padding: 0px;
background-color: white; background-color: white;
} }
ul.krumo-node ul { ul.krumo-node ul {
margin-left: 20px; margin-left: 20px;
} }
* html ul.krumo-node ul { * html ul.krumo-node ul {
margin-left: 24px; margin-left: 24px;
} }
div.krumo-root { div.krumo-root {
border: solid 1px black; border: solid 1px black;
margin: 1em 0em; margin: 1em 0em;
text-align: left; text-align: left;
} }
ul.krumo-first { ul.krumo-first {
font: normal 11px tahoma, verdana; font: normal 11px tahoma, verdana;
border: solid 1px white; border: solid 1px white;
} }
li.krumo-child { li.krumo-child {
display: block; display: block;
list-style: none; list-style: none;
@@ -30,22 +35,24 @@ li.krumo-child {
margin: 0px; margin: 0px;
overflow: hidden; overflow: hidden;
} }
div.krumo-element { div.krumo-element {
cursor: default; cursor: default;
display: block; display: block;
clear: both; clear: both;
white-space: nowrap; white-space: nowrap;
background-color: white; background-color: white;
background-image: url(/Krumo/skins/schablon.com/empty.gif); background-image: url(/Krumo/skins/schablon.com/empty.gif);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: 6px 5px; background-position: 6px 5px;
padding: 2px 0px 3px 20px; padding: 2px 0px 3px 20px;
} }
* html div.krumo-element { * html div.krumo-element {
padding-bottom: 3px; padding-bottom: 3px;
line-height: 13px; line-height: 13px;
} }
a.krumo-name { a.krumo-name {
color: navy; color: navy;
font: bold 13px courier new; font: bold 13px courier new;
@@ -67,8 +74,8 @@ a.krumo-name {
<ul class="krumo-node krumo-first"> <ul class="krumo-node krumo-first">
<div class="krumo-element"> <div class="krumo-element">
End Point <input type="text" size="80" maxlength="160" name="epr" End Point <input type="text" size="80" maxlength="160" name="epr"
value="<?php echo $endpoint ?>" > value="<?php echo $endpoint ?>"> <input type="submit"
<input type="submit" value="change endpoint" name="action"> value="change endpoint" name="action">
</div> </div>
</ul> </ul>
</div> </div>
@@ -79,9 +86,10 @@ a.krumo-name {
<a class="krumo-name">login</a> <a class="krumo-name">login</a>
<ul class="krumo-node krumo-first"> <ul class="krumo-node krumo-first">
<div> <div>
User Id <input type="text" size="16" maxlength="20" name="user" value="admin"> User Id <input type="text" size="16" maxlength="20" name="user"
Password <input type="text" size="16" maxlength="20" name="pass" value="sample"> value="admin"> Password <input type="text" size="16" maxlength="20"
<input type="submit" value="login" name="action"> name="pass" value="sample"> <input type="submit" value="login"
name="action">
</div> </div>
</ul> </ul>
</div> </div>
@@ -92,20 +100,21 @@ a.krumo-name {
<a class="krumo-name">createUser</a> <a class="krumo-name">createUser</a>
<ul class="krumo-node krumo-first"> <ul class="krumo-node krumo-first">
<div class="krumo-element"> <div class="krumo-element">
Session Id <input type="text" size="36" maxlength="32" name="sessionid" value="<?php print $sessionId ?>"> Session Id <input type="text" size="36" maxlength="32"
name="sessionid" value="<?php print $sessionId ?>">
</div> </div>
<div class="krumo-element"> <div class="krumo-element">
User Id <input type="text" size="16" maxlength="20" name="userid" value=""> User Id <input type="text" size="16" maxlength="20" name="userid"
<img src="/Krumo/skins/schablon.com/empty.gif" > value=""> <img src="/Krumo/skins/schablon.com/empty.gif"> First
First Name <input type="text" size="16" maxlength="20" name="firstname" value=""> Name <input type="text" size="16" maxlength="20" name="firstname"
<img src="/Krumo/skins/schablon.com/empty.gif" > value=""> <img src="/Krumo/skins/schablon.com/empty.gif"> Last Name
Last Name <input type="text" size="16" maxlength="20" name="lastname" value=""> <input type="text" size="16" maxlength="20" name="lastname" value="">
<img src="/Krumo/skins/schablon.com/empty.gif" > <img src="/Krumo/skins/schablon.com/empty.gif"> Email <input
Email <input type="text" size="16" maxlength="20" name="email" value=""> type="text" size="16" maxlength="20" name="email" value=""> <img
<img src="/Krumo/skins/schablon.com/empty.gif" > src="/Krumo/skins/schablon.com/empty.gif"> Role <input type="text"
Role <input type="text" size="16" maxlength="20" name="role" value=""> size="16" maxlength="20" name="role" value=""> <img
<img src="/Krumo/skins/schablon.com/empty.gif" > src="/Krumo/skins/schablon.com/empty.gif"> <input type="submit"
<input type="submit" value="createUser" name="action"> value="createUser" name="action">
</div> </div>
</ul> </ul>
</div> </div>
@@ -116,12 +125,13 @@ a.krumo-name {
<a class="krumo-name">assignUserToGroup</a> <a class="krumo-name">assignUserToGroup</a>
<ul class="krumo-node krumo-first"> <ul class="krumo-node krumo-first">
<div class="krumo-element"> <div class="krumo-element">
Session Id <input type="text" size="36" maxlength="32" name="sessionid" value="<?php print $sessionId ?>"> Session Id <input type="text" size="36" maxlength="32"
name="sessionid" value="<?php print $sessionId ?>">
</div> </div>
<div class="krumo-element"> <div class="krumo-element">
User Id <input type="text" size="16" maxlength="20" name="userid" value=""> User Id <input type="text" size="16" maxlength="20" name="userid"
<img src="/Krumo/skins/schablon.com/empty.gif" > value=""> <img src="/Krumo/skins/schablon.com/empty.gif"> Group Id
Group Id <input type="text" size="16" maxlength="20" name="groupid" value=""> <input type="text" size="16" maxlength="20" name="groupid" value="">
<input type="submit" value="assignUserToGroup" name="action"> <input type="submit" value="assignUserToGroup" name="action">
</div> </div>
</ul> </ul>
@@ -134,13 +144,15 @@ a.krumo-name {
<a class="krumo-name">newCase</a> <a class="krumo-name">newCase</a>
<ul class="krumo-node krumo-first"> <ul class="krumo-node krumo-first">
<div class="krumo-element"> <div class="krumo-element">
Session Id <input type="text" size="36" maxlength="32" name="sessionid" value="<?php print $sessionId ?>"> Session Id <input type="text" size="36" maxlength="32"
name="sessionid" value="<?php print $sessionId ?>">
</div> </div>
<div class="krumo-element"> <div class="krumo-element">
Process Id <input type="text" size="16" maxlength="20" name="processid" value=""> Process Id <input type="text" size="16" maxlength="20"
<img src="/Krumo/skins/schablon.com/empty.gif" > name="processid" value=""> <img
Variables <input type="text" size="16" maxlength="20" name="variables" value=""> src="/Krumo/skins/schablon.com/empty.gif"> Variables <input
<input type="submit" value="newCase" name="action"> type="text" size="16" maxlength="20" name="variables" value=""> <input
type="submit" value="newCase" name="action">
</div> </div>
</ul> </ul>
</div> </div>
@@ -149,29 +161,29 @@ a.krumo-name {
<?php <?php
if (! isset( $_POST["action"] ) or $_POST["action"] == 'change endpoint') { if (! isset( $_POST["action"] ) or $_POST["action"] == 'change endpoint') {
die; die();
} }
$action = $_POST["action"]; $action = $_POST["action"];
//krumo ($_POST); //krumo ($_POST);
ini_set( "soap.wsdl_cache_enabled", "0" ); // disabling WSDL cache ini_set( "soap.wsdl_cache_enabled", "0" ); // disabling WSDL cache
switch ($action) { switch ($action) {
case 'login': case 'login':
$user = $_POST["user"]; $user = $_POST["user"];
$pass = md5( $_POST["pass"] ); $pass = md5( $_POST["pass"] );
$wsdl = $endpoint; $wsdl = $endpoint;
//$client = new SoapClient( $endpoint ); //$client = new SoapClient( $endpoint );
$client = new SoapClient( null, array( $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
'location' => $endpoint, 'trace' => 1,'exceptions' => 0,'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5
'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' ); $params = array ('user_name' => $user,'password' => $pass,'version' => '1'
$result = $client->__SoapCall('login', array('user_auth'=>$params, 'application_name'=>'ProcessMaker')); );
$result = $client->__SoapCall( 'login', array ('user_auth' => $params,'application_name' => 'ProcessMaker'
) );
if ($result->error->number == 0) { if ($result->error->number == 0) {
$_SESSION['SESSION_ID'] = $result->id; $_SESSION['SESSION_ID'] = $result->id;
$session = $result->id; $session = $result->id;
@@ -179,10 +191,12 @@ a.krumo-name {
$res = $client->__getFunctions(); $res = $client->__getFunctions();
krumo( $res ); krumo( $res );
$params = array('session'=>$result->id); $params = array ('session' => $result->id
$res = $client->__SoapCall('is_user_admin', array($session) ); );
if ( $res == 1 ) print "is Administrator user"; $res = $client->__SoapCall( 'is_user_admin', array ($session
) );
if ($res == 1)
print "is Administrator user";
$first_name = 'juan'; $first_name = 'juan';
$last_name = 'perez'; $last_name = 'perez';
@@ -191,19 +205,19 @@ a.krumo-name {
$companyname = 'ABC company'; $companyname = 'ABC company';
$prod_desc = 'descripcion del prod 1 '; $prod_desc = 'descripcion del prod 1 ';
$user_guid = ''; $user_guid = '';
$set_entry_params = array( $set_entry_params = array ('session' => $session,'module_name' => 'Leads',
'session' => $session, 'name_value_list' => array (array ('name' => 'last_name','value' => $last_name
'module_name' => 'Leads', ),array ('name' => 'status','value' => 'New'
'name_value_list'=>array( ),array ('name' => 'phone_work','value' => $phone
array('name'=>'last_name', 'value'=> $last_name ), ),array ('name' => 'phone_fax','value' => $fax
array('name'=>'status', 'value'=> 'New' ), ),array ('name' => 'account_name','value' => $companyname
array('name'=>'phone_work', 'value'=> $phone ), ),array ('name' => 'lead_source','value' => 'Web Site'
array('name'=>'phone_fax', 'value'=> $fax ), ),array ('name' => 'description','value' => $prod_desc
array('name'=>'account_name', 'value'=> $companyname ), ),array ('name' => 'email1','value' => 'juan@colosa.com'
array('name'=>'lead_source', 'value'=> 'Web Site' ), ),array ('name' => 'assigned_user_id','value' => $user_guid
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 ); $res = $client->__SoapCall( 'set_entry', $set_entry_params );
krumo( $res ); krumo( $res );
@@ -211,8 +225,10 @@ a.krumo-name {
//$orderby = 'email1 desc '; //$orderby = 'email1 desc ';
$query = ''; $query = '';
$orderby = ''; $orderby = '';
$fields = array('id','first_name','last_name','account_name','account_id','email1','phone_work' ); $fields = array ('id','first_name','last_name','account_name','account_id','email1','phone_work'
$params = array($session, 'Leads', $query, $orderby, 0, $fields, 100, false ); );
$params = array ($session,'Leads',$query,$orderby,0,$fields,100,false
);
$res = $client->__SoapCall( 'get_entry_list', $params ); $res = $client->__SoapCall( 'get_entry_list', $params );
krumo( $res ); krumo( $res );
} }
@@ -221,14 +237,17 @@ a.krumo-name {
$wsdl = PATH_METHODS . "services" . PATH_SEP . "pmos.wsdl"; $wsdl = PATH_METHODS . "services" . PATH_SEP . "pmos.wsdl";
$endpoint = $wsdl; $endpoint = $wsdl;
$client = new SoapClient( $endpoint ); $client = new SoapClient( $endpoint );
$params = array('sessionId'=> $sessionId ); $params = array ('sessionId' => $sessionId
$result = $client->__SoapCall('processesList', array($params)); );
$result = $client->__SoapCall( 'processesList', array ($params
) );
krumo( $result ); krumo( $result );
die; die();
break; break;
default: default:
krumo ( $_POST );die; krumo( $_POST );
die();
} }
?> ?>
@@ -236,23 +255,19 @@ a.krumo-name {
<ul class="krumo-node krumo-first"> <ul class="krumo-node krumo-first">
<li class="krumo-child"> <li class="krumo-child">
<div class="krumo-element"> <div class="krumo-element">
status_code status_code (<em class="krumo-type">Integer</em>) <strong
(<em class="krumo-type">Integer</em>) class="krumo-integer"><?php echo $result->error->number ?></strong>
<strong class="krumo-integer"><?php echo $result->error->number ?></strong>
</div> </div>
<div class="krumo-element"> <div class="krumo-element">
message message (<em class="krumo-type">string</em>) <strong
(<em class="krumo-type">string</em>) class="krumo-integer"><?php echo $result->error->name ?></strong>
<strong class="krumo-integer"><?php echo $result->error->name ?></strong>
</div> </div>
<div class="krumo-element"> <div class="krumo-element">
timestamp timestamp (<em class="krumo-type">string</em>) <strong
(<em class="krumo-type">string</em>) class="krumo-integer"><?php echo $result->error->description ?></strong>
<strong class="krumo-integer"><?php echo $result->error->description ?></strong>
</div> </div>
</li> </li>
</ul> </ul>
</div> </div>

View File

@@ -20,9 +20,8 @@
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
$G_PUBLISH = new Publisher; $G_PUBLISH = new Publisher();
$oTemplatePower = new TemplatePower( PATH_TPL . 'services/login_getStarted.html' ); $oTemplatePower = new TemplatePower( PATH_TPL . 'services/login_getStarted.html' );
$oTemplatePower->prepare(); $oTemplatePower->prepare();
/* /*
@@ -34,4 +33,3 @@ $G_PUBLISH->AddContent('template', '', '', '', $oTemplatePower);
G::RenderPage( 'publish', 'raw' ); G::RenderPage( 'publish', 'raw' );
?>

View File

@@ -24,7 +24,8 @@ switch ($request) {
break; break;
} }
function validateConnectivity($url){ function validateConnectivity ($url)
{
ini_set( 'allow_url_fopen', 1 ); ini_set( 'allow_url_fopen', 1 );
$sContent = file_get_conditional_contents( $url ); $sContent = file_get_conditional_contents( $url );
$sw_connect = true; $sw_connect = true;
@@ -34,8 +35,9 @@ function validateConnectivity($url){
} }
return $sw_connect; return $sw_connect;
} }
function file_get_conditional_contents($szURL){
function file_get_conditional_contents ($szURL)
{
$pCurl = curl_init(); $pCurl = curl_init();
curl_setopt( $pCurl, CURLOPT_URL, $szURL ); curl_setopt( $pCurl, CURLOPT_URL, $szURL );
@@ -64,7 +66,8 @@ function file_get_conditional_contents($szURL){
if ($sysConf['proxy_user'] != '') { if ($sysConf['proxy_user'] != '') {
curl_setopt( $pCurl, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '') ); 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_HTTPHEADER, array ('Expect:'
) );
} }
$szContents = curl_exec( $pCurl ); $szContents = curl_exec( $pCurl );
@@ -75,15 +78,15 @@ function file_get_conditional_contents($szURL){
$header = substr( $szContents, 0, $headers['header_size'] ); $header = substr( $szContents, 0, $headers['header_size'] );
$content = substr( $szContents, $headers['header_size'] ); $content = substr( $szContents, $headers['header_size'] );
if ($aInfo['http_code'] === 200) {
if($aInfo['http_code'] === 200)
{
return $content; return $content;
} }
return false; return false;
} }
function buildData(){
function buildData ()
{
require_once ("classes/model/Users.php"); require_once ("classes/model/Users.php");
G::LoadClass( "serverConfiguration" ); G::LoadClass( "serverConfiguration" );
@@ -145,8 +148,7 @@ function buildData(){
if (file_exists( PATH_PLUGINS . "enterprise" . PATH_SEP . "VERSION" )) { if (file_exists( PATH_PLUGINS . "enterprise" . PATH_SEP . "VERSION" )) {
$ee = trim( file_get_contents( PATH_PLUGINS . "enterprise" . PATH_SEP . "VERSION" ) ); $ee = trim( file_get_contents( PATH_PLUGINS . "enterprise" . PATH_SEP . "VERSION" ) );
} } else {
else {
$pluginRegistry = &PMPluginRegistry::getSingleton(); $pluginRegistry = &PMPluginRegistry::getSingleton();
$details = $pluginRegistry->getPluginDetails( "enterprise.php" ); $details = $pluginRegistry->getPluginDetails( "enterprise.php" );
@@ -166,7 +168,8 @@ function buildData(){
if (file_exists( PATH_DATA_SITE . "ee" )) { if (file_exists( PATH_DATA_SITE . "ee" )) {
$arrayAddon = unserialize( trim( file_get_contents( 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) { foreach ($arrayAddon as $addon) {
@@ -229,7 +232,9 @@ function buildData(){
/////// ///////
return $params; return $params;
} }
function postHeartBeat($params) {
function postHeartBeat ($params)
{
if (is_array( $params )) { if (is_array( $params )) {
//No matter what happens with the result let's set the nextBeat to 2 hours from now //No matter what happens with the result let's set the nextBeat to 2 hours from now
G::LoadClass( 'serverConfiguration' ); G::LoadClass( 'serverConfiguration' );
@@ -266,7 +271,8 @@ function buildData(){
if ($sysConf['proxy_user'] != '') { if ($sysConf['proxy_user'] != '') {
curl_setopt( $ch, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '') ); curl_setopt( $ch, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : '') );
} }
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); curl_setopt( $ch, CURLOPT_HTTPHEADER, array ('Expect:'
) );
} }
$response = curl_exec( $ch ); $response = curl_exec( $ch );
@@ -282,9 +288,11 @@ function buildData(){
$oServerConf->setHeartbeatProperty( 'HB_NEXT_BEAT_DATE', strtotime( "+7 day" ), 'HEART_BEAT_CONF' ); $oServerConf->setHeartbeatProperty( 'HB_NEXT_BEAT_DATE', strtotime( "+7 day" ), 'HEART_BEAT_CONF' );
//Reset Errors //Reset Errors
} else { } else {
//Catch the error //Catch the error
$oServerConf->setHeartbeatProperty( 'HB_NEXT_BEAT_DATE', strtotime( "+1 day" ), 'HEART_BEAT_CONF' ); $oServerConf->setHeartbeatProperty( 'HB_NEXT_BEAT_DATE', strtotime( "+1 day" ), 'HEART_BEAT_CONF' );
} }
@@ -330,3 +338,4 @@ function buildData(){
$this->saveSingleton (); $this->saveSingleton ();
*/ */
} }

View File

@@ -1,6 +1,7 @@
<?php <?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"; $wsdl = PATH_METHODS . "services" . PATH_SEP . "pmos.wsdl";
require_once ("classes/model/Application.php"); require_once ("classes/model/Application.php");
@@ -23,14 +24,16 @@
require_once ("classes/model/Session.php"); require_once ("classes/model/Session.php");
require_once ("classes/model/Content.php"); require_once ("classes/model/Content.php");
function login( $params ) { function login ($params)
{
G::LoadClass( 'wsBase' ); G::LoadClass( 'wsBase' );
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->login( $params->userid, $params->password ); $res = $ws->login( $params->userid, $params->password );
return $res->getPayloadArray(); return $res->getPayloadArray();
} }
function ProcessList( $params ) { function ProcessList ($params)
{
$x = ifPermission( $params->sessionId, 'PM_FACTORY' ); $x = ifPermission( $params->sessionId, 'PM_FACTORY' );
//if you are not an admin user, then this function will return only //if you are not an admin user, then this function will return only
//your valid process //your valid process
@@ -49,42 +52,47 @@
G::LoadClass( 'wsBase' ); G::LoadClass( 'wsBase' );
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->processList(); $res = $ws->processList();
return array("processes" => $res ); return array ("processes" => $res
);
} }
function RoleList( $params ) { function RoleList ($params)
$x = ifPermission( $params->sessionId, 'PM_USERS');
if($x==0)
{ {
$result[] = array ( 'guid' => 24, 'name' => 'You do not have privileges' ); $x = ifPermission( $params->sessionId, 'PM_USERS' );
if ($x == 0) {
$result[] = array ('guid' => 24,'name' => 'You do not have privileges'
);
return $result; return $result;
} }
G::LoadClass( 'wsBase' ); G::LoadClass( 'wsBase' );
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->roleList(); $res = $ws->roleList();
return array("roles" => $res ); return array ("roles" => $res
);
} }
function GroupList( $params ) { function GroupList ($params)
$x = ifPermission( $params->sessionId, 'PM_USERS');
if($x==0)
{ {
$result[] = array ( 'guid' => 24, 'name' => 'You do not have privileges' ); $x = ifPermission( $params->sessionId, 'PM_USERS' );
if ($x == 0) {
$result[] = array ('guid' => 24,'name' => 'You do not have privileges'
);
return $result; return $result;
} }
G::LoadClass( 'wsBase' ); G::LoadClass( 'wsBase' );
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->groupList(); $res = $ws->groupList();
return array("groups" => $res ); return array ("groups" => $res
);
} }
function CaseList( $params ) { function CaseList ($params)
{
ifSessionExpiredBreakThis( $params->sessionId ); ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' ); $x = ifPermission( $params->sessionId, 'PM_CASES' );
if($x==0) if ($x == 0) {
{
G::LoadClass( 'wsResponse' ); G::LoadClass( 'wsResponse' );
return new wsResponse( 9, 'Session expired' ); return new wsResponse( 9, 'Session expired' );
} }
@@ -97,48 +105,47 @@
G::LoadClass( 'wsBase' ); G::LoadClass( 'wsBase' );
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->caseList( $userId ); $res = $ws->caseList( $userId );
return array("cases" => $res ); return array ("cases" => $res
);
} }
function UserList( $params ) { function UserList ($params)
$x = ifPermission( $params->sessionId, 'PM_USERS');
if($x==0)
{ {
$result[] = array ( 'guid' => 24, 'name' => 'You do not have privileges' ); $x = ifPermission( $params->sessionId, 'PM_USERS' );
if ($x == 0) {
$result[] = array ('guid' => 24,'name' => 'You do not have privileges'
);
return $result; return $result;
} }
G::LoadClass( 'wsBase' ); G::LoadClass( 'wsBase' );
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->userList(); $res = $ws->userList();
return array("users" => $res ); return array ("users" => $res
);
} }
function SendMessage( $params ) { function SendMessage ($params)
{
ifSessionExpiredBreakThis( $params->sessionId ); ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' ); $x = ifPermission( $params->sessionId, 'PM_CASES' );
if($x==0) if ($x == 0) {
{ G::LoadClass('wsResponse'); G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" ); $result = new wsResponse( 24, "You do not have privileges" );
return $result; return $result;
} }
G::LoadClass( 'wsBase' ); G::LoadClass( 'wsBase' );
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->sendMessage( $params->caseId, $res = $ws->sendMessage( $params->caseId, $params->from, $params->to, $params->cc, $params->bcc, $params->subject, $params->template );
$params->from,
$params->to,
$params->cc,
$params->bcc,
$params->subject,
$params->template);
return $res->getPayloadArray(); return $res->getPayloadArray();
} }
function getCaseInfo( $params ) { function getCaseInfo ($params)
{
ifSessionExpiredBreakThis( $params->sessionId ); ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' ); $x = ifPermission( $params->sessionId, 'PM_CASES' );
if($x==0) if ($x == 0) {
{ G::LoadClass('wsResponse'); G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" ); $result = new wsResponse( 24, "You do not have privileges" );
return $result; return $result;
} }
@@ -148,11 +155,12 @@
return $res; return $res;
} }
function SendVariables( $params ) { function SendVariables ($params)
{
ifSessionExpiredBreakThis( $params->sessionId ); ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' ); $x = ifPermission( $params->sessionId, 'PM_CASES' );
if($x==0) if ($x == 0) {
{ G::LoadClass('wsResponse'); G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" ); $result = new wsResponse( 24, "You do not have privileges" );
return $result; return $result;
} }
@@ -175,11 +183,12 @@
return $res->getPayloadArray(); return $res->getPayloadArray();
} }
function GetVariables( $params ) { function GetVariables ($params)
{
ifSessionExpiredBreakThis( $params->sessionId ); ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' ); $x = ifPermission( $params->sessionId, 'PM_CASES' );
if($x==0) if ($x == 0) {
{ G::LoadClass('wsResponse'); G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" ); $result = new wsResponse( 24, "You do not have privileges" );
return $result; return $result;
} }
@@ -188,14 +197,16 @@
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->getVariables( $params->caseId, $params->variables ); $res = $ws->getVariables( $params->caseId, $params->variables );
return array("variables" => $res ); return array ("variables" => $res
);
} }
function DerivateCase( $params ) { function DerivateCase ($params)
{
ifSessionExpiredBreakThis( $params->sessionId ); ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' ); $x = ifPermission( $params->sessionId, 'PM_CASES' );
if($x==0) if ($x == 0) {
{ G::LoadClass('wsResponse'); G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" ); $result = new wsResponse( 24, "You do not have privileges" );
return $result; return $result;
} }
@@ -211,11 +222,12 @@
//return $res->getPayloadArray ( ); //return $res->getPayloadArray ( );
} }
function executeTrigger ( $params ) { function executeTrigger ($params)
{
ifSessionExpiredBreakThis( $params->sessionId ); ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' ); $x = ifPermission( $params->sessionId, 'PM_CASES' );
if($x==0) if ($x == 0) {
{ G::LoadClass('wsResponse'); G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" ); $result = new wsResponse( 24, "You do not have privileges" );
return $result; return $result;
} }
@@ -230,11 +242,12 @@
return $res->getPayloadArray(); return $res->getPayloadArray();
} }
function NewCaseImpersonate( $params ) { function NewCaseImpersonate ($params)
{
ifSessionExpiredBreakThis( $params->sessionId ); ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' ); $x = ifPermission( $params->sessionId, 'PM_CASES' );
if($x==0) if ($x == 0) {
{ G::LoadClass('wsResponse'); G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" ); $result = new wsResponse( 24, "You do not have privileges" );
return $result; return $result;
} }
@@ -251,13 +264,13 @@
return $res->getPayloadArray(); return $res->getPayloadArray();
} }
function NewCase( $params ) { function NewCase ($params)
{
G::LoadClass( 'wsBase' ); G::LoadClass( 'wsBase' );
G::LoadClass( 'sessions' ); G::LoadClass( 'sessions' );
ifSessionExpiredBreakThis( $params->sessionId ); ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' ); $x = ifPermission( $params->sessionId, 'PM_CASES' );
if($x==0) if ($x == 0) {
{
G::LoadClass( 'wsResponse' ); G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" ); $result = new wsResponse( 24, "You do not have privileges" );
return $result; return $result;
@@ -271,8 +284,7 @@
if (! isset( $params->variables )) { if (! isset( $params->variables )) {
$variables = array (); $variables = array ();
$Fields = array (); $Fields = array ();
} } else {
else {
if (is_object( $variables )) { if (is_object( $variables )) {
/*foreach ( $variables as $key=>$val ) { /*foreach ( $variables as $key=>$val ) {
$name = $val->name; $name = $val->name;
@@ -286,12 +298,9 @@
foreach ($variables as $key => $val) { foreach ($variables as $key => $val) {
$name = $val->name; $name = $val->name;
$value = $val->value; $value = $val->value;
if (!is_object($val->value)) if (! is_object( $val->value )) {
{
eval( '$Fields[ ' . $val->name . ' ]= $val->value ;' ); eval( '$Fields[ ' . $val->name . ' ]= $val->value ;' );
} } else {
else
{
if (is_array( $val->value->item )) { if (is_array( $val->value->item )) {
$i = 1; $i = 1;
foreach ($val->value->item as $key1 => $val1) { foreach ($val->value->item as $key1 => $val1) {
@@ -318,19 +327,20 @@
return $res; return $res;
} }
function AssignUserToGroup( $params ) { function AssignUserToGroup ($params)
{
ifSessionExpiredBreakThis( $params->sessionId ); ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_USERS' ); $x = ifPermission( $params->sessionId, 'PM_USERS' );
if($x==0) if ($x == 0) {
{ G::LoadClass('wsResponse'); G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" ); $result = new wsResponse( 24, "You do not have privileges" );
return $result; return $result;
} }
G::LoadClass( 'sessions' ); G::LoadClass( 'sessions' );
$sessions = new Sessions; $sessions = new Sessions();
$user = $sessions->getSessionUser( $params->sessionId ); $user = $sessions->getSessionUser( $params->sessionId );
if(!is_array($user)) if (! is_array( $user )) {
{ G::LoadClass('wsResponse'); G::LoadClass( 'wsResponse' );
return new wsResponse( 3, 'User not registered in the system' ); return new wsResponse( 3, 'User not registered in the system' );
} }
@@ -340,11 +350,12 @@
return $res->getPayloadArray(); return $res->getPayloadArray();
} }
function CreateUser( $params ) { function CreateUser ($params)
{
ifSessionExpiredBreakThis( $params->sessionId ); ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_USERS' ); $x = ifPermission( $params->sessionId, 'PM_USERS' );
if($x==0) if ($x == 0) {
{ G::LoadClass('wsResponse'); G::LoadClass( 'wsResponse' );
$result = new wsResponse( 24, "You do not have privileges" ); $result = new wsResponse( 24, "You do not have privileges" );
return $result; return $result;
} }
@@ -354,11 +365,12 @@
return $res->getPayloadArray(); return $res->getPayloadArray();
} }
function TaskList( $params ) { function TaskList ($params)
$x = ifPermission( $params->sessionId, 'PM_CASES');
if($x==0)
{ {
$result[] = array ( 'guid' => 24, 'name' => 'You do not have privileges' ); $x = ifPermission( $params->sessionId, 'PM_CASES' );
if ($x == 0) {
$result[] = array ('guid' => 24,'name' => 'You do not have privileges'
);
return $result; return $result;
} }
G::LoadClass( 'wsBase' ); G::LoadClass( 'wsBase' );
@@ -368,24 +380,28 @@
$session = $oSessions->getSessionUser( $params->sessionId ); $session = $oSessions->getSessionUser( $params->sessionId );
$userId = $session['USR_UID']; $userId = $session['USR_UID'];
$res = $ws->taskList( $userId ); $res = $ws->taskList( $userId );
return array("tasks" => $res ); return array ("tasks" => $res
);
} }
function TaskCase( $params ) { function TaskCase ($params)
{
ifSessionExpiredBreakThis( $params->sessionId ); ifSessionExpiredBreakThis( $params->sessionId );
$x = ifPermission( $params->sessionId, 'PM_CASES' ); $x = ifPermission( $params->sessionId, 'PM_CASES' );
if($x==0) if ($x == 0) {
{ $result[] = array ('guid' => 24,'name' => 'You do not have privileges'
$result[] = array ( 'guid' => 24, 'name' => 'You do not have privileges' ); );
return $result; return $result;
} }
G::LoadClass( 'wsBase' ); G::LoadClass( 'wsBase' );
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->taskCase( $params->caseId ); $res = $ws->taskCase( $params->caseId );
return array("taskCases" => $res ); return array ("taskCases" => $res
);
} }
function ReassignCase( $params ) { function ReassignCase ($params)
{
ifSessionExpiredBreakThis( $params->sessionId ); ifSessionExpiredBreakThis( $params->sessionId );
//G::LoadClass('wsResponse'); //G::LoadClass('wsResponse');
//return new wsResponse (1, print_r($params,1)); //return new wsResponse (1, print_r($params,1));
@@ -395,7 +411,8 @@
return $res; return $res;
} }
function ifSessionExpiredBreakThis($sessionId){ #added By Erik AO <erik@colosa.com> in datetime 26.06.2008 10:00:00 function ifSessionExpiredBreakThis ($sessionId)
{ #added By Erik AO <erik@colosa.com> in datetime 26.06.2008 10:00:00
G::LoadClass( 'sessions' ); G::LoadClass( 'sessions' );
$oSessions = new Sessions(); $oSessions = new Sessions();
$session = $oSessions->verifySession( $sessionId ); $session = $oSessions->verifySession( $sessionId );
@@ -405,7 +422,8 @@
} }
} }
function ifPermission( $sessionId, $permission ){ function ifPermission ($sessionId, $permission)
{
global $RBAC; global $RBAC;
$RBAC->initRBAC(); $RBAC->initRBAC();
G::LoadClass( 'sessions' ); G::LoadClass( 'sessions' );
@@ -417,8 +435,7 @@
$aPermissions = $oRBAC->aUserInfo[$oRBAC->sSystem]['PERMISSIONS']; $aPermissions = $oRBAC->aUserInfo[$oRBAC->sSystem]['PERMISSIONS'];
$sw = 0; $sw = 0;
foreach ($aPermissions as $aPermission) { foreach ($aPermissions as $aPermission) {
if ($aPermission['PER_CODE'] == $permission) if ($aPermission['PER_CODE'] == $permission) {
{
$sw = 1; $sw = 1;
} }
} }

View File

@@ -1,6 +1,7 @@
<?php <?php
ini_set( "soap.wsdl_cache_enabled", "0" ); //disabling WSDL cache ini_set( "soap.wsdl_cache_enabled", "0" ); //disabling WSDL cache
define( 'WEB_SERVICE_VERSION', '2.0' ); define( 'WEB_SERVICE_VERSION', '2.0' );
//$wsdl = PATH_METHODS . "services" . PATH_SEP . "pmos.wsdl"; //$wsdl = PATH_METHODS . "services" . PATH_SEP . "pmos.wsdl";
@@ -35,11 +36,7 @@ function login($params)
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->login( $params->userid, $params->password ); $res = $ws->login( $params->userid, $params->password );
return array( return array ('status_code' => $res->status_code,'message' => $res->message,'version' => WEB_SERVICE_VERSION,'timestamp' => $res->timestamp
'status_code' => $res->status_code,
'message' => $res->message,
'version' => WEB_SERVICE_VERSION,
'timestamp' => $res->timestamp
); );
} }
@@ -51,24 +48,29 @@ function ProcessList($params)
$o->guid = $vsResult->status_code . ' ' . $vsResult->message; $o->guid = $vsResult->status_code . ' ' . $vsResult->message;
$o->name = ''; $o->name = '';
return array("processes" => $o); return array ("processes" => $o
);
} }
if (ifPermission( $params->sessionId, 'PM_CASES' ) != 0) { if (ifPermission( $params->sessionId, 'PM_CASES' ) != 0) {
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->processList(); $res = $ws->processList();
return array("processes" => $res); return array ("processes" => $res
);
} }
if (ifPermission( $params->sessionId, 'PM_FACTORY' ) == 0) { if (ifPermission( $params->sessionId, 'PM_FACTORY' ) == 0) {
$o->guid = "2 Insufficient privileges to execute this function"; $o->guid = "2 Insufficient privileges to execute this function";
$o->name = ''; $o->name = '';
return array("processes" => $o); return array ("processes" => $o
);
} }
/** if you are not an admin user, then this function will return only your valid process **/ /**
* if you are not an admin user, then this function will return only your valid process *
*/
if (ifPermission( $params->sessionId, 'PM_FACTORY' ) == 0) { if (ifPermission( $params->sessionId, 'PM_FACTORY' ) == 0) {
G::LoadClass( 'sessions' ); G::LoadClass( 'sessions' );
@@ -79,13 +81,15 @@ function ProcessList($params)
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->processListVerified( $userId ); $res = $ws->processListVerified( $userId );
return array("processes" => $res); return array ("processes" => $res
);
} }
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->processList(); $res = $ws->processList();
return array("processes" => $res); return array ("processes" => $res
);
} }
function RoleList ($params) function RoleList ($params)
@@ -96,20 +100,23 @@ function RoleList($params)
$o->guid = $vsResult->status_code . ' ' . $vsResult->message; $o->guid = $vsResult->status_code . ' ' . $vsResult->message;
$o->name = ''; $o->name = '';
return array("roles" => $o); return array ("roles" => $o
);
} }
if (ifPermission( $params->sessionId, 'PM_USERS' ) == 0) { if (ifPermission( $params->sessionId, 'PM_USERS' ) == 0) {
$o->guid = "2 Insufficient privileges to execute this function"; $o->guid = "2 Insufficient privileges to execute this function";
$o->name = ''; $o->name = '';
return array("roles" => $o); return array ("roles" => $o
);
} }
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->roleList(); $res = $ws->roleList();
return array("roles" => $res); return array ("roles" => $res
);
} }
function GroupList ($params) function GroupList ($params)
@@ -120,20 +127,23 @@ function GroupList($params)
$o->guid = $vsResult->status_code . ' ' . $vsResult->message; $o->guid = $vsResult->status_code . ' ' . $vsResult->message;
$o->name = ''; $o->name = '';
return array("groups" => $o); return array ("groups" => $o
);
} }
if (ifPermission( $params->sessionId, 'PM_USERS' ) == 0) { if (ifPermission( $params->sessionId, 'PM_USERS' ) == 0) {
$o->guid = "2 Insufficient privileges to execute this function"; $o->guid = "2 Insufficient privileges to execute this function";
$o->name = ''; $o->name = '';
return array("groups" => $o); return array ("groups" => $o
);
} }
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->groupList(); $res = $ws->groupList();
return array("groups" => $res); return array ("groups" => $res
);
} }
function DepartmentList ($params) function DepartmentList ($params)
@@ -144,20 +154,23 @@ function DepartmentList($params)
$o->guid = $vsResult->status_code . ' ' . $vsResult->message; $o->guid = $vsResult->status_code . ' ' . $vsResult->message;
$o->name = ''; $o->name = '';
return array("departments" => $o); return array ("departments" => $o
);
} }
if (ifPermission( $params->sessionId, 'PM_USERS' ) == 0) { if (ifPermission( $params->sessionId, 'PM_USERS' ) == 0) {
$o->guid = "2 Insufficient privileges to execute this function"; $o->guid = "2 Insufficient privileges to execute this function";
$o->name = ''; $o->name = '';
return array("departments" => $o); return array ("departments" => $o
);
} }
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->departmentList(); $res = $ws->departmentList();
return array("departments" => $res); return array ("departments" => $res
);
} }
function CaseList ($params) function CaseList ($params)
@@ -171,7 +184,8 @@ function CaseList($params)
$o->delIndex = ''; $o->delIndex = '';
$o->processId = ''; $o->processId = '';
return array("cases" => $o); return array ("cases" => $o
);
} }
if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) { if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) {
@@ -181,7 +195,8 @@ function CaseList($params)
$o->delIndex = ''; $o->delIndex = '';
$o->processId = ''; $o->processId = '';
return array("cases" => $o); return array ("cases" => $o
);
} }
G::LoadClass( 'sessions' ); G::LoadClass( 'sessions' );
@@ -193,7 +208,8 @@ function CaseList($params)
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->caseList( $userId ); $res = $ws->caseList( $userId );
return array("cases" => $res); return array ("cases" => $res
);
} }
function UnassignedCaseList ($params) function UnassignedCaseList ($params)
@@ -204,7 +220,8 @@ function UnassignedCaseList($params)
$o->name = ''; $o->name = '';
$o->delIndex = ''; $o->delIndex = '';
return array("cases" => $o); return array ("cases" => $o
);
} }
if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) { if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) {
@@ -212,7 +229,8 @@ function UnassignedCaseList($params)
$o->name = ''; $o->name = '';
$o->delIndex = ''; $o->delIndex = '';
return array("cases" => $o); return array ("cases" => $o
);
} }
G::LoadClass( 'sessions' ); G::LoadClass( 'sessions' );
@@ -224,7 +242,8 @@ function UnassignedCaseList($params)
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->unassignedCaseList( $userId ); $res = $ws->unassignedCaseList( $userId );
return array("cases" => $res); return array ("cases" => $res
);
} }
function UserList ($params) function UserList ($params)
@@ -235,20 +254,23 @@ function UserList($params)
$o->guid = $vsResult->status_code . ' ' . $vsResult->message; $o->guid = $vsResult->status_code . ' ' . $vsResult->message;
$o->name = ''; $o->name = '';
return array("users" => $o); return array ("users" => $o
);
} }
if (ifPermission( $params->sessionId, 'PM_USERS' ) == 0) { if (ifPermission( $params->sessionId, 'PM_USERS' ) == 0) {
$o->guid = "2 Insufficient privileges to execute this function"; $o->guid = "2 Insufficient privileges to execute this function";
$o->name = ''; $o->name = '';
return array("users" => $o); return array ("users" => $o
);
} }
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->userList(); $res = $ws->userList();
return array("users" => $res); return array ("users" => $res
);
} }
function triggerList ($params) function triggerList ($params)
@@ -260,7 +282,8 @@ function triggerList($params)
$o->name = ''; $o->name = '';
$o->processId = ''; $o->processId = '';
return array("triggers" => $o); return array ("triggers" => $o
);
} }
if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) { if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) {
@@ -268,13 +291,15 @@ function triggerList($params)
$o->name = ''; $o->name = '';
$o->processId = ''; $o->processId = '';
return array("triggers" => $o); return array ("triggers" => $o
);
} }
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->triggerList(); $res = $ws->triggerList();
return array("triggers" => $res); return array ("triggers" => $res
);
} }
function outputDocumentList ($params) function outputDocumentList ($params)
@@ -292,7 +317,8 @@ function outputDocumentList($params)
$o->index = ''; $o->index = '';
$o->link = ''; $o->link = '';
return array("documents" => $o); return array ("documents" => $o
);
} }
if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) { if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) {
@@ -306,7 +332,8 @@ function outputDocumentList($params)
$o->index = ''; $o->index = '';
$o->link = ''; $o->link = '';
return array("documents" => $o); return array ("documents" => $o
);
} }
G::LoadClass( 'sessions' ); G::LoadClass( 'sessions' );
@@ -318,7 +345,8 @@ function outputDocumentList($params)
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->outputDocumentList( $params->caseId, $userId ); $res = $ws->outputDocumentList( $params->caseId, $userId );
return array("documents" => $res); return array ("documents" => $res
);
} }
function inputDocumentList ($params) function inputDocumentList ($params)
@@ -336,7 +364,8 @@ function inputDocumentList($params)
$o->index = ''; $o->index = '';
$o->link = ''; $o->link = '';
return array("documents" => $o); return array ("documents" => $o
);
} }
if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) { if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) {
@@ -350,7 +379,8 @@ function inputDocumentList($params)
$o->index = ''; $o->index = '';
$o->link = ''; $o->link = '';
return array("documents" => $o); return array ("documents" => $o
);
} }
G::LoadClass( 'sessions' ); G::LoadClass( 'sessions' );
@@ -362,7 +392,8 @@ function inputDocumentList($params)
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->inputDocumentList( $params->caseId, $userId ); $res = $ws->inputDocumentList( $params->caseId, $userId );
return array("documents" => $res); return array ("documents" => $res
);
} }
function inputDocumentProcessList ($params) function inputDocumentProcessList ($params)
@@ -374,7 +405,8 @@ function inputDocumentProcessList($params)
$o->name = ''; $o->name = '';
$o->description = ''; $o->description = '';
return array("documents" => $o); return array ("documents" => $o
);
} }
if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) { if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) {
@@ -382,13 +414,15 @@ function inputDocumentProcessList($params)
$o->name = ''; $o->name = '';
$o->description = ''; $o->description = '';
return array("documents" => $o); return array ("documents" => $o
);
} }
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->inputDocumentProcessList( $params->processId ); $res = $ws->inputDocumentProcessList( $params->processId );
return array("documents" => $res); return array ("documents" => $res
);
} }
function removeDocument ($params) function removeDocument ($params)
@@ -426,15 +460,7 @@ function SendMessage($params)
} }
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->sendMessage( $res = $ws->sendMessage( $params->caseId, $params->from, $params->to, $params->cc, $params->bcc, $params->subject, $params->template );
$params->caseId,
$params->from,
$params->to,
$params->cc,
$params->bcc,
$params->subject,
$params->template
);
return $res->getPayloadArray(); return $res->getPayloadArray();
} }
@@ -496,7 +522,8 @@ function SendVariables($params)
function GetVariables ($params) function GetVariables ($params)
{ {
if (! is_array( $params->variables )) { if (! is_array( $params->variables )) {
$params->variables = array($params->variables); $params->variables = array ($params->variables
);
} }
$vsResult = isValidSession( $params->sessionId ); $vsResult = isValidSession( $params->sessionId );
@@ -820,16 +847,7 @@ function CreateUser($params)
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->createUser( $res = $ws->createUser( $params->userId, $params->firstname, $params->lastname, $params->email, $params->role, $params->password, ((isset( $params->dueDate )) ? $params->dueDate : null), ((isset( $params->status )) ? $params->status : null) );
$params->userId,
$params->firstname,
$params->lastname,
$params->email,
$params->role,
$params->password,
((isset($params->dueDate))? $params->dueDate : null),
((isset($params->status))? $params->status : null)
);
return $res; return $res;
} }
@@ -850,17 +868,7 @@ function updateUser($params)
$ws = new wsBase(); $ws = new wsBase();
$result = $ws->updateUser( $result = $ws->updateUser( $params->userUid, $params->userName, ((isset( $params->firstName )) ? $params->firstName : null), ((isset( $params->lastName )) ? $params->lastName : null), ((isset( $params->email )) ? $params->email : null), ((isset( $params->dueDate )) ? $params->dueDate : null), ((isset( $params->status )) ? $params->status : null), ((isset( $params->role )) ? $params->role : null), ((isset( $params->password )) ? $params->password : null) );
$params->userUid,
$params->userName,
((isset($params->firstName))? $params->firstName : null),
((isset($params->lastName))? $params->lastName : null),
((isset($params->email))? $params->email : null),
((isset($params->dueDate))? $params->dueDate : null),
((isset($params->status))? $params->status : null),
((isset($params->role))? $params->role : null),
((isset($params->password))? $params->password : null)
);
return $result; return $result;
} }
@@ -915,14 +923,16 @@ function TaskList($params)
$o->guid = $vsResult->status_code . ' ' . $vsResult->message; $o->guid = $vsResult->status_code . ' ' . $vsResult->message;
$o->name = ''; $o->name = '';
return array("tasks" => $o); return array ("tasks" => $o
);
} }
if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) { if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) {
$o->guid = "2 Insufficient privileges to execute this function"; $o->guid = "2 Insufficient privileges to execute this function";
$o->name = ''; $o->name = '';
return array("tasks" => $o); return array ("tasks" => $o
);
} }
G::LoadClass( 'sessions' ); G::LoadClass( 'sessions' );
@@ -933,7 +943,8 @@ function TaskList($params)
$userId = $session['USR_UID']; $userId = $session['USR_UID'];
$res = $ws->taskList( $userId ); $res = $ws->taskList( $userId );
return array("tasks" => $res); return array ("tasks" => $res
);
} }
function TaskCase ($params) function TaskCase ($params)
@@ -944,20 +955,23 @@ function TaskCase($params)
$o->guid = $vsResult->status_code . ' ' . $vsResult->message; $o->guid = $vsResult->status_code . ' ' . $vsResult->message;
$o->name = ''; $o->name = '';
return array("taskCases" => $o); return array ("taskCases" => $o
);
} }
if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) { if (ifPermission( $params->sessionId, 'PM_CASES' ) == 0) {
$o->guid = "2 Insufficient privileges to execute this function"; $o->guid = "2 Insufficient privileges to execute this function";
$o->name = ''; $o->name = '';
return array("taskCases" => $o); return array ("taskCases" => $o
);
} }
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->taskCase( $params->caseId ); $res = $ws->taskCase( $params->caseId );
return array("taskCases" => $res); return array ("taskCases" => $res
);
} }
function ReassignCase ($params) function ReassignCase ($params)
@@ -968,13 +982,7 @@ function ReassignCase($params)
} }
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->reassignCase( $res = $ws->reassignCase( $params->sessionId, $params->caseId, $params->delIndex, $params->userIdSource, $params->userIdTarget );
$params->sessionId,
$params->caseId,
$params->delIndex,
$params->userIdSource,
$params->userIdTarget
);
return $res; return $res;
} }
@@ -1002,13 +1010,7 @@ function importProcessFromLibrary($params)
} }
$ws = new wsBase(); $ws = new wsBase();
$res = $ws->importProcessFromLibrary( $res = $ws->importProcessFromLibrary( $params->processId, $params->version, $params->importOption, $params->usernameLibrary, $params->passwordLibrary );
$params->processId ,
$params->version,
$params->importOption,
$params->usernameLibrary,
$params->passwordLibrary
);
return $res; return $res;
} }
@@ -1027,9 +1029,10 @@ function getCaseNotes($params)
return $res; return $res;
} }
/************ /**
* **********
* #added By Erik AO <erik@colosa.com> in datetime 26.06.2008 10:00:00 * #added By Erik AO <erik@colosa.com> in datetime 26.06.2008 10:00:00
# modified 12-01-2010 by erik * # modified 12-01-2010 by erik
*/ */
function isValidSession ($sessionId) function isValidSession ($sessionId)
{ {
@@ -1142,12 +1145,7 @@ function pauseCase($params)
$ws = new wsBase(); $ws = new wsBase();
$result = $ws->pauseCase( $result = $ws->pauseCase( $params->caseUid, $params->delIndex, $params->userUid, ((isset( $params->unpauseDate )) ? $params->unpauseDate : null) );
$params->caseUid,
$params->delIndex,
$params->userUid,
((isset($params->unpauseDate))? $params->unpauseDate : null)
);
return $result; return $result;
} }
@@ -1172,10 +1170,6 @@ function unpauseCase($params)
return $result; return $result;
} }
$server = new SoapServer( $wsdl ); $server = new SoapServer( $wsdl );
$server->addFunction( "Login" ); $server->addFunction( "Login" );
$server->addFunction( "ProcessList" ); $server->addFunction( "ProcessList" );

View File

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

View File

@@ -20,7 +20,6 @@
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/ */
/** /**
@@ -90,22 +89,11 @@ if (isset($_FILES) && $_FILES["ATTACH_FILE"]["error"] == 0) {
//$aFields["FOLDER_UID"] = $folderId, //$aFields["FOLDER_UID"] = $folderId,
//$aFields["APP_DOC_TAGS"] = $fileTags //$aFields["APP_DOC_TAGS"] = $fileTags
$aFields["APP_DOC_FIELDNAME"] = $_POST["APP_DOC_FIELDNAME"]; $aFields["APP_DOC_FIELDNAME"] = $_POST["APP_DOC_FIELDNAME"];
} else { } else {
//New record //New record
$aFields = array( $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"]
"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"]
); );
} }
@@ -136,6 +124,7 @@ if (isset($_FILES) && $_FILES["ATTACH_FILE"]["error"] == 0) {
//$_SESSION["USR_USERNAME"] = $appFields["USR_USERNAME"]; //$_SESSION["USR_USERNAME"] = $appFields["USR_USERNAME"];
//$_SESSION["STEP_POSITION"] = 0; //$_SESSION["STEP_POSITION"] = 0;
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document //Plugin Hook PM_UPLOAD_DOCUMENT for upload document
$oPluginRegistry = &PMPluginRegistry::getSingleton(); $oPluginRegistry = &PMPluginRegistry::getSingleton();
@@ -165,3 +154,4 @@ if (isset($_FILES) && $_FILES["ATTACH_FILE"]["error"] == 0) {
print ($e->getMessage()) ; print ($e->getMessage()) ;
} }
} }

View File

@@ -2,7 +2,8 @@
ini_set( "default_charset", "UTF-8" ); ini_set( "default_charset", "UTF-8" );
function AuthenticationBasicHTTP($realm ) { function AuthenticationBasicHTTP ($realm)
{
if (empty( $_SERVER['PHP_AUTH_USER'] ) && empty( $_SERVER['REDIRECT_REMOTE_USER'] )) { if (empty( $_SERVER['PHP_AUTH_USER'] ) && empty( $_SERVER['REDIRECT_REMOTE_USER'] )) {
header( 'WWW-Authenticate: Basic realm="' . $realm . '"' ); header( 'WWW-Authenticate: Basic realm="' . $realm . '"' );
header( 'HTTP/1.0 401 Unauthorized' ); header( 'HTTP/1.0 401 Unauthorized' );
@@ -23,17 +24,17 @@ function AuthenticationBasicHTTP($realm ) {
header( 'WWW-Authenticate: Basic realm="' . $realm . '"' ); header( 'WWW-Authenticate: Basic realm="' . $realm . '"' );
header( 'HTTP/1.0 401 ' . $msg ); header( 'HTTP/1.0 401 ' . $msg );
die( '401 ' . $msg ); die( '401 ' . $msg );
return FALSE; return false;
die; die();
} }
return TRUE; return true;
} }
header( 'WWW-Authenticate: Basic realm="' . $realm . '"' ); header( 'WWW-Authenticate: Basic realm="' . $realm . '"' );
header( 'HTTP/1.0 401 Unauthorized' ); header( 'HTTP/1.0 401 Unauthorized' );
die( '401 Unauthorized' ); die( '401 Unauthorized' );
return FALSE; return false;
} }
$realm = 'ProcessMaker Filesystem for Workspace ' . SYS_SYS; $realm = 'ProcessMaker Filesystem for Workspace ' . SYS_SYS;

View File

@@ -3,8 +3,7 @@
$content = file_get_contents( $filewsdl ); $content = file_get_contents( $filewsdl );
$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
$endpoint = 'http://' .$_SERVER['SERVER_NAME'] . ':' .$_SERVER['SERVER_PORT'] . $endpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . SYS_SYS . '/' . $lang . '/classic/services/soap';
'/sys' .SYS_SYS.'/' .$lang . '/classic/services/soap';
//print $endpoint; die; //print $endpoint; die;
$content = str_replace( "___SOAP_ADDRESS___", $endpoint, $content ); $content = str_replace( "___SOAP_ADDRESS___", $endpoint, $content );

View File

@@ -4,8 +4,7 @@
$lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en';
$http = (isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; $http = (isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
$endpoint = $http . '://' .$_SERVER['SERVER_NAME'] . ':' .$_SERVER['SERVER_PORT'] . $endpoint = $http . '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . SYS_SYS . '/' . $lang . '/classic/services/soap2';
'/sys' .SYS_SYS.'/' .$lang . '/classic/services/soap2';
$content = str_replace( "___SOAP_ADDRESS___", $endpoint, $content ); $content = str_replace( "___SOAP_ADDRESS___", $endpoint, $content );

View File

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

View File

@@ -1,4 +1,5 @@
<?php <?php
function addNodox ($obj, $padre, $indice, $contenido = '', $atributos = '') function addNodox ($obj, $padre, $indice, $contenido = '', $atributos = '')
{ {
if (is_object( $padre )) { if (is_object( $padre )) {
@@ -34,14 +35,13 @@ function derivationRules($aRoute, $doc, $nodo_derivationrule)
{ {
$tam = count( $aRoute ); $tam = count( $aRoute );
$c = 0; $c = 0;
switch ($aRoute[$c]['ROU_TYPE']) switch ($aRoute[$c]['ROU_TYPE']) {
{
case 'SEQUENTIAL': case 'SEQUENTIAL':
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'Sequential', '', '' ); $nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'Sequential', '', '' );
$nodo_nexttask = addNodox( $doc, $nodo_routeType, 'NextTask', '', '' ); $nodo_nexttask = addNodox( $doc, $nodo_routeType, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) { if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'TaskRef', '', $nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
array('TaskId'=> 'ID'.$aRoute[$c]['ROU_NEXT_TASK'])); ) );
} else { } else {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' ); $nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
} }
@@ -49,10 +49,12 @@ function derivationRules($aRoute, $doc, $nodo_derivationrule)
case 'EVALUATE': case 'EVALUATE':
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'Evaluations', '', '' ); $nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'Evaluations', '', '' );
while ($c < $tam) { while ($c < $tam) {
$nodo_evaluation= addNodox($doc, $nodo_routeType, 'Evaluation', '', array('Condition'=> $aRoute[$c]['ROU_CONDITION'])); $nodo_evaluation = addNodox( $doc, $nodo_routeType, 'Evaluation', '', array ('Condition' => $aRoute[$c]['ROU_CONDITION']
) );
$nodo_nexttask = addNodox( $doc, $nodo_evaluation, 'NextTask', '', '' ); $nodo_nexttask = addNodox( $doc, $nodo_evaluation, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) { if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'TaskRef', '', array('TaskId'=> 'ID'.$aRoute[$c]['ROU_NEXT_TASK'])); $nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else { } else {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' ); $nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
} }
@@ -62,10 +64,12 @@ function derivationRules($aRoute, $doc, $nodo_derivationrule)
case 'SELECT': case 'SELECT':
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'Selections', '', '' ); $nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'Selections', '', '' );
while ($c < $tam) { while ($c < $tam) {
$nodo_selection= addNodox($doc, $nodo_routeType, 'Selection', '', array('Description'=> $aRoute[$c]['ROU_CONDITION'])); $nodo_selection = addNodox( $doc, $nodo_routeType, 'Selection', '', array ('Description' => $aRoute[$c]['ROU_CONDITION']
) );
$nodo_nexttask = addNodox( $doc, $nodo_selection, 'NextTask', '', '' ); $nodo_nexttask = addNodox( $doc, $nodo_selection, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) { if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'TaskRef', '', array('TaskId'=> 'ID'.$aRoute[$c]['ROU_NEXT_TASK'])); $nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else { } else {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' ); $nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
} }
@@ -79,7 +83,8 @@ function derivationRules($aRoute, $doc, $nodo_derivationrule)
$nodo_nexttask = addNodox( $doc, $nodo_parallelfork, 'NextTask', '', '' ); $nodo_nexttask = addNodox( $doc, $nodo_parallelfork, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) { if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'TaskRef', '', array('TaskId'=> 'ID'.$aRoute[$c]['ROU_NEXT_TASK'])); $nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else { } else {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' ); $nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
} }
@@ -89,10 +94,12 @@ function derivationRules($aRoute, $doc, $nodo_derivationrule)
case 'PARALLEL-BY-EVALUATION': case 'PARALLEL-BY-EVALUATION':
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'ParallelForksByEvaluation', '', '' ); $nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'ParallelForksByEvaluation', '', '' );
while ($c < $tam) { while ($c < $tam) {
$nodo_evaluation= addNodox($doc, $nodo_routeType, 'Evaluation', '', array('Condition'=> $aRoute[$c]['ROU_CONDITION'])); $nodo_evaluation = addNodox( $doc, $nodo_routeType, 'Evaluation', '', array ('Condition' => $aRoute[$c]['ROU_CONDITION']
) );
$nodo_nexttask = addNodox( $doc, $nodo_evaluation, 'NextTask', '', '' ); $nodo_nexttask = addNodox( $doc, $nodo_evaluation, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) { if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'TaskRef', '', array('TaskId'=> 'ID'.$aRoute[$c]['ROU_NEXT_TASK'])); $nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else { } else {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' ); $nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
} }
@@ -103,7 +110,8 @@ function derivationRules($aRoute, $doc, $nodo_derivationrule)
$nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'ParallelJoin', '', '' ); $nodo_routeType = addNodox( $doc, $nodo_derivationrule, 'ParallelJoin', '', '' );
$nodo_nexttask = addNodox( $doc, $nodo_routeType, 'NextTask', '', '' ); $nodo_nexttask = addNodox( $doc, $nodo_routeType, 'NextTask', '', '' );
if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) { if ($aRoute[$c]['ROU_NEXT_TASK'] != - 1) {
$nodo_taskref = addNodox($doc, $nodo_nexttask, 'TaskRef', '', array('TaskId'=> 'ID'.$aRoute[$c]['ROU_NEXT_TASK'])); $nodo_taskref = addNodox( $doc, $nodo_nexttask, 'TaskRef', '', array ('TaskId' => 'ID' . $aRoute[$c]['ROU_NEXT_TASK']
) );
} else { } else {
$nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' ); $nodo_taskref = addNodox( $doc, $nodo_nexttask, 'End', '', '' );
} }
@@ -111,13 +119,16 @@ function derivationRules($aRoute, $doc, $nodo_derivationrule)
} }
} }
/****-_--__---___----___---__--_-****/ /**
* **-_--__---___----___---__--_-***
*/
G::LoadClass( 'tasks' ); G::LoadClass( 'tasks' );
require_once 'classes/model/Process.php'; require_once 'classes/model/Process.php';
$doc = new DOMDocument( '1.0', 'UTF-8' ); $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')); $nodo_padre = addNodox( $doc, '', 'Processes', '', array ('xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance','xsi:noNamespaceSchemaLocation' => 'ColosaSchema.xsd'
) );
$aProcesses = array (); $aProcesses = array ();
$oCriteria = new Criteria( 'workflow' ); $oCriteria = new Criteria( 'workflow' );
@@ -131,7 +142,8 @@ $oProcess = new Process();
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
$aProcess = $oProcess->load( $aRow['PRO_UID'] ); $aProcess = $oProcess->load( $aRow['PRO_UID'] );
$nodo_process = addNodox($doc, $nodo_padre, 'Process', '', array('Title'=> $aProcess['PRO_TITLE'],'Description'=> $aProcess['PRO_DESCRIPTION'])); $nodo_process = addNodox( $doc, $nodo_padre, 'Process', '', array ('Title' => $aProcess['PRO_TITLE'],'Description' => $aProcess['PRO_DESCRIPTION']
) );
$nodo_tasks = addNodox( $doc, $nodo_process, 'Tasks', '', '' ); $nodo_tasks = addNodox( $doc, $nodo_process, 'Tasks', '', '' );
$oTask = new Tasks(); $oTask = new Tasks();
@@ -146,15 +158,18 @@ while ($aRow = $oDataset->getRow()) {
if ($value['TAS_TYPE'] == 'NORMAL') { if ($value['TAS_TYPE'] == 'NORMAL') {
$ini = ($value['TAS_START'] == 'TRUE') ? 'true' : 'false'; $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_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_coordinates = addNodox( $doc, $nodo_task, 'Coordinates', '', array ('XCoordinate' => $value['TAS_POSX'],'YCoordinate' => $value['TAS_POSY']
) );
$nodo_derivationrule = addNodox( $doc, $nodo_task, 'DerivationRule', '', '' ); $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_assignmentrules = addNodox( $doc, $nodo_task, 'AssignmentRules', '', '' );
$nodo_cyclicalassignment = addNodox( $doc, $nodo_assignmentrules, 'CyclicalAssignment', '', '' ); $nodo_cyclicalassignment = addNodox( $doc, $nodo_assignmentrules, 'CyclicalAssignment', '', '' );
$nodo_timingcontrol = addNodox($doc, $nodo_task, 'TimingControl', '', array('TaskDuration'=> $value['TAS_DURATION'])); $nodo_timingcontrol = addNodox( $doc, $nodo_task, 'TimingControl', '', array ('TaskDuration' => $value['TAS_DURATION']
) );
$nodo_permissions = addNodox( $doc, $nodo_task, 'Permissions', '', '' ); $nodo_permissions = addNodox( $doc, $nodo_task, 'Permissions', '', '' );
$nodo_caselabels = addNodox( $doc, $nodo_task, 'CaseLabels', '', '' ); $nodo_caselabels = addNodox( $doc, $nodo_task, 'CaseLabels', '', '' );
$nodo_notifications = addNodox( $doc, $nodo_task, 'Notifications', '', '' ); $nodo_notifications = addNodox( $doc, $nodo_task, 'Notifications', '', '' );
@@ -167,8 +182,10 @@ while ($aRow = $oDataset->getRow()) {
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
$aRow = $oDataset->getRow(); $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_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_coordinates = addNodox( $doc, $nodo_task, 'Coordinates', '', array ('XCoordinate' => $value['TAS_POSX'],'YCoordinate' => $value['TAS_POSY']
) );
$nodo_derivationrule = addNodox( $doc, $nodo_task, 'DerivationRule', '', '' ); $nodo_derivationrule = addNodox( $doc, $nodo_task, 'DerivationRule', '', '' );
derivationRules( $aRoute, $doc, $nodo_derivationrule ); derivationRules( $aRoute, $doc, $nodo_derivationrule );