示例#1
0
 public function getDynaformTitle($idDynaform)
 {
     $d = new Dynaform();
     $d->setDynUid($idDynaform);
     $titleDynaform = $d->getDynTitle();
     return $titleDynaform;
 }
示例#2
0
 public function getDynaformHistory($PRO_UID, $TAS_UID, $APP_UID, $DYN_UID = "")
 {
     G::LoadClass('case');
     $oCase = new Cases();
     $oCase->verifyTable();
     $aObjectPermissions = $oCase->getAllObjects($PRO_UID, $APP_UID, $TAS_UID, $_SESSION['USER_LOGGED']);
     if (!is_array($aObjectPermissions)) {
         $aObjectPermissions = array('DYNAFORMS' => array(-1), 'INPUT_DOCUMENTS' => array(-1), 'OUTPUT_DOCUMENTS' => array(-1));
     }
     if (!isset($aObjectPermissions['DYNAFORMS'])) {
         $aObjectPermissions['DYNAFORMS'] = array(-1);
     } else {
         if (!is_array($aObjectPermissions['DYNAFORMS'])) {
             $aObjectPermissions['DYNAFORMS'] = array(-1);
         }
     }
     if (!isset($aObjectPermissions['INPUT_DOCUMENTS'])) {
         $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
     } else {
         if (!is_array($aObjectPermissions['INPUT_DOCUMENTS'])) {
             $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
         }
     }
     if (!isset($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
         $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
     } else {
         if (!is_array($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
             $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
         }
     }
     $c = new Criteria('workflow');
     $c->addSelectColumn(AppHistoryPeer::APP_UID);
     $c->addSelectColumn(AppHistoryPeer::DEL_INDEX);
     $c->addSelectColumn(AppHistoryPeer::PRO_UID);
     $c->addSelectColumn(AppHistoryPeer::TAS_UID);
     $c->addSelectColumn(AppHistoryPeer::DYN_UID);
     $c->addSelectColumn(AppHistoryPeer::USR_UID);
     $c->addSelectColumn(AppHistoryPeer::APP_STATUS);
     $c->addSelectColumn(AppHistoryPeer::HISTORY_DATE);
     $c->addSelectColumn(AppHistoryPeer::HISTORY_DATA);
     $c->addSelectColumn(UsersPeer::USR_FIRSTNAME);
     $c->addSelectColumn(UsersPeer::USR_LASTNAME);
     $c->addAsColumn('USR_NAME', "CONCAT(USR_LASTNAME, ' ', USR_FIRSTNAME)");
     $c->addJoin(AppHistoryPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
     //WHERE
     $c->add(AppHistoryPeer::DYN_UID, $aObjectPermissions['DYNAFORMS'], Criteria::IN);
     $c->add(AppHistoryPeer::PRO_UID, $PRO_UID);
     $c->add(AppHistoryPeer::APP_UID, $APP_UID);
     if (isset($DYN_UID) && $DYN_UID != "") {
         $c->add(AppHistoryPeer::DYN_UID, $DYN_UID);
     }
     //ORDER BY
     $c->clearOrderByColumns();
     $c->addDescendingOrderByColumn(AppHistoryPeer::HISTORY_DATE);
     //Execute
     $oDataset = AppHistoryPeer::doSelectRS($c);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aDynHistory = array();
     $aDynHistory[] = array('DYN_TITLE' => 'char');
     while ($aRow = $oDataset->getRow()) {
         $o = new Dynaform();
         $o->setDynUid($aRow['DYN_UID']);
         $aRow['DYN_TITLE'] = $o->getDynTitle();
         $changedValues = unserialize($aRow['HISTORY_DATA']);
         $html = "<table border='0' cellpadding='0' cellspacing='0'>";
         $sw_add = false;
         foreach ($changedValues as $key => $value) {
             if ($value != null && !is_array($value)) {
                 $sw_add = true;
                 $html .= "<tr>";
                 $html .= "<td><b>{$key}:</b> </td>";
                 $html .= "<td>{$value}</td>";
                 $html .= "</tr>";
             }
             if (is_array($value)) {
                 $html .= "<tr>";
                 $html .= "<td><b>{$key} (grid):</b> </td>";
                 $html .= "<td>";
                 $html .= "<table>";
                 foreach ($value as $key1 => $value1) {
                     $html .= "<tr>";
                     $html .= "<td><b>{$key1}</b></td>";
                     $html .= "<td>";
                     if (is_array($value1)) {
                         $sw_add = true;
                         $html .= "<table>";
                         foreach ($value1 as $key2 => $value2) {
                             $html .= "<tr>";
                             $html .= "<td><b>{$key2}</b></td>";
                             $html .= "<td>{$value2}</td>";
                             $html .= "</tr>";
                         }
                         $html .= "</table>";
                     }
                     $html .= "</td>";
                     $html .= "</tr>";
                 }
                 $html .= "</table>";
                 $html .= "</td>";
                 $html .= "</tr>";
                 $html .= "</td>";
             }
         }
         $html .= "</table>";
         $aRow['FIELDS'] = $html;
         if ($sw_add) {
             $aDynHistory[] = $aRow;
         }
         $oDataset->next();
     }
     global $_DBArray;
     $_DBArray['DynaformsHistory'] = $aDynHistory;
     $_SESSION['_DBArray'] = $_DBArray;
     G::LoadClass('ArrayPeer');
     $oCriteria = new Criteria('dbarray');
     $oCriteria->setDBArrayTable('DynaformsHistory');
     $oCriteria->addDescendingOrderByColumn(AppHistoryPeer::HISTORY_DATE);
     return $oCriteria;
 }
 $user = $oTask->assignUsertoTask($sTASKS);
 if ($user == 0) {
     throw new Exception(G::LoadTranslation('ID_TASK') . "'" . $TaskFields['TAS_TITLE'] . "'" . G::LoadTranslation('ID_NOT_HAVE_USERS'));
 }
 $http = G::is_https() ? "https://" : "http://";
 $sContent = '';
 $infoProcess = new Process();
 $resultProcess = $infoProcess->load($sPRO_UID);
 if ($withWS) {
     //creating sys.info;
     $SITE_PUBLIC_PATH = '';
     if (file_exists($SITE_PUBLIC_PATH . '')) {
     }
     //creating the first file
     require_once 'classes/model/Dynaform.php';
     $oDynaform = new Dynaform();
     $aDynaform = $oDynaform->load($sDYNAFORM);
     $dynTitle = str_replace(' ', '_', str_replace('/', '_', $aDynaform['DYN_TITLE']));
     $sContent = "<?php\n";
     $sContent .= "global \$_DBArray;\n";
     $sContent .= "if (!isset(\$_DBArray)) {\n";
     $sContent .= "  \$_DBArray = array();\n";
     $sContent .= "}\n";
     $sContent .= "\$_SESSION['PROCESS'] = '" . $sPRO_UID . "';\n";
     $sContent .= "\$_SESSION['CURRENT_DYN_UID'] = '" . $sDYNAFORM . "';\n";
     $sContent .= "\$G_PUBLISH = new Publisher;\n";
     $sContent .= "\$G_PUBLISH->AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n";
     $sContent .= "G::RenderPage('publish', 'blank');";
     file_put_contents($pathProcess . $dynTitle . '.php', $sContent);
     //creating the second file, the  post file who receive the post form.
     $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl';
             $oCriteriaStep->add(StepPeer::STEP_TYPE_OBJ, 'DYNAFORM', CRITERIA::EQUAL);
             $oDataSetStep = StepPeer::doSelectRS($oCriteriaStep);
             $oDataSetStep->setFetchmode(ResultSet::FETCHMODE_ASSOC);
             $oDataSetStep->next();
             $aRows = $oDataSetStep->getRow();
             if (is_array($aRows) && !in_array($aRows['STEP_UID_OBJ'], $aDynaforms)) {
                 $aDynaforms[] = $aRows['STEP_UID_OBJ'];
             }
         }
         unset($value);
     }
     $oDataset->next();
 }
 if (count($aDynaforms) > 0) {
     require_once "classes/model/Dynaform.php";
     $dynInstance = new Dynaform();
     foreach ($aDynaforms as $key => $value) {
         $aAllFields = $dynInstance->getDynaformFields($value);
         if (is_array($aAllFields)) {
             foreach ($aAllFields as $kInput => $input) {
                 if (!isset($input->input)) {
                     continue;
                 }
                 if ($input->type == 'file' && $input->input == $_GET['UID'] && !empty($aAppDataFields['APP_DATA'][$kInput])) {
                     $aAppDataFields['APP_DATA'][$kInput] = $sOriginalName;
                     $oCase->updateCase($_GET['APP_UID'], $aAppDataFields);
                 }
             }
             unset($input);
         }
     }
示例#5
0
    public function getallDynaformsCriteria($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID)

    {

        //check OBJECT_PERMISSION table

        $this->verifyTable();



        $aObjectPermissions = $this->getAllObjects($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID);

        if (!is_array($aObjectPermissions)) {

            $aObjectPermissions = array(

                'DYNAFORMS' => array(-1),

                'INPUT_DOCUMENTS' => array(-1),

                'OUTPUT_DOCUMENTS' => array(-1)

            );

        }

        if (!isset($aObjectPermissions['DYNAFORMS'])) {

            $aObjectPermissions['DYNAFORMS'] = array(-1);

        } else {

            if (!is_array($aObjectPermissions['DYNAFORMS'])) {

                $aObjectPermissions['DYNAFORMS'] = array(-1);

            }

        }

        if (!isset($aObjectPermissions['INPUT_DOCUMENTS'])) {

            $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);

        } else {

            if (!is_array($aObjectPermissions['INPUT_DOCUMENTS'])) {

                $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);

            }

        }

        if (!isset($aObjectPermissions['OUTPUT_DOCUMENTS'])) {

            $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);

        } else {

            if (!is_array($aObjectPermissions['OUTPUT_DOCUMENTS'])) {

                $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);

            }

        }

        $oCriteria = new Criteria('workflow');

        $oCriteria->add(ApplicationPeer::APP_UID, $sApplicationUID);

        $oCriteria->addJoin(ApplicationPeer::PRO_UID, StepPeer::PRO_UID);

        $oCriteria->addJoin(StepPeer::STEP_UID_OBJ, DynaformPeer::DYN_UID);

        $oCriteria->add(StepPeer::STEP_TYPE_OBJ, 'DYNAFORM');

        $oCriteria->add(StepPeer::STEP_UID_OBJ, $aObjectPermissions['DYNAFORMS'], Criteria::IN);



        //These fields are missing now is completed

        $oCriteria->addSelectColumn(DynaformPeer::DYN_UID);

        $oCriteria->addSelectColumn(DynaformPeer::DYN_TYPE);

        $oCriteria->addSelectColumn(DynaformPeer::DYN_FILENAME);

        $oCriteria->addSelectColumn(ApplicationPeer::PRO_UID);

        ///-- Adding column STEP_POSITION for standardization

        $oCriteria->addSelectColumn(StepPeer::STEP_POSITION);



        $oCriteria->addAscendingOrderByColumn(StepPeer::STEP_POSITION);

        $oCriteria->setDistinct();





        $oDataset = DynaformPeer::doSelectRS($oCriteria);

        $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);

        $oDataset->next();

        $aInputDocuments = array();

        $aInputDocuments[] = array(

            'DYN_TITLE' => 'char'

        );



        while ($aRow = $oDataset->getRow()) {

            $o = new Dynaform();

            $o->setDynUid($aRow['DYN_UID']);

            $aFields['DYN_TITLE'] = $o->getDynTitle();

            $aFields['DYN_UID'] = $aRow['DYN_UID'];

            $aFields['EDIT'] = G::LoadTranslation('ID_EDIT');

            $aFields['PRO_UID'] = $sProcessUID;

            $aFields['APP_UID'] = $sApplicationUID;

            $aFields['TAS_UID'] = $sTasKUID;

            $aInputDocuments[] = $aFields;

            $oDataset->next();

        }



        $distinctArray = $aInputDocuments;

        $distinctArrayBase = $aInputDocuments;

        $distinctOriginal = array();

        foreach ($distinctArray as $distinctArrayKey => $distinctArrayValue) {

            $distinctOriginalPush = 1;

            foreach ($distinctOriginal as $distinctOriginalKey => $distinctOriginalValue) {

                if ($distinctArrayValue == $distinctOriginalValue) {

                    $distinctOriginalPush = 0;

                }

            }

            if ($distinctOriginalPush == 1) {

                $distinctOriginal[] = $distinctArrayValue;

            }

        }

        $aInputDocuments = $distinctOriginal;



        global $_DBArray;

        $_DBArray['Dynaforms'] = $aInputDocuments;

        $_SESSION['_DBArray'] = $_DBArray;

        G::LoadClass('ArrayPeer');

        $oCriteria = new Criteria('dbarray');

        $oCriteria->setDBArrayTable('Dynaforms');

        $oCriteria->setDistinct();

        //$oCriteria->addAscendingOrderByColumn(AppDocumentPeer::APP_DOC_CREATE_DATE);

        return $oCriteria;

    }
