public function getStepsCriteria($sTaskUID = '')
 {
     try {
         //call plugin
         $oPluginRegistry =& PMPluginRegistry::getSingleton();
         $externalSteps = $oPluginRegistry->getSteps();
         $aSteps = array();
         $aSteps[] = array('STEP_TITLE' => 'char', 'STEP_UID' => 'char', 'STEP_TYPE_OBJ' => 'char', 'STEP_MODE' => 'char', 'STEP_CONDITION' => 'char', 'STEP_POSITION' => 'integer');
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(StepPeer::TAS_UID, $sTaskUID);
         $oCriteria->addAscendingOrderByColumn(StepPeer::STEP_POSITION);
         $oDataset = StepPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $urlEdit = '';
             $linkEditValue = '';
             switch ($aRow['STEP_TYPE_OBJ']) {
                 case 'DYNAFORM':
                     $oDynaform = new Dynaform();
                     $aFields = $oDynaform->load($aRow['STEP_UID_OBJ']);
                     $sTitle = $aFields['DYN_TITLE'];
                     /**
                      * @@@init2 PROCCESS FOR DIRECT EDIT LINK @by erik@colosa.com ON DATE 02/06/2008 18:48:13
                      */
                     $DYN_UID = $aFields['DYN_UID'];
                     $urlEdit = "dynaformEdit('" . $DYN_UID . "', '" . $aRow['PRO_UID'] . "');";
                     $linkEditValue = 'Edit';
                     /**
                      * @@@end2
                      */
                     break;
                 case 'INPUT_DOCUMENT':
                     $oInputDocument = new InputDocument();
                     $aFields = $oInputDocument->getByUid($aRow['STEP_UID_OBJ']);
                     if ($aFields === false) {
                         continue;
                     }
                     $sTitle = $aFields['INP_DOC_TITLE'];
                     break;
                 case 'OUTPUT_DOCUMENT':
                     $oOutputDocument = new OutputDocument();
                     $aFields = $oOutputDocument->getByUid($aRow['STEP_UID_OBJ']);
                     if ($aFields === false) {
                         continue;
                     }
                     $sTitle = $aFields['OUT_DOC_TITLE'];
                     break;
                 case 'EXTERNAL':
                     $sTitle = 'unknown ' . $aRow['STEP_UID'];
                     foreach ($externalSteps as $key => $val) {
                         if ($val->sStepId == $aRow['STEP_UID_OBJ']) {
                             $sTitle = $val->sStepTitle;
                             if (trim($val->sSetupStepPage) != '') {
                                 $urlEdit = "externalStepEdit('" . $aRow['STEP_UID'] . "', '" . $val->sSetupStepPage . "');";
                                 $linkEditValue = 'Edit';
                             } else {
                                 $urlEdit = "";
                                 $linkEditValue = '';
                             }
                         }
                     }
                     break;
             }
             $aSteps[] = array('STEP_TITLE' => $sTitle, 'STEP_UID' => $aRow['STEP_UID'], 'STEP_TYPE_OBJ' => $aRow['STEP_TYPE_OBJ'], 'STEP_MODE' => $aRow['STEP_MODE'], 'STEP_CONDITION' => $aRow['STEP_CONDITION'], 'STEP_POSITION' => $aRow['STEP_POSITION'], 'urlEdit' => $urlEdit, 'linkEditValue' => $linkEditValue, 'PRO_UID' => $aRow['PRO_UID']);
             $oDataset->next();
         }
         global $_DBArray;
         $_DBArray = isset($_SESSION['_DBArray']) ? $_SESSION['_DBArray'] : '';
         $_DBArray['steps'] = $aSteps;
         $_SESSION['_DBArray'] = $_DBArray;
         G::LoadClass('ArrayPeer');
         $oCriteria = new Criteria('dbarray');
         $oCriteria->setDBArrayTable('steps');
         $oCriteria->addAscendingOrderByColumn('STEP_POSITION');
         return $oCriteria;
     } catch (Exception $oError) {
         throw $oError;
     }
 }
Beispiel #2
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;
     }
 }
Beispiel #3
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;
        }
    }
 /**
  * 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;
     }
 }