Exemplo n.º 1
0
            break;
        case 'deleteSubProcess':
            $oTaskNewPattern = new Task();
            $taskInfo=$oTaskNewPattern->load($oData->tas_uid);
            $titleTask=$taskInfo['TAS_TITLE'];
            G::auditlog("DeleteSubProcess",'Delete Sub-Process -> '.$titleTask.' : '.$oData->tas_uid);
            $sOutput = $oProcessMap->deleteSubProcess($oData->pro_uid, $oData->tas_uid);
            break;
        case 'subProcess_Properties':
            $oProcessMap->subProcess_Properties($oData->pro_uid, $oData->tas_uid, $oData->index);
            break;
        case 'showDetailsPMDWL':
            G::LoadClass('processes');
            $oProcesses = new Processes();
            $oProcesses->ws_open_public();
            $aFields = get_object_vars($oProcesses->ws_processGetData($oData->pro_uid));

            $aFields['description'] = nl2br($aFields['description']);
            $aFields['installSteps'] = nl2br($aFields['installSteps']);
            switch ($aFields['privacy']) {
                case 'FREE':
                    $aFields['link_label'] = G::LoadTranslation('ID_DOWNLOAD');
                    $aFields['link_href'] = '../processes/downloadPML?id=' . $oData->pro_uid . '&s=' . $sessionId;
                    break;
                case 'PUBLIC':
                    require_once 'classes/model/Configuration.php';
                    $oCriteria = new Criteria('workflow');
                    $oCriteria->addSelectColumn(ConfigurationPeer::CFG_VALUE);
                    $oCriteria->add(ConfigurationPeer::CFG_UID, 'REGISTER_INFORMATION');
                    $oCriteria->add(ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED']);
                    if (ConfigurationPeer::doCount($oCriteria) > 0) {
Exemplo n.º 2
0
    //if the process exists, we need to ask what kind of re-import the user wants,
    if ($oProcess->processExists($sProUid)) {
        $G_MAIN_MENU = 'processmaker';
        $G_ID_MENU_SELECTED = 'PROCESSES';
        $G_PUBLISH = new Publisher();
        $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_ImportExisting', '', $Fields, 'downloadPML_ImportExisting');
        G::RenderPage('publish', 'blank');
        die;
    }
    //creating the process
    $oProcess->createProcessFromData($oData, $localPath . $newfilename);
    //show the info after the imported process
    G::LoadClass('processes');
    $oProcess = new Processes();
    $oProcess->ws_open_public();
    $processData = $oProcess->ws_processGetData($ObjUid);
    $Fields['pro_title'] = $processData->title;
    $Fields['installSteps'] = nl2br($processData->installSteps);
    $Fields['category'] = isset($processData->category) ? $processData->category : '';
    $Fields['version'] = $processData->version;
    $G_MAIN_MENU = 'processmaker';
    $G_ID_MENU_SELECTED = 'PROCESSES';
    $G_PUBLISH = new Publisher();
    $Fields['PRO_UID'] = $sProUid;
    $processmapLink = "processes_Map?PRO_UID={$sProUid}";
    $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_ImportSucessful', '', $Fields, $processmapLink);
    G::RenderPage('publish', 'blank');
    die;
} catch (Exception $e) {
    $G_PUBLISH = new Publisher();
    $aMessage['MESSAGE'] = $e->getMessage();
Exemplo n.º 3
0
 /**
  * import process fromLibrary: downloads and imports a process from the ProcessMaker library
  *
  * @param string sessionId : The session ID (which was obtained at login).
  * @param string processId :
  * @param string version :
  * @param string importOption :
  * @param string usernameLibrary : The username to obtain access to the ProcessMaker library.
  * @param string passwordLibrary : The password to obtain access to the ProcessMaker library.
  * @return $eturns will return an object
  */
 public function importProcessFromLibrary($processId, $version = '', $importOption = '', $usernameLibrary = '', $passwordLibrary = '')
 {
     try {
         G::LoadClass('processes');
         //$versionReq = $_GET['v'];
         //. (isset($_GET['s']) ? '&s=' . $_GET['s'] : '')
         $ipaddress = $_SERVER['REMOTE_ADDR'];
         $oProcesses = new Processes();
         $oProcesses->ws_open_public();
         $oProcess = $oProcesses->ws_processGetData($processId);
         if ($oProcess->status_code != 0) {
             throw new Exception($oProcess->message);
         }
         $privacy = $oProcess->privacy;
         $strSession = '';
         if ($privacy != 'FREE') {
             global $sessionId;
             $antSession = $sessionId;
             $oProcesses->ws_open($usernameLibrary, $passwordLibrary);
             $strSession = "&s=" . $sessionId;
             $sessionId = $antSession;
         }
         //downloading the file
         $localPath = PATH_DOCUMENT . 'input' . PATH_SEP;
         G::mk_dir($localPath);
         $newfilename = G::GenerateUniqueId() . '.pm';
         $downloadUrl = PML_DOWNLOAD_URL . '?id=' . $processId . $strSession;
         $oProcess = new Processes();
         $oProcess->downloadFile($downloadUrl, $localPath, $newfilename);
         //getting the ProUid from the file recently downloaded
         $oData = $oProcess->getProcessData($localPath . $newfilename);
         if (is_null($oData)) {
             $data['DOWNLOAD_URL'] = $downloadUrl;
             $data['LOCAL_PATH'] = $localPath;
             $data['NEW_FILENAME'] = $newfilename;
             throw new Exception(G::loadTranslation('ID_ERROR_URL_PROCESS_INVALID', SYS_LANG, $data));
         }
         $sProUid = $oData->process['PRO_UID'];
         $oData->process['PRO_UID_OLD'] = $sProUid;
         //if the process exists, we need to check the $importOption to and re-import if the user wants,
         if ($oProcess->processExists($sProUid)) {
             //Update the current Process, overwriting all tasks and steps
             if ($importOption == 1) {
                 $oProcess->updateProcessFromData($oData, $localPath . $newfilename);
                 //delete the xmlform cache
                 if (file_exists(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid)) {
                     $oDirectory = dir(PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP . $sProUid);
                     while ($sObjectName = $oDirectory->read()) {
                         if ($sObjectName != '.' && $sObjectName != '..') {
                             $strAux = PATH_OUTTRUNK . 'compiled' . PATH_SEP . 'xmlform' . PATH_SEP;
                             $strAux = $strAux . $sProUid . PATH_SEP . $sObjectName;
                             unlink($strAux);
                         }
                     }
                     $oDirectory->close();
                 }
                 $sNewProUid = $sProUid;
             }
             //Disable current Process and create a new version of the Process
             if ($importOption == 2) {
                 $oProcess->disablePreviousProcesses($sProUid);
                 $sNewProUid = $oProcess->getUnusedProcessGUID();
                 $oProcess->setProcessGuid($oData, $sNewProUid);
                 $oProcess->setProcessParent($oData, $sProUid);
                 $oData->process['PRO_TITLE'] = "New - " . $oData->process['PRO_TITLE'] . ' - ' . date('M d, H:i');
                 $oProcess->renewAll($oData);
                 $oProcess->createProcessFromData($oData, $localPath . $newfilename);
             }
             //Create a completely new Process without change the current Process
             if ($importOption == 3) {
                 //krumo ($oData); die;
                 $sNewProUid = $oProcess->getUnusedProcessGUID();
                 $oProcess->setProcessGuid($oData, $sNewProUid);
                 $strAux = "Copy of  - " . $oData->process['PRO_TITLE'] . ' - ' . date('M d, H:i');
                 $oData->process['PRO_TITLE'] = $strAux;
                 $oProcess->renewAll($oData);
                 $oProcess->createProcessFromData($oData, $localPath . $newfilename);
             }
             if ($importOption != 1 && $importOption != 2 && $importOption != 3) {
                 throw new Exception(G::loadTranslation('ID_PROCESS_ALREADY_IN_SYSTEM'));
             }
         }
         //finally, creating the process if the process doesn't exist
         if (!$oProcess->processExists($processId)) {
             $oProcess->createProcessFromData($oData, $localPath . $newfilename);
         }
         //show the info after the imported process
         $oProcess = new Processes();
         $oProcess->ws_open_public();
         $processData = $oProcess->ws_processGetData($processId);
         $result->status_code = 0;
         $result->message = G::loadTranslation('ID_COMMAND_EXECUTED_SUCCESSFULLY');
         $result->timestamp = date('Y-m-d H:i:s');
         $result->processId = $processId;
         $result->processTitle = $processData->title;
         $result->category = isset($processData->category) ? $processData->category : '';
         $result->version = $processData->version;
         return $result;
     } catch (Exception $e) {
         $result = new wsResponse(100, $e->getMessage());
         return $result;
     }
 }