示例#6
0
    /**
     * Get data of a Step
     *
     * @param string $stepUid Unique id of Step
     *
     * return array Return an array with data of a Step
     */
    public function getStep($stepUid)
    {
        try {
            $arrayStep = array();

            //Verify data
            $this->throwExceptionIfNotExistsStep($stepUid);

            //Get data
            //Call plugin
            $pluginRegistry = &\PMPluginRegistry::getSingleton();
            $externalSteps = $pluginRegistry->getSteps();

            $criteria = new \Criteria("workflow");

            $criteria->add(\StepPeer::STEP_UID, $stepUid, \Criteria::EQUAL);

            $rsCriteria = \StepPeer::doSelectRS($criteria);
            $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);

            $rsCriteria->next();

            $row = $rsCriteria->getRow();

            $titleObj = "";
            $descriptionObj = "";

            switch ($row["STEP_TYPE_OBJ"]) {
                case "DYNAFORM":
                    $dynaform = new \Dynaform();
                    $arrayData = $dynaform->load($row["STEP_UID_OBJ"]);

                    $titleObj = $arrayData["DYN_TITLE"];
                    $descriptionObj = $arrayData["DYN_DESCRIPTION"];
                    break;
                case "INPUT_DOCUMENT":
                    $inputDocument = new \InputDocument();
                    $arrayData = $inputDocument->getByUid($row["STEP_UID_OBJ"]);

                    if ($arrayData === false) {
                        return $arrayStep;
                    }

                    $titleObj = $arrayData["INP_DOC_TITLE"];
                    $descriptionObj = $arrayData["INP_DOC_DESCRIPTION"];
                    break;
                case "OUTPUT_DOCUMENT":
                    $outputDocument = new \OutputDocument();
                    $arrayData = $outputDocument->getByUid($row["STEP_UID_OBJ"]);

                    if ($arrayData === false) {
                        return $arrayStep;
                    }

                    $titleObj = $arrayData["OUT_DOC_TITLE"];
                    $descriptionObj = $arrayData["OUT_DOC_DESCRIPTION"];
                    break;
                case "EXTERNAL":
                    $titleObj = "unknown " . $row["STEP_UID"];

                    if (is_array($externalSteps) && count($externalSteps) > 0) {
                        foreach ($externalSteps as $key => $value) {
                            if ($value->sStepId == $row["STEP_UID_OBJ"]) {
                                $titleObj = $value->sStepTitle;
                            }
                        }
                    }
                    break;
            }

            //Return
            $arrayStep = array(
                $this->getFieldNameByFormatFieldName("STEP_UID")        => $stepUid,
                $this->getFieldNameByFormatFieldName("STEP_TYPE_OBJ")   => $row["STEP_TYPE_OBJ"],
                $this->getFieldNameByFormatFieldName("STEP_UID_OBJ")    => $row["STEP_UID_OBJ"],
                $this->getFieldNameByFormatFieldName("STEP_CONDITION")  => $row["STEP_CONDITION"],
                $this->getFieldNameByFormatFieldName("STEP_POSITION")   => (int)($row["STEP_POSITION"]),
                $this->getFieldNameByFormatFieldName("STEP_MODE")       => $row["STEP_MODE"],
                $this->getFieldNameByFormatFieldName("OBJ_TITLE")       => $titleObj,
                $this->getFieldNameByFormatFieldName("OBJ_DESCRIPTION") => $descriptionObj
            );

            return $arrayStep;
        } catch (\Exception $e) {
            throw $e;
        }
    }
示例#7
0
	';
$tree->showSign = false;
G::LoadClass('case');
$o = new Cases();
$steps = $o->getAllDynaformsStepsToRevise($_GET['APP_UID']);
$APP_UID = $_GET['APP_UID'];
$DEL_INDEX = $_GET['DEL_INDEX'];
$html = "\r\n      <table cellspacing='0' cellpadding='0' border='1' style='border:0px;'>\r\n        <tr>\r\n        <td class='treeNode' style='border:0px;background-color:transparent;'><b>Dynaforms<b></td>\r\n        </tr>\r\n      </table>";
$ch =& $tree->addChild("", $html, array('nodeType' => 'child'));
$ch->point = '</span><img src="/images/plus.gif" />';
$i = 1;
$PRO_UID = '';
$DYN_UID = '';
foreach ($steps as $step) {
    require_once 'classes/model/Dynaform.php';
    $od = new Dynaform();
    $dynaformF = $od->Load($step['STEP_UID_OBJ']);
    $n = $step['STEP_POSITION'];
    $TITLE = " - " . $dynaformF['DYN_TITLE'];
    $DYN_UID = $dynaformF['DYN_UID'];
    $PRO_UID = $step['PRO_UID'];
    $html = "\r\n      <table cellspacing='0' cellpadding='0' border='1' style='border:0px;'>\r\n        <tr>\r\n        <td class='treeNode' style='border:0px;background-color:transparent;'><span id='focus{$i}'></td>\r\n        <td class='treeNode' style='border:0px;background-color:transparent;'>&nbsp;&nbsp;{$n}&nbsp;&nbsp;</td>\r\n          <td class='treeNode' style='border:0px;background-color:transparent;'>\r\n\t\t  \t<a href=\"cases_StepToRevise?type=DYNAFORM&ex={$i}&PRO_UID={$PRO_UID}&DYN_UID={$DYN_UID}&APP_UID={$APP_UID}&position=" . $step['STEP_POSITION'] . "&DEL_INDEX={$DEL_INDEX}\">{$TITLE}</a>\r\n\t\t  </td>\r\n        </tr>\r\n      </table>";
    $ch =& $tree->addChild("", $html, array('nodeType' => 'child'));
    $ch->point = '<img src="/images/ftv2mnode.gif" />';
    $i++;
}
$html = "\r\n      <table cellspacing='0' cellpadding='0' border='1' style='border:0px;'>\r\n        <tr>\r\n          <td class='treeNode' style='border:0px;background-color:transparent;'><span id='focus{$i}'></td>\r\n          <td class='treeNode' style='border:0px;background-color:transparent;'>\r\n\t\t  \t<a href=\"cases_StepToReviseInputs?PRO_UID={$PRO_UID}&APP_UID={$APP_UID}&DEL_INDEX={$DEL_INDEX}\">&nbsp;&nbsp;Input Documents</a>\r\n\t\t  </td>\r\n        </tr>\r\n      </table>";
$ch =& $tree->addChild("", $html, array('nodeType' => 'child'));
$ch->point = '</span><img src="/images/plus.gif" />';
$steps = $o->getAllInputsStepsToRevise($_GET['APP_UID']);
//$i=1;
 /**
  * generateJrxmlFromDynaform
  *
  * @param string $outDocUid
  * @param string $dynaformUid
  * @param object $template
  * @return void
  */
 function generateJrxmlFromDynaform($outDocUid, $dynaformUid, $template)
 {
     require_once 'classes/model/Dynaform.php';
     $dyn = new Dynaform();
     $aFields = $dyn->load($dynaformUid);
     $xmlFields = $dyn->getDynaformFields($dynaformUid);
     $reportTpl = PATH_TPL . 'javaBridgePM/classic.xml';
     $reportFilename = PATH_DYNAFORM . $aFields['PRO_UID'] . PATH_SEP . $outDocUid . '.jrxml';
     foreach ($xmlFields as $key => $val) {
         if ($val->type == 'submit' || $val->type == 'button' || $val->type == 'title' || $val->type == 'subtitle') {
             unset($xmlFields[$key]);
         }
     }
     //$sqlSentence = 'SELECT * from ' . $tableName;
     $sqlSentence = 'dynaform/';
     $template = new TemplatePower($reportTpl);
     $template->prepare();
     $template->assign('sqlSentence', $sqlSentence);
     $template->assign('tableName', $aFields['DYN_TITLE']);
     $template->assign('heightDetail', count($xmlFields) * 15 + 20);
     $template->assign('PAGE_NUMBER', '{PAGE_NUMBER}');
     $logoReporte = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/images/processmaker.logo.jpg';
     $template->assign('logoReporte', $logoReporte);
     foreach ($xmlFields as $key => $val) {
         $template->newBlock('fields');
         $template->assign('fieldName', $key);
     }
     $posX = 140;
     $posLabelX = 5;
     $posY = 10;
     foreach ($xmlFields as $key => $val) {
         $template->newBlock('detailFields');
         $template->assign('fieldName', '{' . $key . '}');
         $template->assign('fieldLabel', $key);
         $template->assign('labelPosX', $posLabelX);
         $template->assign('fieldPosX', $posX);
         $template->assign('fieldPosY', $posY);
         $posY += 15;
     }
     $content = $template->getOutputContent();
     $iSize = file_put_contents($reportFilename, $content);
     printf("saved %s bytes in file %s \n", $iSize, $reportFilename);
 }
 /**
  * Get data of a Case Tracker Object
  *
  * @param string $caseTrackerObjectUid Unique id of Case Tracker Object
  *
  * return array Return an array with data of a Case Tracker Object
  */
 public function getCaseTrackerObject($caseTrackerObjectUid)
 {
     try {
         //Verify data
         $caseTrackerObject = new \CaseTrackerObject();
         if (!$caseTrackerObject->caseTrackerObjectExists($caseTrackerObjectUid)) {
             throw new \Exception(\G::LoadTranslation("ID_CASE_TRACKER_OBJECT_DOES_NOT_EXIST", array(strtolower("CTO_UID"), $caseTrackerObjectUid)));
         }
         //Get data
         $dynaform = new \Dynaform();
         $inputDocument = new \InputDocument();
         $outputDocument = new \OutputDocument();
         $criteria = new \Criteria("workflow");
         $criteria->add(\CaseTrackerObjectPeer::CTO_UID, $caseTrackerObjectUid, \Criteria::EQUAL);
         $rsCriteria = \CaseTrackerObjectPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         $rsCriteria->next();
         $row = $rsCriteria->getRow();
         $titleObj = "";
         $descriptionObj = "";
         switch ($row["CTO_TYPE_OBJ"]) {
             case "DYNAFORM":
                 $arrayData = $dynaform->load($row["CTO_UID_OBJ"]);
                 $titleObj = $arrayData["DYN_TITLE"];
                 $descriptionObj = $arrayData["DYN_DESCRIPTION"];
                 break;
             case "INPUT_DOCUMENT":
                 $arrayData = $inputDocument->getByUid($row["CTO_UID_OBJ"]);
                 $titleObj = $arrayData["INP_DOC_TITLE"];
                 $descriptionObj = $arrayData["INP_DOC_DESCRIPTION"];
                 break;
             case "OUTPUT_DOCUMENT":
                 $arrayData = $outputDocument->getByUid($row["CTO_UID_OBJ"]);
                 $titleObj = $arrayData["OUT_DOC_TITLE"];
                 $descriptionObj = $arrayData["OUT_DOC_DESCRIPTION"];
                 break;
         }
         return array("cto_uid" => $row["CTO_UID"], "cto_type_obj" => $row["CTO_TYPE_OBJ"], "cto_uid_obj" => $row["CTO_UID_OBJ"], "cto_condition" => $row["CTO_CONDITION"], "cto_position" => (int) $row["CTO_POSITION"], "obj_title" => $titleObj, "obj_description" => $descriptionObj);
     } catch (\Exception $e) {
         throw $e;
     }
 }
 /**
  * Validate Dynaform Uid
  * @var string $dyn_uid. Uid for dynaform
  *
  * @author Brayan Pereyra (Cochalo) <*****@*****.**>
  * @copyright Colosa - Bolivia
  *
  * @return string
  */
 public function validateDynUid($dyn_uid)
 {
     $dyn_uid = trim($dyn_uid);
     if ($dyn_uid == '') {
         throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_NOT_EXIST", array('dyn_uid', '')));
     }
     $oDynaform = new \Dynaform();
     if (!$oDynaform->dynaformExists($dyn_uid)) {
         throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_NOT_EXIST", array('dyn_uid', $dyn_uid)));
     }
     return $dyn_uid;
 }
示例#11
0
<?php

