removing ProcessMaker Library #26
This commit is contained in:
@@ -6081,202 +6081,6 @@ class Processes
|
||||
return $oTask->getStartingTaskForUser($sProUid, $sUsrUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* ***********************************************
|
||||
* functions to enable open ProcessMaker Library
|
||||
* ***********************************************
|
||||
*/
|
||||
/**
|
||||
* Open a WebService connection
|
||||
*
|
||||
* @param $user username for pm
|
||||
* @param $pass password for the user
|
||||
* @return 1 integer.
|
||||
*/
|
||||
public function ws_open($user, $pass)
|
||||
{
|
||||
global $sessionId;
|
||||
global $client;
|
||||
$endpoint = PML_WSDL_URL;
|
||||
$sessionId = '';
|
||||
$proxy = array();
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
$proxy['proxy_host'] = $sysConf['proxy_host'];
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
$proxy['proxy_port'] = $sysConf['proxy_port'];
|
||||
}
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
$proxy['proxy_login'] = $sysConf['proxy_user'];
|
||||
}
|
||||
if ($sysConf['proxy_pass'] != '') {
|
||||
$proxy['proxy_password'] = $sysConf['proxy_pass'];
|
||||
}
|
||||
}
|
||||
$client = new SoapClient($endpoint, $proxy);
|
||||
$params = array('userid' => $user, 'password' => $pass
|
||||
);
|
||||
$result = $client->__SoapCall('login', array($params
|
||||
));
|
||||
if ($result->status_code == 0) {
|
||||
$sessionId = $result->message;
|
||||
return 1;
|
||||
}
|
||||
throw (new Exception($result->message));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a WebService public connection
|
||||
*
|
||||
* @param $user username for pm
|
||||
* @param $pass password for the user
|
||||
* @return 1 integer.
|
||||
*/
|
||||
public function ws_open_public()
|
||||
{
|
||||
global $sessionId;
|
||||
global $client;
|
||||
$endpoint = PML_WSDL_URL;
|
||||
$sessionId = '';
|
||||
ini_set("soap.wsdl_cache_enabled", "0"); // enabling WSDL cache
|
||||
try {
|
||||
$proxy = array();
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
$proxy['proxy_host'] = $sysConf['proxy_host'];
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
$proxy['proxy_port'] = $sysConf['proxy_port'];
|
||||
}
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
$proxy['proxy_login'] = $sysConf['proxy_user'];
|
||||
}
|
||||
if ($sysConf['proxy_pass'] != '') {
|
||||
$proxy['proxy_password'] = $sysConf['proxy_pass'];
|
||||
}
|
||||
}
|
||||
$client = @new SoapClient($endpoint, $proxy);
|
||||
} catch (Exception $e) {
|
||||
throw (new Exception($e->getMessage()));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Consume the processList WebService
|
||||
*
|
||||
* @return $result process list.
|
||||
*/
|
||||
public function ws_processList()
|
||||
{
|
||||
global $sessionId;
|
||||
global $client;
|
||||
|
||||
$endpoint = PML_WSDL_URL;
|
||||
$proxy = array();
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
$proxy['proxy_host'] = $sysConf['proxy_host'];
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
$proxy['proxy_port'] = $sysConf['proxy_port'];
|
||||
}
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
$proxy['proxy_login'] = $sysConf['proxy_user'];
|
||||
}
|
||||
if ($sysConf['proxy_pass'] != '') {
|
||||
$proxy['proxy_password'] = $sysConf['proxy_pass'];
|
||||
}
|
||||
}
|
||||
|
||||
$client = new SoapClient($endpoint, $proxy);
|
||||
$sessionId = '';
|
||||
$params = array('sessionId' => $sessionId
|
||||
);
|
||||
$result = $client->__SoapCall('processList', array($params
|
||||
));
|
||||
if ($result->status_code == 0) {
|
||||
return $result;
|
||||
}
|
||||
throw (new Exception($result->message));
|
||||
}
|
||||
|
||||
/**
|
||||
* download a File
|
||||
*
|
||||
* @param $file file to download
|
||||
* @param $local_path path of the file
|
||||
* @param $newfilename
|
||||
* @return $errorMsg process list.
|
||||
*/
|
||||
public function downloadFile($file, $local_path, $newfilename)
|
||||
{
|
||||
$err_msg = '';
|
||||
$out = fopen($local_path . $newfilename, 'wb');
|
||||
if ($out == false) {
|
||||
throw (new Exception("File $newfilename not opened"));
|
||||
}
|
||||
|
||||
if (!function_exists('curl_init')) {
|
||||
G::SendTemporalMessage('ID_CURLFUN_ISUNDEFINED', "warning", 'LABEL', '', '100%', '');
|
||||
G::header('location: ../processes/processes_Library');
|
||||
die();
|
||||
}
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_FILE, $out);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_URL, $file);
|
||||
|
||||
curl_exec($ch);
|
||||
$errorMsg = curl_error($ch);
|
||||
fclose($out);
|
||||
|
||||
curl_close($ch);
|
||||
return $errorMsg;
|
||||
|
||||
} //end function
|
||||
|
||||
|
||||
/**
|
||||
* get the process Data from a process
|
||||
*
|
||||
* @param $proId process Uid
|
||||
* @return $result
|
||||
*/
|
||||
public function ws_processGetData($proId)
|
||||
{
|
||||
global $sessionId;
|
||||
global $client;
|
||||
|
||||
$endpoint = PML_WSDL_URL;
|
||||
$proxy = array();
|
||||
$sysConf = System::getSystemConfiguration();
|
||||
if ($sysConf['proxy_host'] != '') {
|
||||
$proxy['proxy_host'] = $sysConf['proxy_host'];
|
||||
if ($sysConf['proxy_port'] != '') {
|
||||
$proxy['proxy_port'] = $sysConf['proxy_port'];
|
||||
}
|
||||
if ($sysConf['proxy_user'] != '') {
|
||||
$proxy['proxy_login'] = $sysConf['proxy_user'];
|
||||
}
|
||||
if ($sysConf['proxy_pass'] != '') {
|
||||
$proxy['proxy_password'] = $sysConf['proxy_pass'];
|
||||
}
|
||||
}
|
||||
$client = new SoapClient($endpoint, $proxy);
|
||||
|
||||
$sessionId = '';
|
||||
$params = array('sessionId' => $sessionId, 'processId' => $proId
|
||||
);
|
||||
$result = $client->__SoapCall('processGetData', array($params
|
||||
));
|
||||
if ($result->status_code == 0) {
|
||||
return $result;
|
||||
}
|
||||
throw (new Exception($result->message));
|
||||
}
|
||||
|
||||
/**
|
||||
* parse an array of Items
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user