$response = new stdclass();
$response->status = isset($_SESSION['USER_LOGGED']);
if (isset($_REQUEST['dynaformEditorParams'])) {
    $arrayParameterAux = @unserialize(rawurldecode($_REQUEST["dynaformEditorParams"]));
    if (!empty($arrayParameterAux) && isset($arrayParameterAux["DYNAFORM_NAME"])) {
        $arrayParameterAux["DYNAFORM_NAME"] = base64_decode($arrayParameterAux["DYNAFORM_NAME"]);
        $_SESSION["Current_Dynafom"]["Parameters"] = $arrayParameterAux;
        if (isset($_REQUEST['DYN_UID'])) {
            if (class_exists('Dynaform')) {
                require_once 'classes/model/Dynaform.php';
            }
            $dynaform = new Dynaform();
            $dynaform->load($_REQUEST['DYN_UID']);
            G::LoadClass('dynaformEditor');
            $editor = new dynaformEditor(array());
            $editor->file = $dynaform->getDynFilename();
            $editor->home = PATH_DYNAFORM;
            $editor->title = $dynaform->getDynTitle();
            $editor->dyn_uid = $dynaform->getDynUid();
            $editor->pro_uid = $dynaform->getProUid();
            $editor->dyn_type = $dynaform->getDynType();
            $editor->dyn_title = $dynaform->getDynTitle();
            $editor->dyn_description = $dynaform->getDynDescription();
            $editor->dyn_editor = 'processmap';
            $editor->_setUseTemporalCopy(true);
            $A = isset($_SESSION['Current_Dynafom']['Parameters']['URL']) ? $_SESSION['Current_Dynafom']['Parameters']['URL'] : '';
            $form = new Form($dynaform->getProUid() . '/' . $dynaform->getDynUid(), PATH_DYNAFORM, SYS_LANG, true);
            $properties = array('A' => $A, 'DYN_UID' => $dynaform->getDynUid(), 'PRO_UID' => $dynaform->getProUid(), 'DYN_TITLE' => $dynaform->getDynTitle(), 'DYN_TYPE' => $dynaform->getDynType(), 'DYN_DESCRIPTION' => $dynaform->getDynDescription(), 'WIDTH' => $form->width, 'MODE' => $form->mode, 'PRINTDYNAFORM' => $form->printdynaform, 'ADJUSTGRIDSWIDTH' => $form->adjustgridswidth, 'NEXTSTEPSAVE' => $form->nextstepsave);
            $tmp = $editor->_getTmpData();
示例#12
0
 public function showObjects($pro_uid, $app_uid, $obj_uid, $typeObject)
 {
     switch ($typeObject) {
         case 'DYNAFORM':
             $oCase = new \Cases();
             $Fields = $oCase->loadCase($app_uid);
             $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = '';
             $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = '';
             $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = '#';
             $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = 'alert("Sample"); return false;';
             $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PRINT_PREVIEW'] = '#';
             $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PRINT_PREVIEW_ACTION'] = 'tracker_PrintView?CTO_UID_OBJ=' . $obj_uid . '&CTO_TYPE_OBJ=PRINT_PREVIEW';
             $dynaForm = new \Dynaform();
             $arrayDynaFormData = $dynaForm->Load($obj_uid);
             if (isset($arrayDynaFormData["DYN_VERSION"]) && $arrayDynaFormData["DYN_VERSION"] == 2) {
                 \G::LoadClass("pmDynaform");
                 $Fields["PRO_UID"] = $pro_uid;
                 $Fields["CURRENT_DYNAFORM"] = $obj_uid;
                 $pmDynaForm = new \pmDynaform($Fields);
                 //                    if ($pmDynaForm->isResponsive()) {
                 //                        $pmDynaForm->printTracker();
                 //                    }
                 $response = $pmDynaForm;
             }
             break;
         case 'INPUT_DOCUMENT':
             //G::LoadClass( 'case' );
             $oCase = new \Cases();
             $c = $oCase->getAllUploadedDocumentsCriteriaTracker($pro_uid, $app_uid, $obj_uid);
             //                $response = array();
             if ($c->getDbName() == 'dbarray') {
                 $rs = \ArrayBasePeer::doSelectRs($c);
                 $rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
                 $rs->next();
                 $doc = array();
                 while ($row = $rs->getRow()) {
                     $doc[] = $row;
                     $rs->next();
                 }
                 //$response = $this->parserObjects($objects);
             }
             $response = $doc;
             break;
         case 'OUTPUT_DOCUMENT':
             //G::LoadClass( 'case' );
             $oCase = new \Cases();
             $c = $oCase->getAllGeneratedDocumentsCriteriaTracker($pro_uid, $app_uid, $obj_uid);
             $response = $c;
             break;
     }
     return $response;
 }
示例#13
0
    /**
     * Delete Process
     *
     * @param string $processUid
     * @param bool   $checkCases
     *
     * return bool   Return true, if is succesfully
     *
     * @access public

    DEPRECATED
    public function deleteProcess($processUid, $checkCases = true)
    {
        if ($checkCases) {
            $process = new \Process();

            $arrayCases = $process->getCasesCountInAllProcesses($processUid);

            $sum = 0;

            if (isset($arrayCases[$processUid]) && count($arrayCases[$processUid]) > 0) {
                foreach ($arrayCases[$processUid] as $value) {
                    $sum = $sum + $value;
                }
            }

            if ($sum > 0) {
                throw (new \Exception("You can't delete the process, because it has $sum cases"));
            }
        }

        $processMap = new \processMap();

        return $processMap->deleteProcess($processUid);

    }*/

    public function deleteProcess($sProcessUID)
    {
        try {
            G::LoadClass('case');
            G::LoadClass('reportTables');
            //Instance all classes necesaries
            $oProcess = new Process();
            $oDynaform = new Dynaform();
            $oInputDocument = new InputDocument();
            $oOutputDocument = new OutputDocument();
            $oTrigger = new Triggers();
            $oRoute = new Route();
            $oGateway = new Gateway();
            $oEvent = new Event();
            $oSwimlaneElement = new SwimlanesElements();
            $oConfiguration = new Configuration();
            $oDbSource = new DbSource();
            $oReportTable = new ReportTables();
            $oCaseTracker = new CaseTracker();
            $oCaseTrackerObject = new CaseTrackerObject();
            //Delete the applications of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(ApplicationPeer::PRO_UID, $sProcessUID);
            $oDataset = ApplicationPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            $oCase = new Cases();
            while ($aRow = $oDataset->getRow()) {
                $oCase->removeCase($aRow['APP_UID']);
                $oDataset->next();
            }
            //Delete the tasks of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(TaskPeer::PRO_UID, $sProcessUID);
            $oDataset = TaskPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $this->deleteTask($aRow['TAS_UID']);
                $oDataset->next();
            }
            //Delete the dynaforms of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(DynaformPeer::PRO_UID, $sProcessUID);
            $oDataset = DynaformPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oDynaform->remove($aRow['DYN_UID']);
                $oDataset->next();
            }
            //Delete the input documents of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(InputDocumentPeer::PRO_UID, $sProcessUID);
            $oDataset = InputDocumentPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oInputDocument->remove($aRow['INP_DOC_UID']);
                $oDataset->next();
            }
            //Delete the output documents of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(OutputDocumentPeer::PRO_UID, $sProcessUID);
            $oDataset = OutputDocumentPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oOutputDocument->remove($aRow['OUT_DOC_UID']);
                $oDataset->next();
            }

            //Delete the triggers of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(TriggersPeer::PRO_UID, $sProcessUID);
            $oDataset = TriggersPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oTrigger->remove($aRow['TRI_UID']);
                $oDataset->next();
            }

            //Delete the routes of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(RoutePeer::PRO_UID, $sProcessUID);
            $oDataset = RoutePeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oRoute->remove($aRow['ROU_UID']);
                $oDataset->next();
            }

            //Delete the gateways of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(GatewayPeer::PRO_UID, $sProcessUID);
            $oDataset = GatewayPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oGateway->remove($aRow['GAT_UID']);
                $oDataset->next();
            }

            //Delete the Event of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(EventPeer::PRO_UID, $sProcessUID);
            $oDataset = EventPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oEvent->remove($aRow['EVN_UID']);
                $oDataset->next();
            }

            //Delete the swimlanes elements of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(SwimlanesElementsPeer::PRO_UID, $sProcessUID);
            $oDataset = SwimlanesElementsPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oSwimlaneElement->remove($aRow['SWI_UID']);
                $oDataset->next();
            }
            //Delete the configurations of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(ConfigurationPeer::PRO_UID, $sProcessUID);
            $oDataset = ConfigurationPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oConfiguration->remove($aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID']);
                $oDataset->next();
            }
            //Delete the DB sources of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(DbSourcePeer::PRO_UID, $sProcessUID);
            $oDataset = DbSourcePeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {

                /**
                 * note added by gustavo cruz gustavo-at-colosa-dot-com 27-01-2010
                 * in order to solve the bug 0004389, we use the validation function Exists
                 * inside the remove function in order to verify if the DbSource record
                 * exists in the Database, however there is a strange behavior within the
                 * propel engine, when the first record is erased somehow the "_deleted"
                 * attribute of the next row is set to true, so when propel tries to erase
                 * it, obviously it can't and trows an error. With the "Exist" function
                 * we ensure that if there is the record in the database, the _delete attribute must be false.
                 *
                 * note added by gustavo cruz gustavo-at-colosa-dot-com 28-01-2010
                 * I have just identified the source of the issue, when is created a $oDbSource DbSource object
                 * it's used whenever a record is erased or removed in the db, however the problem
                 * it's that the same object is used every time, and the delete method invoked
                 * sets the _deleted attribute to true when its called, of course as we use
                 * the same object, the first time works fine but trowns an error with the
                 * next record, cos it's the same object and the delete method checks if the _deleted
                 * attribute it's true or false, the attrib _deleted is setted to true the
                 * first time and later is never changed, the issue seems to be part of
                 * every remove function in the model classes, not only DbSource
                 * i recommend that a more general solution must be achieved to resolve
                 * this issue in every model class, to prevent future problems.
                 */
                $oDbSource->remove($aRow['DBS_UID'], $sProcessUID);
                $oDataset->next();
            }
            //Delete the supervisors
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(ProcessUserPeer::PRO_UID, $sProcessUID);
            ProcessUserPeer::doDelete($oCriteria);
            //Delete the object permissions
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(ObjectPermissionPeer::PRO_UID, $sProcessUID);
            ObjectPermissionPeer::doDelete($oCriteria);
            //Delete the step supervisors
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(StepSupervisorPeer::PRO_UID, $sProcessUID);
            StepSupervisorPeer::doDelete($oCriteria);
            //Delete the report tables
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(ReportTablePeer::PRO_UID, $sProcessUID);
            $oDataset = ReportTablePeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oReportTable->deleteReportTable($aRow['REP_TAB_UID']);
                $oDataset->next();
            }
            //Delete case tracker configuration
            $oCaseTracker->remove($sProcessUID);
            //Delete case tracker objects
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
            ProcessUserPeer::doDelete($oCriteria);
            //Delete the process
            try {
                $oProcess->remove($sProcessUID);
            } catch (Exception $oError) {
                throw ($oError);
            }
            return true;
        } catch (Exception $oError) {
            throw ($oError);
        }
    }
示例#14
0
function reload($fieldName, $fieldParent, $valueRecived, $appid, $filename)
{
    global $HTTP_SESSION_VARS;
    $G_FORM = new Form();
    G::LoadSystem("xmlform");
    G::LoadClass("dynaform");
    $fieldNew[$fieldParent] = $valueRecived;
    $Connection = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME);
    $ses = new DBSession($Connection);
    $xml = new Xmlform();
    $vars = explode('][', $fieldName);
    if (is_array($vars)) {
        $cant = count($vars);
        $fieldName = $vars[$cant - 1];
        if ($cant > 1) {
            $filename = $vars[0];
        }
    }
    $vars2 = explode('][', $fieldParent);
    if (is_array($vars2)) {
        $cant2 = count($vars2);
        $fieldParent = $vars2[$cant2 - 1];
    }
    $v = $filename;
    $xml->home = PATH_XMLFORM;
    $fieldXmlform = $xml->parseXmlformToArray($v);
    $fieldNew[$fieldParent] = $fieldXmlform[$fieldName][defaultvalue];
    if ($valueRecived != '') {
        $fieldNew[$fieldParent] = $valueRecived;
    }
    $qry = stripslashes($fieldXmlform[$fieldName][Sql]);
    $fieldNew[$fieldParent] = $fieldXmlform[$fieldName][defaultvalue];
    if ($valueRecived != '') {
        $fieldNew[$fieldParent] = $valueRecived;
    }
    if ($qry != '') {
        $conexion = $fieldXmlform[$fieldName][sqlconnection];
        G::LoadClass('dynaform');
        $myDyna = new Dynaform($Connection);
        $fieldsBase = array();
        if ($HTTP_SESSION_VARS['CURRENT_APPLICATION'] != "0") {
            $fieldsBase = $myDyna->getFieldsDefaultDynaform($appid, 0);
        }
        if ($appid != "") {
            $Fields = G::array_merges($fieldsBase, $fieldNew);
            $qry = $myDyna->replaceTextWithFields($qry, $Fields);
        } else {
            $qry = "Select '1', 'dynamically filled' ";
        }
        eval('$Result = "$qry "; ');
        $options = LoadOptions($Result, $Connection);
    }
    return $options;
}
}
//setDynDescription
try {
    $obj = new Dynaform();
    $obj->setDynDescription('x');
} catch (Exception $e) {
    //#13
    $t->isa_ok($e, 'Exception', 'setDynDescription() return error when DYN_UID is not defined');
    //#14
    $t->is($e->getMessage(), "Error in setDynDescription, the DYN_UID can't be blank", 'setDynDescription() return Error in getAppTitle, the APP_UID cant be blank');
}
//getDynDescription
try {
    $obj = new Dynaform();
    $res = $obj->getDynDescription();
} catch (Exception $e) {
    //#15
    $t->isa_ok($e, 'Exception', 'getDynDescription() return error when DYN_UID is not defined');
    //#16
    $t->is($e->getMessage(), "Error in getDynDescription, the DYN_UID can't be blank", 'getDynDescription() return Error in getDynDescription, the DYN_UID cant be blank');
}
//setAppDescription
try {
    $obj = new Dynaform();
    $obj->setDynDescription('x');
} catch (Exception $e) {
    //#17
    $t->isa_ok($e, 'Exception', 'setAppDescription() return error when DYN_UID is not defined');
    //#18
    $t->is($e->getMessage(), "Error in setDynDescription, the DYN_UID can't be blank", 'setAppDescription() return Error in getAppDescription, the APP_UID cant be blank');
}
示例#16
0
    /**
     * Validates all modified columns of given Dynaform object.
     * If parameter $columns is either a single column name or an array of column names
     * than only those columns are validated.
     *
     * NOTICE: This does not apply to primary or foreign keys for now.
     *
     * @param      Dynaform $obj The object to validate.
     * @param      mixed $cols Column name or array of column names.
     *
     * @return     mixed TRUE if all columns are valid or the error message of the first invalid column.
     */
    public static function doValidate(Dynaform $obj, $cols = null)
    {
        $columns = array();

        if ($cols) {
            $dbMap = Propel::getDatabaseMap(DynaformPeer::DATABASE_NAME);
            $tableMap = $dbMap->getTable(DynaformPeer::TABLE_NAME);

            if (! is_array($cols)) {
                $cols = array($cols);
            }

            foreach ($cols as $colName) {
                if ($tableMap->containsColumn($colName)) {
                    $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
                    $columns[$colName] = $obj->$get();
                }
            }
        } else {

        if ($obj->isNew() || $obj->isColumnModified(DynaformPeer::DYN_TYPE))
            $columns[DynaformPeer::DYN_TYPE] = $obj->getDynType();

        }

        return BasePeer::doValidate(DynaformPeer::DATABASE_NAME, DynaformPeer::TABLE_NAME, $columns);
    }
示例#17
0
 /**
  * Get all Case Tracker Objects of a Process
  *
  * @param string $processUid Unique id of Process
  *
  * return array Return an array with all Case Tracker Objects of a Process
  */
 public function getCaseTrackerObjects($processUid)
 {
     try {
         $arrayCaseTrackerObject = array();
         //Verify data
         $process = new \ProcessMaker\BusinessModel\Process();
         $process->throwExceptionIfNotExistsProcess($processUid, "prj_uid");
         $dynaform = new \Dynaform();
         $inputDocument = new \InputDocument();
         $outputDocument = new \OutputDocument();
         $arrayCaseTrackerObject = array();
         $criteria = new \Criteria("workflow");
         $criteria->add(\CaseTrackerObjectPeer::PRO_UID, $processUid, \Criteria::EQUAL);
         $rsCriteria = \CaseTrackerObjectPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $titleObj = "";
             $descriptionObj = "";
             switch ($row["CTO_TYPE_OBJ"]) {
                 case "DYNAFORM":
                     $arrayData = $dynaform->load($row["CTO_UID_OBJ"]);
                     $titleObj = $arrayData["DYN_TITLE"];
                     $descriptionObj = $arrayData["DYN_DESCRIPTION"];
                     break;
                 case "INPUT_DOCUMENT":
                     $arrayData = $inputDocument->getByUid($row["CTO_UID_OBJ"]);
                     $titleObj = $arrayData["INP_DOC_TITLE"];
                     $descriptionObj = $arrayData["INP_DOC_DESCRIPTION"];
                     break;
                 case "OUTPUT_DOCUMENT":
                     $arrayData = $outputDocument->getByUid($row["CTO_UID_OBJ"]);
                     $titleObj = $arrayData["OUT_DOC_TITLE"];
                     $descriptionObj = $arrayData["OUT_DOC_DESCRIPTION"];
                     break;
             }
             $arrayCaseTrackerObject[] = array("cto_uid" => $row["CTO_UID"], "cto_type_obj" => $row["CTO_TYPE_OBJ"], "cto_uid_obj" => $row["CTO_UID_OBJ"], "cto_condition" => $row["CTO_CONDITION"], "cto_position" => (int) $row["CTO_POSITION"], "obj_title" => $titleObj, "obj_description" => $descriptionObj);
         }
         $arrayCaseTrackerObject = \ProcessMaker\Util\ArrayUtil::sort($arrayCaseTrackerObject, array("cto_position"), SORT_ASC);
         return $arrayCaseTrackerObject;
     } catch (\Exception $e) {
         throw $e;
     }
 }
示例#18
0
 public function getDynaformHistory($PRO_UID, $TAS_UID, $APP_UID, $DYN_UID = "")
 {
     G::LoadClass('case');
     $oCase = new Cases();
     $oCase->verifyTable();
     $aObjectPermissions = $oCase->getAllObjects($PRO_UID, $APP_UID, $TAS_UID, $_SESSION['USER_LOGGED']);
     if (!is_array($aObjectPermissions)) {
         $aObjectPermissions = array('DYNAFORMS' => array(-1), 'INPUT_DOCUMENTS' => array(-1), 'OUTPUT_DOCUMENTS' => array(-1));
     }
     if (!isset($aObjectPermissions['DYNAFORMS'])) {
         $aObjectPermissions['DYNAFORMS'] = array(-1);
     } else {
         if (!is_array($aObjectPermissions['DYNAFORMS'])) {
             $aObjectPermissions['DYNAFORMS'] = array(-1);
         }
     }
     if (!isset($aObjectPermissions['INPUT_DOCUMENTS'])) {
         $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
     } else {
         if (!is_array($aObjectPermissions['INPUT_DOCUMENTS'])) {
             $aObjectPermissions['INPUT_DOCUMENTS'] = array(-1);
         }
     }
     if (!isset($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
         $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
     } else {
         if (!is_array($aObjectPermissions['OUTPUT_DOCUMENTS'])) {
             $aObjectPermissions['OUTPUT_DOCUMENTS'] = array(-1);
         }
     }
     $appDocument = new AppDocument();
     foreach (array("INPUT_DOCUMENTS", "OUTPUT_DOCUMENTS") as $value) {
         $key = $value;
         if ($aObjectPermissions[$key]) {
             foreach ($aObjectPermissions[$key] as $key2 => $value2) {
                 $appDocumentUid = $value2;
                 try {
                     $arrayAppDocumentData = $appDocument->load($appDocumentUid);
                     $aObjectPermissions[$key][$key2] = $arrayAppDocumentData["DOC_UID"];
                 } catch (Exception $e) {
                 }
             }
         }
     }
     $dynaForm = new Dynaform();
     $inputDocument = new InputDocument();
     $outputDocument = new OutputDocument();
     $c = new Criteria('workflow');
     $c->addSelectColumn(AppHistoryPeer::APP_UID);
     $c->addSelectColumn(AppHistoryPeer::DEL_INDEX);
     $c->addSelectColumn(AppHistoryPeer::PRO_UID);
     $c->addSelectColumn(AppHistoryPeer::TAS_UID);
     $c->addSelectColumn(AppHistoryPeer::DYN_UID);
     $c->addSelectColumn(AppHistoryPeer::OBJ_TYPE);
     $c->addSelectColumn(AppHistoryPeer::USR_UID);
     $c->addSelectColumn(AppHistoryPeer::APP_STATUS);
     $c->addSelectColumn(AppHistoryPeer::HISTORY_DATE);
     $c->addSelectColumn(AppHistoryPeer::HISTORY_DATA);
     $c->addSelectColumn(UsersPeer::USR_FIRSTNAME);
     $c->addSelectColumn(UsersPeer::USR_LASTNAME);
     $c->addAsColumn('USR_NAME', "CONCAT(USR_LASTNAME, ' ', USR_FIRSTNAME)");
     $c->addJoin(AppHistoryPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
     //WHERE
     $c->add($c->getNewCriterion(AppHistoryPeer::DYN_UID, $aObjectPermissions["DYNAFORMS"], Criteria::IN)->addOr($c->getNewCriterion(AppHistoryPeer::DYN_UID, $aObjectPermissions["INPUT_DOCUMENTS"], Criteria::IN))->addOr($c->getNewCriterion(AppHistoryPeer::DYN_UID, $aObjectPermissions["OUTPUT_DOCUMENTS"], Criteria::IN)));
     $c->add(AppHistoryPeer::PRO_UID, $PRO_UID);
     $c->add(AppHistoryPeer::APP_UID, $APP_UID);
     $c->add(AppHistoryPeer::TAS_UID, $TAS_UID);
     if (isset($DYN_UID) && $DYN_UID != "") {
         $c->add(AppHistoryPeer::DYN_UID, $DYN_UID);
     }
     //Execute
     $oDataset = AppHistoryPeer::doSelectRS($c);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $aDynHistory = array();
     $aDynHistory[] = array('DYN_TITLE' => 'char');
     while ($oDataset->next()) {
         $aRow = $oDataset->getRow();
         $title = "";
         switch ($aRow["OBJ_TYPE"]) {
             case "DYNAFORM":
                 $arrayDynaFormData = $dynaForm->Load($aRow["DYN_UID"]);
                 $title = $arrayDynaFormData["DYN_TITLE"] . " (" . G::LoadTranslation("ID_DYNAFORM") . ")";
                 break;
             case "INPUT_DOCUMENT":
                 $arrayInputDocumentData = $inputDocument->load($aRow["DYN_UID"]);
                 $title = $arrayInputDocumentData["INP_DOC_TITLE"] . " (" . G::LoadTranslation("ID_INPUT_DOCUMENT") . ")";
                 break;
             case "OUTPUT_DOCUMENT":
                 $arrayOutputDocumentData = $outputDocument->load($aRow["DYN_UID"]);
                 $title = $arrayOutputDocumentData["OUT_DOC_TITLE"] . " (" . G::LoadTranslation("ID_OUTPUT_DOCUMENT") . ")";
                 break;
             case "ASSIGN_TASK":
                 $title = G::LoadTranslation("ID_ASSIGN_TASK") . " (" . G::LoadTranslation("ID_TRIGGERS") . ")";
                 break;
         }
         $aRow["DYN_TITLE"] = $title;
         $changedValues = unserialize($aRow['HISTORY_DATA']);
         $html = "<table border='0' cellpadding='0' cellspacing='0'>";
         $sw_add = false;
         foreach ($changedValues as $key => $value) {
             if ($value != null && !is_array($value)) {
                 $sw_add = true;
                 $html .= "<tr>";
                 $html .= "<td><b>{$key}:</b> </td>";
                 $html .= "<td>{$value}</td>";
                 $html .= "</tr>";
             }
             if (is_array($value)) {
                 $html .= "<tr>";
                 $html .= "<td><b>{$key} (grid):</b> </td>";
                 $html .= "<td>";
                 $html .= "<table>";
                 foreach ($value as $key1 => $value1) {
                     $html .= "<tr>";
                     $html .= "<td><b>{$key1}</b></td>";
                     $html .= "<td>";
                     if (is_array($value1)) {
                         $sw_add = true;
                         $html .= "<table>";
                         foreach ($value1 as $key2 => $value2) {
                             $html .= "<tr>";
                             $html .= "<td><b>{$key2}</b></td>";
                             $html .= "<td>{$value2}</td>";
                             $html .= "</tr>";
                         }
                         $html .= "</table>";
                     }
                     $html .= "</td>";
                     $html .= "</tr>";
                 }
                 $html .= "</table>";
                 $html .= "</td>";
                 $html .= "</tr>";
                 $html .= "</td>";
             }
         }
         $html .= "</table>";
         $aRow['FIELDS'] = $html;
         if ($sw_add) {
             $aDynHistory[] = $aRow;
         }
     }
     global $_DBArray;
     $_DBArray['DynaformsHistory'] = $aDynHistory;
     $_SESSION['_DBArray'] = $_DBArray;
     G::LoadClass('ArrayPeer');
     $oCriteria = new Criteria('dbarray');
     $oCriteria->setDBArrayTable('DynaformsHistory');
     $oCriteria->addAscendingOrderByColumn(AppHistoryPeer::HISTORY_DATE);
     return $oCriteria;
 }
示例#19
0
 public function deleteProcess($sProcessUID, $flagRemoveCases = true)
 {
     try {
         //G::LoadClass('case');
         //G::LoadClass('reportTables');
         //Instance all classes necesaries
         $oProcess = new \Process();
         $oDynaform = new \Dynaform();
         $oInputDocument = new \InputDocument();
         $oOutputDocument = new \OutputDocument();
         $oTrigger = new \Triggers();
         $oRoute = new \Route();
         $oGateway = new \Gateway();
         $oEvent = new \Event();
         $oSwimlaneElement = new \SwimlanesElements();
         $oConfiguration = new \Configuration();
         $oDbSource = new \DbSource();
         $oReportTable = new \ReportTables();
         $oCaseTracker = new \CaseTracker();
         $oCaseTrackerObject = new \CaseTrackerObject();
         //Update PROCESS_FILES_CHECKED
         $configuration = \ConfigurationPeer::retrieveByPK("PROCESS_FILES_CHECKED", "", "", "", "");
         if (!is_null($configuration)) {
             $arrayProjectUid = unserialize($configuration->getCfgValue());
             unset($arrayProjectUid[$sProcessUID]);
             $conf = new \Configuration();
             $result = $conf->update(array("CFG_UID" => "PROCESS_FILES_CHECKED", "OBJ_UID" => "", "CFG_VALUE" => serialize($arrayProjectUid), "PRO_UID" => "", "USR_UID" => "", "APP_UID" => ""));
         }
         //Delete the applications of process
         if ($flagRemoveCases) {
             $case = new \Cases();
             $criteria = new \Criteria("workflow");
             $criteria->addSelectColumn(\ApplicationPeer::APP_UID);
             $criteria->add(\ApplicationPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL);
             $rsCriteria = \ApplicationPeer::doSelectRS($criteria);
             $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
             while ($rsCriteria->next()) {
                 $row = $rsCriteria->getRow();
                 $result = $case->removeCase($row["APP_UID"]);
             }
         }
         //Delete the tasks of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\TaskPeer::PRO_UID, $sProcessUID);
         $oDataset = \TaskPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             //$this->deleteTask($aRow['TAS_UID']);
             $oTasks = new \Tasks();
             $oTasks->deleteTask($aRow['TAS_UID']);
             $oDataset->next();
         }
         //Delete the dynaforms of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\DynaformPeer::PRO_UID, $sProcessUID);
         $oDataset = \DynaformPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oDynaform->remove($aRow['DYN_UID']);
             $oDataset->next();
         }
         //Delete the input documents of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\InputDocumentPeer::PRO_UID, $sProcessUID);
         $oDataset = \InputDocumentPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oInputDocument->remove($aRow['INP_DOC_UID']);
             $oDataset->next();
         }
         //Delete the output documents of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\OutputDocumentPeer::PRO_UID, $sProcessUID);
         $oDataset = \OutputDocumentPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oOutputDocument->remove($aRow['OUT_DOC_UID']);
             $oDataset->next();
         }
         //Delete the triggers of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\TriggersPeer::PRO_UID, $sProcessUID);
         $oDataset = \TriggersPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oTrigger->remove($aRow['TRI_UID']);
             $oDataset->next();
         }
         //Delete the routes of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\RoutePeer::PRO_UID, $sProcessUID);
         $oDataset = \RoutePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oRoute->remove($aRow['ROU_UID']);
             $oDataset->next();
         }
         //Delete the gateways of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\GatewayPeer::PRO_UID, $sProcessUID);
         $oDataset = \GatewayPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oGateway->remove($aRow['GAT_UID']);
             $oDataset->next();
         }
         //Delete the Event of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\EventPeer::PRO_UID, $sProcessUID);
         $oDataset = \EventPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oEvent->remove($aRow['EVN_UID']);
             $oDataset->next();
         }
         //Delete the swimlanes elements of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\SwimlanesElementsPeer::PRO_UID, $sProcessUID);
         $oDataset = \SwimlanesElementsPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oSwimlaneElement->remove($aRow['SWI_UID']);
             $oDataset->next();
         }
         //Delete the configurations of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ConfigurationPeer::PRO_UID, $sProcessUID);
         $oDataset = \ConfigurationPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oConfiguration->remove($aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID']);
             $oDataset->next();
         }
         //Delete the DB sources of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\DbSourcePeer::PRO_UID, $sProcessUID);
         $oDataset = \DbSourcePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             /**
              * note added by gustavo cruz gustavo-at-colosa-dot-com 27-01-2010
              * in order to solve the bug 0004389, we use the validation function Exists
              * inside the remove function in order to verify if the DbSource record
              * exists in the Database, however there is a strange behavior within the
              * propel engine, when the first record is erased somehow the "_deleted"
              * attribute of the next row is set to true, so when propel tries to erase
              * it, obviously it can't and trows an error. With the "Exist" function
              * we ensure that if there is the record in the database, the _delete attribute must be false.
              *
              * note added by gustavo cruz gustavo-at-colosa-dot-com 28-01-2010
              * I have just identified the source of the issue, when is created a $oDbSource DbSource object
              * it's used whenever a record is erased or removed in the db, however the problem
              * it's that the same object is used every time, and the delete method invoked
              * sets the _deleted attribute to true when its called, of course as we use
              * the same object, the first time works fine but trowns an error with the
              * next record, cos it's the same object and the delete method checks if the _deleted
              * attribute it's true or false, the attrib _deleted is setted to true the
              * first time and later is never changed, the issue seems to be part of
              * every remove function in the model classes, not only DbSource
              * i recommend that a more general solution must be achieved to resolve
              * this issue in every model class, to prevent future problems.
              */
             $oDbSource->remove($aRow['DBS_UID'], $sProcessUID);
             $oDataset->next();
         }
         //Delete the supervisors
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID);
         \ProcessUserPeer::doDelete($oCriteria);
         //Delete the object permissions
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ObjectPermissionPeer::PRO_UID, $sProcessUID);
         \ObjectPermissionPeer::doDelete($oCriteria);
         //Delete the step supervisors
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\StepSupervisorPeer::PRO_UID, $sProcessUID);
         \StepSupervisorPeer::doDelete($oCriteria);
         //Delete the report tables
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ReportTablePeer::PRO_UID, $sProcessUID);
         $oDataset = \ReportTablePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oReportTable->deleteReportTable($aRow['REP_TAB_UID']);
             $oDataset->next();
         }
         //Delete case tracker configuration
         $oCaseTracker->remove($sProcessUID);
         //Delete case tracker objects
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
         \ProcessUserPeer::doDelete($oCriteria);
         //Delete SubProcess
         $criteria = new \Criteria("workflow");
         $criteria->add(\SubProcessPeer::PRO_PARENT, $sProcessUID, \Criteria::EQUAL);
         $result = \SubProcessPeer::doDelete($criteria);
         //Delete WebEntries
         $webEntry = new \ProcessMaker\BusinessModel\WebEntry();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\WebEntryPeer::WE_UID);
         $criteria->add(\WebEntryPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \WebEntryPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $webEntry->delete($row["WE_UID"]);
         }
         //Delete WebEntry-Events
         $webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\WebEntryEventPeer::WEE_UID);
         $criteria->add(\WebEntryEventPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $webEntryEvent->delete($row["WEE_UID"]);
         }
         //Delete MessageTypes
         $messageType = new \ProcessMaker\BusinessModel\MessageType();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\MessageTypePeer::MSGT_UID);
         $criteria->add(\MessageTypePeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \MessageTypePeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $messageType->delete($row["MSGT_UID"]);
         }
         //Delete Message-Event-Relation
         $messageEventRelation = new \ProcessMaker\BusinessModel\MessageEventRelation();
         $messageEventRelation->deleteWhere(array(\MessageEventRelationPeer::PRJ_UID => $sProcessUID));
         //Delete Message-Event-Task-Relation
         $elementTaskRelation = new \ProcessMaker\BusinessModel\ElementTaskRelation();
         $elementTaskRelation->deleteWhere(array(\ElementTaskRelationPeer::PRJ_UID => $sProcessUID));
         //Delete Message-Event-Definition
         $messageEventDefinition = new \ProcessMaker\BusinessModel\MessageEventDefinition();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_UID);
         $criteria->add(\MessageEventDefinitionPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \MessageEventDefinitionPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $messageEventDefinition->delete($row["MSGED_UID"]);
         }
         //Delete Script-Task
         $scriptTask = new \ProcessMaker\BusinessModel\ScriptTask();
         $scriptTask->deleteWhere(array(\ScriptTaskPeer::PRJ_UID => array($sProcessUID, \Criteria::EQUAL)));
         //Delete Timer-Event
         $timerEvent = new \ProcessMaker\BusinessModel\TimerEvent();
         $timerEvent->deleteWhere(array(\TimerEventPeer::PRJ_UID => array($sProcessUID, \Criteria::EQUAL)));
         //Delete Email-Event
         $emailEvent = new \ProcessMaker\BusinessModel\EmailEvent();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\EmailEventPeer::EMAIL_EVENT_UID);
         $criteria->add(\EmailEventPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \EmailEventPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $emailEvent->delete($sProcessUID, $row["EMAIL_EVENT_UID"], false);
         }
         //Delete files Manager
         $filesManager = new \ProcessMaker\BusinessModel\FilesManager();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\ProcessFilesPeer::PRF_UID);
         $criteria->add(\ProcessFilesPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \ProcessFilesPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $filesManager->deleteProcessFilesManager($sProcessUID, $row["PRF_UID"]);
         }
         //Delete the actions by email
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\AbeConfigurationPeer::PRO_UID, $sProcessUID);
         \AbeConfigurationPeer::doDelete($oCriteria);
         //Delete the process
         try {
             $oProcess->remove($sProcessUID);
         } catch (\Exception $oError) {
             throw $oError;
         }
         return true;
     } catch (\Exception $oError) {
         throw $oError;
     }
 }
示例#20
0
 $oTree->nodeType = 'blank';
 $oTree->name = 'Triggers';
 $oTree->showSign = false;
 $oCriteria = new Criteria('workflow');
 $oCriteria->add(StepPeer::PRO_UID, $_SESSION['PROCESS']);
 $oCriteria->add(StepPeer::TAS_UID, $_SESSION['TASK']);
 $oCriteria->addAscendingOrderByColumn(StepPeer::STEP_POSITION);
 $oDataset = StepPeer::doSelectRS($oCriteria);
 $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
 $oDataset->next();
 $i = 0;
 while ($aRow = $oDataset->getRow()) {
     switch ($aRow['STEP_TYPE_OBJ']) {
         case 'DYNAFORM':
             require_once 'classes/model/Dynaform.php';
             $oObject = new Dynaform();
             $aFields = $oObject->load($aRow['STEP_UID_OBJ']);
             $aRow['STEP_NAME'] = $aFields['DYN_TITLE'];
             break;
         case 'INPUT_DOCUMENT':
             require_once 'classes/model/InputDocument.php';
             $oObject = new InputDocument();
             $aFields = $oObject->load($aRow['STEP_UID_OBJ']);
             $aRow['STEP_NAME'] = $aFields['INP_DOC_TITLE'];
             break;
         case 'OUTPUT_DOCUMENT':
             require_once 'classes/model/OutputDocument.php';
             $oObject = new OutputDocument();
             $aFields = $oObject->load($aRow['STEP_UID_OBJ']);
             $aRow['STEP_NAME'] = $aFields['OUT_DOC_TITLE'];
             break;
 /**
  * getCaseTrackerObjectsCriteria
  *
  * @param string $sProcessUID
  * @return object(Criteria) $oCriteria
  */
 public function getExtCaseTrackerObjectsCriteria($start, $limit, $sProcessUID)
 {
     $aObjects = array();
     $aObjects[] = array('CTO_TITLE' => 'char', 'CTO_UID' => 'char', 'CTO_TYPE_OBJ' => 'char', 'CTO_UID_OBJ' => 'char', 'CTO_CONDITION' => 'char', 'CTO_POSITION' => 'integer');
     $oCriteria = new Criteria('workflow');
     $oCriteria->add(CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
     $oCriteria->addAscendingOrderByColumn(CaseTrackerObjectPeer::CTO_POSITION);
     $this->tmpCriteria = clone $oCriteria;
     if ($start != '') {
         $oCriteria->setOffset($start);
     }
     if ($limit != '') {
         $oCriteria->setLimit($limit);
     }
     $oDataset = CaseTrackerObjectPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         try {
             switch ($aRow['CTO_TYPE_OBJ']) {
                 case 'DYNAFORM':
                     $oDynaform = new Dynaform();
                     $aFields = $oDynaform->load($aRow['CTO_UID_OBJ']);
                     $sTitle = $aFields['DYN_TITLE'];
                     break;
                 case 'INPUT_DOCUMENT':
                     $oInputDocument = new InputDocument();
                     $aFields = $oInputDocument->load($aRow['CTO_UID_OBJ']);
                     $sTitle = $aFields['INP_DOC_TITLE'];
                     break;
                 case 'OUTPUT_DOCUMENT':
                     $oOutputDocument = new OutputDocument();
                     $aFields = $oOutputDocument->load($aRow['CTO_UID_OBJ']);
                     $sTitle = $aFields['OUT_DOC_TITLE'];
                     break;
             }
             $aObjects[] = array('CTO_TITLE' => $sTitle, 'CTO_UID' => $aRow['CTO_UID'], 'CTO_TYPE_OBJ' => $aRow['CTO_TYPE_OBJ'], 'CTO_UID_OBJ' => $aRow['CTO_UID_OBJ'], 'CTO_CONDITION' => $aRow['CTO_CONDITION'], 'CTO_POSITION' => $aRow['CTO_POSITION']);
         } catch (Exception $oError) {
             //Nothing
         }
         $oDataset->next();
     }
     // return $aObjects;
     global $_DBArray;
     $_DBArray = isset($_SESSION['_DBArray']) ? $_SESSION['_DBArray'] : '';
     $_DBArray['objects'] = $aObjects;
     $_SESSION['_DBArray'] = $_DBArray;
     G::LoadClass('ArrayPeer');
     $oCriteria = new Criteria('dbarray');
     $oCriteria->setDBArrayTable('objects');
     $oCriteria->addAscendingOrderByColumn('CTO_POSITION');
     return $aObjects;
 }
示例#22
0
 /**
  * Set value in WE_DATA
  *
  * @param string $webEntryUid Unique id of Web Entry
  *
  * return void
  */
 public function setWeData($webEntryUid)
 {
     try {
         //Verify data
         $this->throwExceptionIfNotExistsWebEntry($webEntryUid, $this->arrayFieldNameForException["webEntryUid"]);
         //Set variables
         $arrayWebEntryData = $this->getWebEntry($webEntryUid, true);
         $processUid = $arrayWebEntryData["PRO_UID"];
         $taskUid = $arrayWebEntryData["TAS_UID"];
         $dynaFormUid = $arrayWebEntryData["DYN_UID"];
         $webEntryMethod = $arrayWebEntryData["WE_METHOD"];
         $webEntryInputDocumentAccess = $arrayWebEntryData["WE_INPUT_DOCUMENT_ACCESS"];
         $webEntryData = "";
         $wsRoundRobin = 0;
         //0, 1 //0 - Cyclical Assignment
         $pathDataPublicProcess = PATH_DATA_PUBLIC . $processUid;
         //Delete previous files
         if (trim($arrayWebEntryData["WE_DATA"]) != "") {
             $fileName = str_replace(".php", "", trim($arrayWebEntryData["WE_DATA"]));
             $file = $pathDataPublicProcess . PATH_SEP . $fileName . ".php";
             if (is_file($file) && file_exists($file)) {
                 unlink($file);
                 unlink($pathDataPublicProcess . PATH_SEP . $fileName . "Post.php");
             }
         }
         //Create files
         \G::mk_dir($pathDataPublicProcess, 0777);
         $http = \G::is_https() ? "https://" : "http://";
         switch ($webEntryMethod) {
             case "WS":
                 require_once PATH_RBAC . "model" . PATH_SEP . "RbacUsers.php";
                 $user = new \RbacUsers();
                 $arrayUserData = $user->load($arrayWebEntryData["USR_UID"]);
                 $usrUsername = $arrayUserData["USR_USERNAME"];
                 $usrPassword = $arrayUserData["USR_PASSWORD"];
                 $dynaForm = new \Dynaform();
                 $arrayDynaFormData = $dynaForm->Load($arrayWebEntryData["DYN_UID"]);
                 //Creating sys.info;
                 $sitePublicPath = "";
                 if (file_exists($sitePublicPath . "")) {
                 }
                 //Creating the first file
                 $weTitle = $this->sanitizeFilename($arrayWebEntryData["WE_TITLE"]);
                 $fileName = $weTitle;
                 $fileContent = "<?php\n";
                 $fileContent .= "global \$_DBArray;\n";
                 $fileContent .= "if (!isset(\$_DBArray)) {\n";
                 $fileContent .= "  \$_DBArray = array();\n";
                 $fileContent .= "}\n";
                 $fileContent .= "\$_SESSION[\"PROCESS\"] = \"" . $processUid . "\";\n";
                 $fileContent .= "\$_SESSION[\"CURRENT_DYN_UID\"] = \"" . $dynaFormUid . "\";\n";
                 $fileContent .= "\$G_PUBLISH = new Publisher();\n";
                 $fileContent .= "G::LoadClass(\"pmDynaform\");\n";
                 $fileContent .= "\$a = new pmDynaform(array(\"CURRENT_DYNAFORM\" => \"" . $arrayWebEntryData["DYN_UID"] . "\"));\n";
                 $fileContent .= "if (\$a->isResponsive()) {";
                 $fileContent .= "  \$a->printWebEntry(\"" . $fileName . "Post.php\");";
                 $fileContent .= "} else {";
                 $fileContent .= "  \$G_PUBLISH->AddContent(\"dynaform\", \"xmlform\", \"" . $processUid . PATH_SEP . $dynaFormUid . "\", \"\", array(), \"" . $fileName . "Post.php\");\n";
                 $fileContent .= "  G::RenderPage(\"publish\", \"blank\");";
                 $fileContent .= "}";
                 file_put_contents($pathDataPublicProcess . PATH_SEP . $fileName . ".php", $fileContent);
                 //Creating the second file, the  post file who receive the post form.
                 $pluginTpl = PATH_TPL . "processes" . PATH_SEP . "webentryPost.tpl";
                 $template = new \TemplatePower($pluginTpl);
                 $template->prepare();
                 $template->assign("wsdlUrl", $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/wsdl2");
                 $template->assign("wsUploadUrl", $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/upload");
                 $template->assign("processUid", $processUid);
                 $template->assign("dynaformUid", $dynaFormUid);
                 $template->assign("taskUid", $taskUid);
                 $template->assign("wsUser", $usrUsername);
                 $template->assign("wsPass", \Bootstrap::getPasswordHashType() . ':' . $usrPassword);
                 $template->assign("wsRoundRobin", $wsRoundRobin);
                 if ($webEntryInputDocumentAccess == 0) {
                     //Restricted to process permissions
                     $template->assign("USR_VAR", "\$cInfo = ws_getCaseInfo(\$caseId);\n\t  \$USR_UID = \$cInfo->currentUsers->userId;");
                 } else {
                     //No Restriction
                     $template->assign("USR_VAR", "\$USR_UID = -1;");
                 }
                 $template->assign("dynaform", $arrayDynaFormData["DYN_TITLE"]);
                 $template->assign("timestamp", date("l jS \\of F Y h:i:s A"));
                 $template->assign("ws", SYS_SYS);
                 $template->assign("version", \System::getVersion());
                 $fileName = $pathDataPublicProcess . PATH_SEP . $weTitle . "Post.php";
                 file_put_contents($fileName, $template->getOutputContent());
                 //Creating the third file, only if this wsClient.php file doesn't exist.
                 $fileName = $pathDataPublicProcess . PATH_SEP . "wsClient.php";
                 $pluginTpl = PATH_CORE . "templates" . PATH_SEP . "processes" . PATH_SEP . "wsClient.php";
                 if (file_exists($fileName)) {
                     if (filesize($fileName) != filesize($pluginTpl)) {
                         copy($fileName, $pathDataPublicProcess . PATH_SEP . "wsClient.php.bak");
                         unlink($fileName);
                         $template = new \TemplatePower($pluginTpl);
                         $template->prepare();
                         file_put_contents($fileName, $template->getOutputContent());
                     }
                 } else {
                     $template = new \TemplatePower($pluginTpl);
                     $template->prepare();
                     file_put_contents($fileName, $template->getOutputContent());
                 }
                 //Event
                 $task = new \Task();
                 $arrayTaskData = $task->load($arrayWebEntryData["TAS_UID"]);
                 $weEventUid = $task->getStartingEvent();
                 if ($weEventUid != "") {
                     $event = new \Event();
                     $arrayEventData = array();
                     $arrayEventData["EVN_UID"] = $weEventUid;
                     $arrayEventData["EVN_RELATED_TO"] = "MULTIPLE";
                     $arrayEventData["EVN_ACTION"] = $dynaFormUid;
                     $arrayEventData["EVN_CONDITIONS"] = $usrUsername;
                     $result = $event->update($arrayEventData);
                 }
                 //WE_DATA
                 $webEntryData = $weTitle . ".php";
                 break;
             case "HTML":
                 global $G_FORM;
                 if (!class_exists("Smarty")) {
                     $loader = \Maveriks\Util\ClassLoader::getInstance();
                     $loader->addClass("Smarty", PATH_THIRDPARTY . "smarty" . PATH_SEP . "libs" . PATH_SEP . "Smarty.class.php");
                 }
                 $G_FORM = new \Form($processUid . "/" . $dynaFormUid, PATH_DYNAFORM, SYS_LANG, false);
                 $G_FORM->action = $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/cases_StartExternal.php";
                 $scriptCode = "";
                 $scriptCode = $G_FORM->render(PATH_TPL . "xmlform" . ".html", $scriptCode);
                 $scriptCode = str_replace("/controls/", $http . $_SERVER["HTTP_HOST"] . "/controls/", $scriptCode);
                 $scriptCode = str_replace("/js/maborak/core/images/", $http . $_SERVER["HTTP_HOST"] . "/js/maborak/core/images/", $scriptCode);
                 //Render the template
                 $pluginTpl = PATH_TPL . "processes" . PATH_SEP . "webentry.tpl";
                 $template = new \TemplatePower($pluginTpl);
                 $template->prepare();
                 $step = new \Step();
                 $sUidGrids = $step->lookingforUidGrids($processUid, $dynaFormUid);
                 $template->assign("URL_MABORAK_JS", \G::browserCacheFilesUrl("/js/maborak/core/maborak.js"));
                 $template->assign("URL_TRANSLATION_ENV_JS", \G::browserCacheFilesUrl("/jscore/labels/" . SYS_LANG . ".js"));
                 $template->assign("siteUrl", $http . $_SERVER["HTTP_HOST"]);
                 $template->assign("sysSys", SYS_SYS);
                 $template->assign("sysLang", SYS_LANG);
                 $template->assign("sysSkin", SYS_SKIN);
                 $template->assign("processUid", $processUid);
                 $template->assign("dynaformUid", $dynaFormUid);
                 $template->assign("taskUid", $taskUid);
                 $template->assign("dynFileName", $processUid . "/" . $dynaFormUid);
                 $template->assign("formId", $G_FORM->id);
                 $template->assign("scriptCode", $scriptCode);
                 if (sizeof($sUidGrids) > 0) {
                     foreach ($sUidGrids as $k => $v) {
                         $template->newBlock("grid_uids");
                         $template->assign("siteUrl", $http . $_SERVER["HTTP_HOST"]);
                         $template->assign("gridFileName", $processUid . "/" . $v);
                     }
                 }
                 //WE_DATA
                 $html = str_replace("</body>", "</form></body>", str_replace("</form>", "", $template->getOutputContent()));
                 $webEntryData = $html;
                 break;
         }
         //Update
         //Update where
         $criteriaWhere = new \Criteria("workflow");
         $criteriaWhere->add(\WebEntryPeer::WE_UID, $webEntryUid);
         //Update set
         $criteriaSet = new \Criteria("workflow");
         $criteriaSet->add(\WebEntryPeer::WE_DATA, $webEntryData);
         \BasePeer::doUpdate($criteriaWhere, $criteriaSet, \Propel::getConnection("workflow"));
     } catch (\Exception $e) {
         throw $e;
     }
 }
示例#23
0
    /**
     * Get Data Generate
     *
     * @access public
     * @param string $pro_uid, Process Uid
     * @param string $tas_uid, Task Uid
     * @param string $dyn_uid, Dynaform Uid
     * @return string
     *
     * @author Brayan Pereyra (Cochalo) <*****@*****.**>
     * @copyright Colosa - Bolivia
    */
    public function getDataGenerate($pro_uid, $tas_uid, $dyn_uid)
    {
        G::LoadClass ('case');
        G::LoadClass ('pmFunctions');
        G::LoadClass ("configuration");
        $hasTextArea = false;

        $conf = new \Configurations();
        $generalConfCasesList = $conf->getConfiguration("ENVIRONMENT_SETTINGS", "");
        if (isset($generalConfCasesList["casesListDateFormat"]) && !empty($generalConfCasesList["casesListDateFormat"])) {
            $dateFormat = $generalConfCasesList["casesListDateFormat"];
        } else {
            $dateFormat = "Y/m/d";
        }

        $oDyna = new \Dynaform();
        $dataTask = $oDyna->load($dyn_uid);
        if ($dataTask['DYN_VERSION'] > 0) {
            G::LoadClass("pmDynaform");
            $pmDyna = new \pmDynaform(array('APP_DATA' => array()));
            $pmDyna->fields["CURRENT_DYNAFORM"] = $dyn_uid;
            $json = G::json_decode($dataTask["DYN_CONTENT"]);
            $pmDyna->jsonr($json);
            $fieldsDyna = $json->items[0]->items;

            $xmlfrm = new \stdclass();
            $xmlfrm->fields = array();
            foreach ($fieldsDyna as $key => $value) {
                if ($value[0]->type == 'title' || $value[0]->type == 'submit') {
                    continue;
                }
                $temp = new \stdclass();
                $temp->type = $value[0]->type;
                $temp->label = $value[0]->label;
                $temp->name = $value[0]->name;
                $temp->required = (isset($value[0]->required)) ? $value[0]->required : 0;
                $temp->mode = (isset($value[0]->mode)) ? $value[0]->mode : 'edit';

                if (!empty($value[0]->options)) {
                    $temp->storeData = '[';
                    foreach ($value[0]->options as $valueOption) {
                        $temp->storeData .= '["' . $valueOption['value'] . '", "' . $valueOption['label'] . '"],';
                    }
                    $temp->storeData = substr($temp->storeData,0,-1);
                    $temp->storeData .= ']';
                }

                $temp->readOnly = ($temp->mode == 'view') ? "1" : "0";
                $temp->colWidth = 200;
                $xmlfrm->fields[] = $temp;
            }
        } else {
            $filename = $pro_uid . PATH_SEP . $dyn_uid . ".xml";
            if (!class_exists('Smarty')) {
                require_once(PATH_THIRDPARTY . 'smarty' . PATH_SEP . 'libs' . PATH_SEP . 'Smarty.class.php');  
            }
            $xmlfrm = new \XmlForm();
            $xmlfrm->home = PATH_DYNAFORM;
            $xmlfrm->parseFile($filename, SYS_LANG, true);    
        }

        $caseColumns      = array();
        $caseReaderFields = array();

        $dropList          = array();
        $comboBoxYesNoList = array();

        $caseColumns[] = array("header" => "APP_UID", "dataIndex" => "APP_UID", "width" => 100, "hidden" => true, "hideable" => false);
        $caseColumns[] = array("header" => "#", "dataIndex" => "APP_NUMBER", "width" => 40, "sortable" => true);
        $caseColumns[] = array("header" => G::LoadTranslation("ID_TITLE"), "dataIndex" => "APP_TITLE", "width" => 180, "renderer" => "renderTitle", "sortable" => true);
        $caseColumns[] = array("header" => G::LoadTranslation("ID_SUMMARY"), "width" => 60, "renderer" => "renderSummary", "align" => "center");
        $caseColumns[] = array("header" => "DEL_INDEX", "dataIndex" => "DEL_INDEX", "width" => 100, "hidden" => true, "hideable" => false);

        $caseReaderFields[] = array("name" => "APP_UID");
        $caseReaderFields[] = array("name" => "APP_NUMBER");
        $caseReaderFields[] = array("name" => "APP_TITLE");
        $caseReaderFields[] = array("name" => "DEL_INDEX");

        //$caseColumns[] = array("header" => "FLAG", "dataIndex" => "FLAG", "width" => 55, "xtype"=>"checkcolumn");
        //$caseReaderFields[] = array("name" => "FLAG", "type"=>"bool");

        foreach ($xmlfrm->fields as $index => $value) {
            $field = $value;

            $editor = null;
            $renderer = null;

            $readOnly = (isset($field->readOnly))? $field->readOnly : null;
            $required = (isset($field->required))? $field->required : null;
            $validate = (isset($field->validate))? strtolower($field->validate) : null;

            $fieldReadOnly = ($readOnly . "" == "1")? "readOnly: true," : null;
            $fieldRequired = ($required . "" == "1")? "allowBlank: false," : null;
            $fieldValidate = ($validate == "alpha" || $validate == "alphanum" || $validate == "email" || $validate == "int" || $validate == "real")? "vtype: \"$validate\"," : null;

            $fieldLabel = (($fieldRequired != null)? "<span style='color: red;'>&#42;</span> ": null) . $field->label;
            $fieldDisabled = ($field->mode != "edit")? "true" : "false";

            switch ($field->type) {
                case "dropdown":
                    $dropList[] = $field->name;
                    $align = "left";

                    if (empty($field->storeData)) {
                        $editor = "* new Ext.form.ComboBox({
                               id: \"cbo" . $field->name . "_" . $pro_uid . "\",

                               valueField:   'value',
                               displayField: 'text',

                               /*store: comboStore,*/
                               store: new Ext.data.JsonStore({
                                 storeId: \"store" . $field->name . "_" . $pro_uid . "\",
                                 proxy: new Ext.data.HttpProxy({
                                   url: 'proxyDataCombobox'
                                 }),
                                 root: 'records',
                                 fields: [{name: 'value'},
                                          {name: 'text'}
                                         ]
                               }),

                               triggerAction: 'all',
                               mode:     'local',
                               editable: false,
                               disabled: $fieldDisabled,
                               lazyRender: false,

                               $fieldReadOnly
                               $fieldRequired
                               $fieldValidate
                               cls: \"\"
                             }) *";
                    } else {
                        $editor = "* new Ext.form.ComboBox({
                                   id: \"cbo" . $field->name . "_" . $pro_uid . "\",

                                   typeAhead: true,
                                   autocomplete:true,
                                   editable:false,
                                   lazyRender:true,
                                   mode:'local',
                                   triggerAction:'all',
                                   forceSelection:true,

                                   valueField:   'value',
                                   displayField: 'text',
                                   store:new Ext.data.SimpleStore({
                                        fields: [{name: 'value'},
                                              {name: 'text'}],
                                        data: " . htmlspecialchars_decode($field->storeData) . ",
                                        sortInfo:{field:'text',direction:'ASC'}
                                    }),

                                   $fieldReadOnly
                                   $fieldRequired
                                   $fieldValidate
                                   cls: \"\"
                                 }) *";    
                    }

                    
                    $editor = eregi_replace("[\n|\r|\n\r]", ' ', $editor);
                    $width = $field->colWidth;
                    
                    $caseColumns[] = array("xtype" => "combocolumn", "gridId" => "gridId", "header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "frame" => "true", "clicksToEdit" => "1");
                    $caseReaderFields[] = array("name" => $field->name);
                    break;
                case "date":
                    //minValue: '01/01/06',
                    //disabledDays: [0, 6],
                    //disabledDaysText: 'Plants are not available on the weekends'

                    $align = "center";
                    $size = 100;

                    if (isset($field->size)) {
                        $size = $field->size * 10;
                    }

                    $width = $size;

                    $editor = "* new Ext.form.DateField({
                                     format: \"$dateFormat\",

                                     $fieldReadOnly
                                     $fieldRequired
                                     $fieldValidate
                                     cls: \"\"
                                 }) *";

                    //$renderer = "* formatDate *";
                    $renderer = "* function (value){
                                     return Ext.isDate(value)? value.dateFormat('{$dateFormat}') : value;
                                   } *";

                    if ($field->mode != "edit") {
                        $editor = null;
                    }

                    $caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "editor" => $editor, "renderer" => $renderer, "frame" => true, "clicksToEdit" => 1, "sortable" => true);
                    $caseReaderFields[] = array("name" => $field->name, "type" => "date");
                    break;
                case "currency":
                    //align: 'right',
                    //renderer: 'usMoney',
                    //allowBlank: false,
                    //allowNegative: false,
                    $align = 'right';
                    $size = 100;

                    if (isset($field->size)) {
                        $size = $field->size * 10;
                    }

                    $width = $size;

                    $editor = "* new Ext.form.NumberField({
                                   maxValue: 1000000,
                                   allowDecimals: true,
                                   allowNegative: true,

                                   $fieldReadOnly
                                   $fieldRequired
                                   $fieldValidate
                                   cls: \"\"
                                 }) *";

                    if ($field->mode != "edit") {
                        $editor = null;
                    }

                    $caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "frame" => true, "clicksToEdit" => 1, "sortable" => true);
                    $caseReaderFields[] = array("name" => $field->name);
                    break;
                case "percentage":
                    $align = 'right';
                    $size = 100;

                    if (isset($field->size)) {
                        $size = $field->size * 10;
                    }

                    $width = $size;

                    $editor = "* new Ext.form.NumberField({
                                   maxValue: 100,
                                   allowDecimals: true,

                                   $fieldReadOnly
                                   $fieldRequired
                                   $fieldValidate
                                   cls: \"\"
                                 }) *";

                    $renderer = "* function (value){
                                     return (value + ' %');
                                   } *";

                    if ($field->mode != "edit") {
                        $editor = null;
                    }

                    $caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "renderer" => $renderer, "frame" => true, "clicksToEdit" => 1, "sortable" => true);
                    $caseReaderFields[] = array("name" => $field->name);
                    break;
                case "textarea":
                    $align = 'left';
                    $size = 200;

                    if (isset($field->size)) {
                        $size = $field->size * 15;
                    }

                    $width = $size;

                    $editor   = "* new Ext.form.TextArea({
                                     growMin: 60,
                                     growMax: 1000,
                                     grow: true,
                                     autoHeight: true,
                                     disabled: $fieldDisabled,
                                     enterIsSpecial: false,
                                     preventScrollbars: false,

                                     $fieldReadOnly
                                     $fieldRequired
                                     $fieldValidate
                                     cls: \"\"
                                   }) *";

                    $renderer = "* function (value) {  return (value);  } *";

                    $caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "renderer" => $renderer, "frame" => true, "clicksToEdit" => 1, "sortable" => true);
                    $caseReaderFields[] = array("name" => $field->name);

                    $hasTextArea = true;
                    break;
                case "link":
                    $align = 'center';
                    $size = 100;

                    if (isset($field->size)) {
                        $size = $field->size * 10;
                    }

                    $width = $size;
                    $editor = null;

                    $renderer = "* function (value)
                                   {
                                       return linkRenderer(value);
                                   } *";

                    $caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "renderer" => $renderer, "frame" => true, "hidden" => false, "hideable" => false, "clicksToEdit" => 1, "sortable" => true);
                    $caseReaderFields[] = array("name" => $field->name);
                    break;
                case "hidden":
                    $align = 'left';
                    $size = 100;

                    if (isset($field->size)) {
                        $size = $field->size * 10;
                    }

                    $width = $size;

                    $editor = "* new Ext.form.TextField({ allowBlank: false }) *";

                    $caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)$width, "align" => $align, "editor" => $editor, "frame" => "true", "hidden" => "true", "hideable" => false, "clicksToEdit" => "1");
                    $caseReaderFields[] = array("name" => $field->name);
                    break;
                case "yesno":
                    $align = "right";
                    $size = 100;

                    if (isset($field->size)) {
                        $size = $field->size * 10;
                    }

                    $width = $size;
                    $dropList[] = $field->name;
                    $comboBoxYesNoList[] = $field->name;

                    $editor="* new Ext.form.ComboBox({
                                 id: \"cbo" . $field->name . "_" . $pro_uid . "\",

                                 valueField:   'value',
                                 displayField: 'text',

                                 store: new Ext.data.ArrayStore({
                                   storeId: \"store" . $field->name . "_" . $pro_uid . "\",
                                   fields: ['value', 'text'],
                                   data: [[1, 'YES'],
                                          [0, 'NO']
                                         ]
                                 }),

                                 typeAhead: true,

                                 triggerAction: 'all',
                                 mode: 'local',
                                 editable: false,
                                 disabled : $fieldDisabled,
                                 lazyRender: true,

                                 $fieldReadOnly
                                 $fieldRequired
                                 $fieldValidate
                                 cls: \"\"
                               }) *";

                    /*
                    $renderer = "* function(value) {
                                     idx = this.editor.store.find(this.editor.valueField, value);
                                     if (currentFieldEdited == '{$field->name}') {
                                       if (rec = this.editor.store.getAt(idx)) {
                                         rowLabels['{$field->name}'] = rec.get(this.editor.displayField);
                                                       return rec.get(this.editor.displayField);
                                       }
                                       else {
                                         return value;
                                       }
                                     }
                                     else {
                                       if (typeof(currentFieldEdited) == 'undefined') {
                                         return value;
                                       }
                                       else {
                                         return (rowLabels['{$field->name}']);
                                       }
                                     }
                                   } *";
                    */

                    //$caseColumns[] = array('header' => $fieldLabel, 'dataIndex' => $field->name, 'width' => (int)$width, 'align' => $align, 'editor' => $editor, 'renderer' => $renderer, 'frame' => 'true', 'clicksToEdit' => '1');
                    $caseColumns[] = array("xtype" => "combocolumn", "gridId" => "gridId", "header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "frame" => "true", "clicksToEdit" => "1");
                    $caseReaderFields[] = array("name" => $field->name);
                    break;
                case "text":
                default:
                    $align = "left";
                    $size = 100;

                    if (isset($field->size)) {
                        $size = $field->size * 10;
                    }

                    $width = $size;
                    $editor = "* new Ext.form.TextField({ $fieldReadOnly $fieldRequired $fieldValidate cls: \"\"}) *";

                    if ($field->mode != "edit" && $field->mode != "parent") {
                        $editor = null;
                    }

                    $caseColumns[] = array("header" => $fieldLabel, "dataIndex" => $field->name, "width" => (int)($width), "align" => $align, "editor" => $editor, "frame" => true, "clicksToEdit" => 1, "sortable" => true);
                    $caseReaderFields[] = array("name" => $field->name);
            }
        }

        @unlink(PATH_C . "ws" . PATH_SEP . SYS_SYS . PATH_SEP . "xmlform" . PATH_SEP . $pro_uid . PATH_SEP . $dyn_uid . "." . SYS_LANG);


        
        $array ['columnModel']          = $caseColumns;
        $array ['readerFields']         = $caseReaderFields;
        $array ["dropList"]             = $dropList;
        $array ["comboBoxYesNoList"]    = $comboBoxYesNoList;
        $array ['hasTextArea']          = $hasTextArea;
        
        $temp = G::json_encode($array);

        //$temp = str_replace("***","'",$temp);
        $temp = str_replace('"*','',  $temp);
        $temp = str_replace('*"','',  $temp);
        $temp = str_replace('\t','',  $temp);
        $temp = str_replace('\n','',  $temp);
        $temp = str_replace('\/','/', $temp);
        $temp = str_replace('\"','"', $temp);
        $temp = str_replace('"checkcolumn"','\'checkcolumn\'',$temp);

        print $temp;
        die();
    }
示例#24
0
 /**
  * Create a Dynaform based on a PMTable
  *
  * @param string $processUid Unique id of Process
  * @param array  $arrayData  Data
  *
  * return array Return data of the new DynaForm created
  */
 public function createBasedPmTable($processUid, $arrayData)
 {
     try {
         $arrayData = \G::array_change_key_case2($arrayData, CASE_UPPER);
         unset($arrayData["DYN_UID"]);
         unset($arrayData["COPY_IMPORT"]);
         //Verify data
         $process = new \ProcessMaker\BusinessModel\Process();
         $process->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);
         $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true);
         if ($arrayData["DYN_TYPE"] == "grid") {
             throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array($this->arrayFieldNameForException["dynaFormType"], "xmlform")));
         }
         if (!isset($arrayData["PMTABLE"])) {
             throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName("PMTABLE"))));
         }
         if (!isset($arrayData["PMTABLE"]["TAB_UID"])) {
             throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName("PMTABLE.TAB_UID"))));
         }
         $arrayData["PMTABLE"]["TAB_UID"] = trim($arrayData["PMTABLE"]["TAB_UID"]);
         if ($arrayData["PMTABLE"]["TAB_UID"] == "") {
             throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->getFieldNameByFormatFieldName("PMTABLE.TAB_UID"))));
         }
         if (!isset($arrayData["PMTABLE"]["FIELDS"])) {
             throw new \Exception(\G::LoadTranslation("ID_UNDEFINED_VALUE_IS_REQUIRED", array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS"))));
         }
         if (count($arrayData["PMTABLE"]["FIELDS"]) == 0) {
             throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS"))));
         }
         $this->throwExceptionIfExistsTitle($processUid, $arrayData["DYN_TITLE"], $this->arrayFieldNameForException["dynaFormTitle"]);
         $process->throwExceptionIfNotExistsPmTable($arrayData["PMTABLE"]["TAB_UID"], $this->getFieldNameByFormatFieldName("PMTABLE.TAB_UID"));
         //Validate PMTABLE.FIELDS
         //Valid Keys
         $flagValidFieldKey = 1;
         foreach ($arrayData["PMTABLE"]["FIELDS"] as $key => $value) {
             if (!isset($value["FLD_NAME"]) || !isset($value["PRO_VARIABLE"])) {
                 $flagValidFieldKey = 0;
                 break;
             }
         }
         if ($flagValidFieldKey == 0) {
             throw new \Exception(\G::LoadTranslation("ID_ATTRIBUTE_HAS_INVALID_ELEMENT_KEY", array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS"))));
         }
         //Is Primary Key
         $arrayFieldPk = $process->getPmTablePrimaryKeyFields($arrayData["PMTABLE"]["TAB_UID"], $this->getFieldNameByFormatFieldName("PMTABLE.TAB_UID"));
         $flagValidFieldPk = 1;
         $invalidFieldPk = "";
         $arrayFieldPkAux = array();
         foreach ($arrayData["PMTABLE"]["FIELDS"] as $key => $value) {
             $arrayFieldPkAux[] = $value["FLD_NAME"];
             if (!in_array($value["FLD_NAME"], $arrayFieldPk)) {
                 $flagValidFieldPk = 0;
                 $invalidFieldPk = $value["FLD_NAME"];
                 break;
             }
         }
         if ($flagValidFieldPk == 0) {
             throw new \Exception(\G::LoadTranslation("ID_PMTABLE_FIELD_IS_NOT_PRIMARY_KEY", array($this->getFieldNameByFormatFieldName("PMTABLE.FIELDS.FLD_NAME"), $invalidFieldPk)));
         }
         //All Primary Keys
         $flagAllFieldPk = 1;
         $missingFieldPk = "";
         foreach ($arrayFieldPk as $key => $value) {
             if (!in_array($value, $arrayFieldPkAux)) {
                 $flagAllFieldPk = 0;
                 $missingFieldPk = $value;
                 break;
             }
         }
         if ($flagAllFieldPk == 0) {
             throw new \Exception(\G::LoadTranslation("ID_PMTABLE_PRIMARY_KEY_FIELD_IS_MISSING_IN_ATTRIBUTE", array($missingFieldPk, $this->getFieldNameByFormatFieldName("PMTABLE.FIELDS"))));
         }
         //Total of Primary Keys
         $n1 = count($arrayFieldPk);
         $n2 = count($arrayFieldPkAux);
         if ($n1 != $n2) {
             throw new \Exception(\G::LoadTranslation("ID_PMTABLE_TOTAL_PRIMARY_KEY_FIELDS_IS_NOT_EQUAL_IN_ATTRIBUTE", array($n1, $this->getFieldNameByFormatFieldName("PMTABLE.FIELDS"), $n2)));
         }
         //Set data
         $tableUid = $arrayData["PMTABLE"]["TAB_UID"];
         $arrayFields = $arrayData["PMTABLE"]["FIELDS"];
         unset($arrayData["PMTABLE"]);
         //Create
         $dynaForm = new \Dynaform();
         $arrayData["PRO_UID"] = $processUid;
         $arrayData["DYN_TYPE"] = "xmlform";
         $arrayData["FIELDS"] = $arrayFields;
         $dynaForm->createFromPMTable($arrayData, $tableUid);
         $dynaFormUid = $dynaForm->getDynUid();
         //Return
         unset($arrayData["PRO_UID"]);
         unset($arrayData["FIELDS"]);
         $arrayData = array_merge(array("DYN_UID" => $dynaFormUid), $arrayData);
         if (!$this->formatFieldNameInUppercase) {
             $arrayData = array_change_key_case($arrayData, CASE_LOWER);
         }
         return $arrayData;
     } catch (\Exception $e) {
         throw $e;
     }
 }
示例#25
0
$G_MAIN_MENU = 'caseTracker';
$G_ID_MENU_SELECTED = 'DYNADOC';
global $G_PUBLISH;
switch ($_GET['CTO_TYPE_OBJ']) {
    case 'DYNAFORM':
        G::LoadClass('case');
        $oCase = new Cases();
        $Fields = $oCase->loadCase($_SESSION['APPLICATION']);
        $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = '';
        $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = '';
        $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = '#';
        $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = 'alert("Sample"); return false;';
        $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PRINT_PREVIEW'] = '#';
        $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PRINT_PREVIEW_ACTION'] = 'tracker_PrintView?CTO_UID_OBJ=' . $_GET['CTO_UID_OBJ'] . '&CTO_TYPE_OBJ=PRINT_PREVIEW';
        $_SESSION['CTO_UID_OBJ'] = $_GET['CTO_UID_OBJ'];
        $dynaForm = new Dynaform();
        $arrayDynaFormData = $dynaForm->Load($_GET["CTO_UID_OBJ"]);
        if (isset($arrayDynaFormData["DYN_VERSION"]) && $arrayDynaFormData["DYN_VERSION"] == 2) {
            G::LoadClass("pmDynaform");
            $Fields["PRO_UID"] = $_SESSION["PROCESS"];
            $Fields["CURRENT_DYNAFORM"] = $_GET["CTO_UID_OBJ"];
            $pmDynaForm = new pmDynaform($Fields);
            if ($pmDynaForm->isResponsive()) {
                $pmDynaForm->printTracker();
            }
        } else {
            $G_PUBLISH = new Publisher();
            $G_PUBLISH->AddContent("dynaform", "xmlform", $_SESSION["PROCESS"] . "/" . $_GET["CTO_UID_OBJ"], "", $Fields["APP_DATA"], "", "", "view");
            G::RenderPage("publish");
        }
        break;
示例#26
0
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 */
try {
    require_once 'classes/model/Dynaform.php';
    require_once 'classes/model/Process.php';
    $currentDynUid = '';
    if (isset($_GET['DYNUIDPRINT']) && $_GET['DYNUIDPRINT'] != '') {
        $currentDynUid = $_GET['DYNUIDPRINT'];
    } elseif (isset($_SESSION['DYN_UID_PRINT'])) {
        $currentDynUid = $_SESSION['DYN_UID_PRINT'];
    } elseif (isset($_SESSION['CURRENT_DYN_UID'])) {
        $currentDynUid = $_SESSION['CURRENT_DYN_UID'];
    } elseif (isset($_SESSION['CONDITION_DYN_UID'])) {
        $currentDynUid = $_SESSION['CONDITION_DYN_UID'];
    }
    $oDynaform = new Dynaform();
    $aDyn = $oDynaform->load($currentDynUid);
    G::LoadClass('case');
    $oCase = new Cases();
    if (isset($_SESSION['APPLICATION'])) {
        $Fields = $oCase->loadCase($_SESSION['APPLICATION']);
        $Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants());
    } else {
        $Fields['APP_DATA'] = array();
    }
    $G_MAIN_MENU = 'processmaker';
    $G_ID_MENU_SELECTED = 'USERS';
    $G_PUBLISH = new Publisher();
    $idProcess = isset($Fields['APP_DATA']['PROCESS']) ? $Fields['APP_DATA']['PROCESS'] : $_SESSION['PROCESS'];
    $oProcess = new Process();
    $aProcessFieds = $oProcess->load($idProcess);
示例#27
0
    /**

     * this function remove all Process except the PROCESS ROW

     *

     * @param string $sProUid

     * @return boolean

     */

    public function removeProcessRows ($sProUid)

    {

        try {

            //Instance all classes necesaries

            $oProcess = new Process();

            $oDynaform = new Dynaform();

            $oInputDocument = new InputDocument();

            $oOutputDocument = new OutputDocument();

            $oTrigger = new Triggers();

            $oStepTrigger = new StepTrigger();

            $oRoute = new Route();

            $oStep = new Step();

            $oSubProcess = new SubProcess();

            $oCaseTracker = new CaseTracker();

            $oCaseTrackerObject = new CaseTrackerObject();

            $oObjectPermission = new ObjectPermission();

            $oSwimlaneElement = new SwimlanesElements();

            $oConnection = new DbSource();

            $oStage = new Stage();

            $oEvent = new Event();

            $oCaseScheduler = new CaseScheduler();

            $oConfig = new Configuration();



            //Delete the tasks of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( TaskPeer::PRO_UID, $sProUid );

            $oDataset = TaskPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            $oTask = new Task();

            while ($aRow = $oDataset->getRow()) {

                $oCriteria = new Criteria( 'workflow' );

                $oCriteria->add( StepTriggerPeer::TAS_UID, $aRow['TAS_UID'] );

                StepTriggerPeer::doDelete( $oCriteria );

                if ($oTask->taskExists( $aRow['TAS_UID'] )) {

                    $oTask->remove( $aRow['TAS_UID'] );

                }

                $oDataset->next();

            }



            //Delete the dynaforms of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( DynaformPeer::PRO_UID, $sProUid );

            $oDataset = DynaformPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                $sWildcard = PATH_DYNAFORM . $aRow['PRO_UID'] . PATH_SEP . $aRow['DYN_UID'] . '_tmp*';

                foreach (glob( $sWildcard ) as $fn) {

                    @unlink( $fn );

                }

                $sWildcard = PATH_DYNAFORM . $aRow['PRO_UID'] . PATH_SEP . $aRow['DYN_UID'] . '.*';

                foreach (glob( $sWildcard ) as $fn) {

                    @unlink( $fn );

                }

                if ($oDynaform->dynaformExists( $aRow['DYN_UID'] )) {

                    $oDynaform->remove( $aRow['DYN_UID'] );

                }

                $oDataset->next();

            }



            //Delete the input documents of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( InputDocumentPeer::PRO_UID, $sProUid );

            $oDataset = InputDocumentPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oInputDocument->InputExists( $aRow['INP_DOC_UID'] )) {

                    $oInputDocument->remove( $aRow['INP_DOC_UID'] );

                }

                $oDataset->next();

            }



            //Delete the output documents of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( OutputDocumentPeer::PRO_UID, $sProUid );

            $oDataset = OutputDocumentPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oOutputDocument->OutputExists( $aRow['OUT_DOC_UID'] )) {

                    $oOutputDocument->remove( $aRow['OUT_DOC_UID'] );

                }

                $oDataset->next();

            }



            //Delete the steps

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( StepPeer::PRO_UID, $sProUid );

            $oDataset = StepPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                //Delete the steptrigger of process

                /*$oCriteria = new Criteria('workflow');

                  $oCriteria->add(StepTriggerPeer::STEP_UID, $aRow['STEP_UID']);

                  $oDataseti = StepTriggerPeer::doSelectRS($oCriteria);

                  $oDataseti->setFetchmode(ResultSet::FETCHMODE_ASSOC);

                  $oDataseti->next();

                  while ($aRowi = $oDataseti->getRow()) {

                  if ($oStepTrigger->stepTriggerExists($aRowi['STEP_UID'], $aRowi['TAS_UID'], $aRowi['TRI_UID'], $aRowi['ST_TYPE']))

                  $oStepTrigger->remove($aRowi['STEP_UID'], $aRowi['TAS_UID'], $aRowi['TRI_UID'], $aRowi['ST_TYPE']);

                  $oDataseti->next();

                  }*/

                $oStep->remove( $aRow['STEP_UID'] );

                $oDataset->next();

            }



            //Delete the StepSupervisor

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( StepSupervisorPeer::PRO_UID, $sProUid );

            $oDataset = StepSupervisorPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oStep->StepExists( $aRow['STEP_UID'] )) {

                    $oStep->remove( $aRow['STEP_UID'] );

                }

                $oDataset->next();

            }



            //Delete the triggers of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( TriggersPeer::PRO_UID, $sProUid );

            $oDataset = TriggersPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oTrigger->TriggerExists( $aRow['TRI_UID'] )) {

                    $oTrigger->remove( $aRow['TRI_UID'] );

                }

                $oDataset->next();

            }

            //Delete the routes of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( RoutePeer::PRO_UID, $sProUid );

            $oDataset = RoutePeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oRoute->routeExists( $aRow['ROU_UID'] )) {

                    $oRoute->remove( $aRow['ROU_UID'] );

                }

                $oDataset->next();

            }

            //Delete the swimlanes elements of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( SwimlanesElementsPeer::PRO_UID, $sProUid );

            $oDataset = SwimlanesElementsPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oSwimlaneElement->swimlanesElementsExists( $aRow['SWI_UID'] )) {

                    $oSwimlaneElement->remove( $aRow['SWI_UID'] );

                }

                $oDataset->next();

            }



            //Delete the DB connections of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( DbSourcePeer::PRO_UID, $sProUid );

            $oDataset = DbSourcePeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oConnection->Exists( $aRow['DBS_UID'], $aRow['PRO_UID'] )) {

                    $oConnection->remove( $aRow['DBS_UID'], $aRow['PRO_UID'] );

                }

                $oDataset->next();

            }



            //Delete the sub process of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( SubProcessPeer::PRO_PARENT, $sProUid );

            $oDataset = SubProcessPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oSubProcess->subProcessExists( $aRow['SP_UID'] )) {

                    $oSubProcess->remove( $aRow['SP_UID'] );

                }

                $oDataset->next();

            }



            //Delete the caseTracker of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( CaseTrackerPeer::PRO_UID, $sProUid );

            $oDataset = CaseTrackerPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oCaseTracker->caseTrackerExists( $aRow['PRO_UID'] )) {

                    $oCaseTracker->remove( $aRow['PRO_UID'] );

                }

                $oDataset->next();

            }



            //Delete the caseTrackerObject of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( CaseTrackerObjectPeer::PRO_UID, $sProUid );

            $oDataset = CaseTrackerObjectPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oCaseTrackerObject->caseTrackerObjectExists( $aRow['CTO_UID'] )) {

                    $oCaseTrackerObject->remove( $aRow['CTO_UID'] );

                }

                $oDataset->next();

            }



            //Delete the ObjectPermission of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( ObjectPermissionPeer::PRO_UID, $sProUid );

            $oDataset = ObjectPermissionPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oObjectPermission->Exists( $aRow['OP_UID'] )) {

                    $oObjectPermission->remove( $aRow['OP_UID'] );

                }

                $oDataset->next();

            }



            //Delete the Stage of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( StagePeer::PRO_UID, $sProUid );

            $oDataset = StagePeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oStage->Exists( $aRow['STG_UID'] )) {

                    $oStage->remove( $aRow['STG_UID'] );

                }

                $oDataset->next();

            }



            //Delete the Event of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( EventPeer::PRO_UID, $sProUid );

            $oDataset = EventPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oEvent->Exists( $aRow['EVN_UID'] )) {

                    $oEvent->remove( $aRow['EVN_UID'] );

                }

                $oDataset->next();

                if ($oEvent->existsByTaskUidFrom( $aRow['TAS_UID'] )) {

                    $aRowEvent = $oEvent->getRowByTaskUidFrom( $aRow['TAS_UID'] );

                    $oEvent->remove( $aRowEvent['EVN_UID'] );

                }

                $oDataset->next();

            }



            //Delete the CaseScheduler of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( CaseSchedulerPeer::PRO_UID, $sProUid );

            $oDataset = CaseSchedulerPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oCaseScheduler->Exists( $aRow['SCH_UID'] )) {

                    $oCaseScheduler->remove( $aRow['SCH_UID'] );

                }

                $oDataset->next();

            }



            //Delete the TaskExtraProperties of the process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->addSelectColumn( ConfigurationPeer::CFG_UID );

            $oCriteria->addSelectColumn( ConfigurationPeer::OBJ_UID );

            $oCriteria->addSelectColumn( ConfigurationPeer::CFG_VALUE );

            $oCriteria->addSelectColumn( TaskPeer::PRO_UID );

            $oCriteria->addSelectColumn( ConfigurationPeer::USR_UID );

            $oCriteria->addSelectColumn( ConfigurationPeer::APP_UID );

            $oCriteria->add( TaskPeer::PRO_UID, $sProUid );

            $oCriteria->add( ConfigurationPeer::CFG_UID, 'TAS_EXTRA_PROPERTIES' );

            $oCriteria->addJoin( ConfigurationPeer::OBJ_UID, TaskPeer::TAS_UID );

            $oDataset = ConfigurationPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oConfig->exists($aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID'])) {

                    $oConfig->remove( $aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID'] );

                }

                $oDataset->next();

            }



            return true;

        } catch (Exception $oError) {

            throw ($oError);

        }

    }
示例#28
0
 function save($params)
 {
     require_once 'classes/model/Event.php';
     global $G_FORM;
     $sPRO_UID = $params->pro_uid;
     $sEVN_UID = $params->evn_uid;
     $sDYNAFORM = $params->initDyna;
     $sWS_USER = trim($params->username);
     $sWS_PASS = trim($params->password);
     $sWS_ROUNDROBIN = '';
     $sWE_USR = '';
     $xDYNA = $params->dynaform;
     if ($xDYNA != '') {
         $pro_uid = $params->pro_uid;
         $filename = $xDYNA;
         $filename = $filename . '.php';
         unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . $filename);
         unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . str_replace(".php", "Post", $filename) . ".php");
     }
     //return $params;
     G::LoadClass("system");
     $pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP;
     G::mk_dir($pathProcess, 0777);
     $oEvent = new Event();
     $oEvent->load($sEVN_UID);
     $sTASKS = $oEvent->getEvnTasUidTo();
     $oTask = new Task();
     $oTask->load($sTASKS);
     $tas_title = $oTask->getTasTitle();
     if (G::is_https()) {
         $http = 'https://';
     } else {
         $http = 'http://';
     }
     $sContent = '';
     $SITE_PUBLIC_PATH = '';
     if (file_exists($SITE_PUBLIC_PATH . '')) {
     }
     require_once 'classes/model/Dynaform.php';
     $oDynaform = new Dynaform();
     $aDynaform = $oDynaform->load($sDYNAFORM);
     $dynTitle = str_replace(' ', '_', str_replace('/', '_', $aDynaform['DYN_TITLE']));
     $sContent = "<?php\n";
     $sContent .= "global \$_DBArray;\n";
     $sContent .= "if (!isset(\$_DBArray)) {\n";
     $sContent .= "  \$_DBArray = array();\n";
     $sContent .= "}\n";
     $sContent .= "\$_SESSION['PROCESS'] = '" . $sPRO_UID . "';\n";
     $sContent .= "\$_SESSION['CURRENT_DYN_UID'] = '" . $sDYNAFORM . "';\n";
     $sContent .= "\$G_PUBLISH = new Publisher;\n";
     $sContent .= "\$G_PUBLISH->AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n";
     $sContent .= "G::RenderPage('publish', 'blank');";
     file_put_contents($pathProcess . $dynTitle . '.php', $sContent);
     //creating the second file, the  post file who receive the post form.
     $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl';
     $template = new TemplatePower($pluginTpl);
     $template->prepare();
     $template->assign('wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2');
     $template->assign('wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload');
     $template->assign('processUid', $sPRO_UID);
     $template->assign('dynaformUid', $sDYNAFORM);
     $template->assign('taskUid', $sTASKS);
     $template->assign('wsUser', $sWS_USER);
     $template->assign('wsPass', 'md5:' . md5($sWS_PASS));
     $template->assign('wsRoundRobin', $sWS_ROUNDROBIN);
     if ($sWE_USR == "2") {
         $template->assign('USR_VAR', "\$cInfo = ws_getCaseInfo(\$caseId);\n\t  \$USR_UID = \$cInfo->currentUsers->userId;");
     } else {
         $template->assign('USR_VAR', '$USR_UID = -1;');
     }
     $template->assign('dynaform', $dynTitle);
     $template->assign('timestamp', date('l jS \\of F Y h:i:s A'));
     $template->assign('ws', SYS_SYS);
     $template->assign('version', System::getVersion());
     $fileName = $pathProcess . $dynTitle . 'Post.php';
     file_put_contents($fileName, $template->getOutputContent());
     //creating the third file, only if this wsClient.php file doesn't exists.
     $fileName = $pathProcess . 'wsClient.php';
     $pluginTpl = PATH_CORE . 'test' . PATH_SEP . 'unit' . PATH_SEP . 'ws' . PATH_SEP . 'wsClient.php';
     if (file_exists($fileName)) {
         if (filesize($fileName) != filesize($pluginTpl)) {
             @copy($fileName, $pathProcess . 'wsClient.php.bck');
             @unlink($fileName);
             $template = new TemplatePower($pluginTpl);
             $template->prepare();
             file_put_contents($fileName, $template->getOutputContent());
         }
     } else {
         $template = new TemplatePower($pluginTpl);
         $template->prepare();
         file_put_contents($fileName, $template->getOutputContent());
     }
     require_once 'classes/model/Event.php';
     $oEvent = new Event();
     $aDataEvent = array();
     $aDataEvent['EVN_UID'] = $sEVN_UID;
     $aDataEvent['EVN_RELATED_TO'] = 'MULTIPLE';
     $aDataEvent['EVN_ACTION'] = $sDYNAFORM;
     $aDataEvent['EVN_CONDITIONS'] = $sWS_USER;
     $output = $oEvent->update($aDataEvent);
     $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php';
     $this->success = true;
     $this->msg = G::LoadTranslation('ID_WEB_ENTRY_SUCCESS_NEW');
     $this->W_LINK = $link;
     $this->TAS_TITLE = $tas_title;
     $this->DYN_TITLE = $dynTitle;
     $this->USR_UID = $sWS_USER;
 }
示例#29
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 */
/*
 * Created on 07/01/2008
 *
 * @author David Callizaya <*****@*****.**>
 */
if (isset($_POST['dynaformName'])) {
    $dynaForm = new Dynaform();
    $res = $dynaForm->verifyExistingName($_POST['dynaformName'], $_POST['proUid'], $_POST['dynaformUid']);
    print $res ? 1 : 0;
}
global $_DBArray;
if (!isset($_DBArray)) {
    $_DBArray = array();
}
G::LoadClass('dynaformEditor');
$oDynaformEditorAjax = new dynaformEditorAjax($_POST);
//if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
//
//  //G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = '******' );
//
//	G::LoadInclude('ajax');
//  G::LoadClass('toolBar');
示例#30
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 *
 */
try {
    require_once 'classes/model/Dynaform.php';
    require_once 'classes/model/Process.php';
    $oDynaform = new Dynaform();
    $aDyn = $oDynaform->load($_SESSION['CURRENT_DYN_UID']);
    G::LoadClass('case');
    $oCase = new Cases();
    if (isset($_SESSION['APPLICATION'])) {
        $Fields = $oCase->loadCase($_SESSION['APPLICATION']);
        $Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants());
    } else {
        $Fields['APP_DATA'] = array();
    }
    $G_MAIN_MENU = 'processmaker';
    $G_ID_MENU_SELECTED = 'USERS';
    $G_PUBLISH = new Publisher();
    $idProcess = isset($Fields['APP_DATA']['PROCESS']) ? $Fields['APP_DATA']['PROCESS'] : $_SESSION['PROCESS'];
    $oProcess = new Process();
    $aProcessFieds = $oProcess->load($idProcess);