Esempio n. 1
0
 public static function getAll($prjUid = null, $start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
 {
     $c = new Criteria('workflow');
     $c->addSelectColumn("BPMN_PROCESS.*");
     if (!is_null($prjUid)) {
         $c->add(BpmnProcessPeer::PRJ_UID, $prjUid, Criteria::EQUAL);
     }
     $rs = BpmnProcessPeer::doSelectRS($c);
     $rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
     $processes = array();
     while ($rs->next()) {
         $processes[] = $changeCaseTo !== CASE_UPPER ? array_change_key_case($rs->getRow(), CASE_LOWER) : $rs->getRow();
     }
     return $processes;
 }
Esempio n. 2
0
 private function setBoundDefaults()
 {
     $this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
     $this->bound->setPrjUid($this->getPrjUid());
     $this->bound->setElementUid($this->getLanUid());
     $project = BpmnProjectPeer::retrieveByPK($this->getPrjUid());
     if (is_object($project)) {
         $criteria = new Criteria('workflow');
         $criteria->addSelectColumn(BpmnProcessPeer::DIA_UID);
         $criteria->add(BpmnProcessPeer::PRJ_UID, $this->getPrjUid(), \Criteria::EQUAL);
         $rsCriteria = BpmnProcessPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $rsCriteria->next();
         $row = $rsCriteria->getRow();
         $this->bound->setDiaUid($row["DIA_UID"]);
         $this->bound->setBouContainer('bpmnPool');
         $this->bound->setBouElement($this->getLnsUid());
     }
 }
Esempio n. 3
0
 /**
  * Check is the Process is BPMN.
  *
  * @param string $ProUid the uid of the Prolication
  * @return int 1 if is BPMN process or 0 if a Normal process
  */
 public function isBpmnProcess($proUid)
 {
     $c = new Criteria("workflow");
     $c->add(BpmnProcessPeer::PRJ_UID, $proUid);
     $res = BpmnProcessPeer::doSelect($c);
     if (sizeof($res) == 0) {
         return 0;
     } else {
         return 1;
     }
 }
Esempio n. 4
0
 /**
  * Returns the number of related BpmnProcesss.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      Connection $con
  * @throws     PropelException
  */
 public function countBpmnProcesss($criteria = null, $distinct = false, $con = null)
 {
     // include the Peer class
     include_once 'classes/model/om/BaseBpmnProcessPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     $criteria->add(BpmnProcessPeer::PRJ_UID, $this->getPrjUid());
     return BpmnProcessPeer::doCount($criteria, $distinct, $con);
 }
Esempio n. 5
0
    public function _getDynafields ($proUid, $type = 'xmlform', $start = null, $limit = null, $filter = null)
    {
        $cache = 1;
        if (! isset( $_SESSION['_cache_pmtables'] ) || (isset( $_SESSION['_cache_pmtables'] ) && $_SESSION['_cache_pmtables']['pro_uid'] != $proUid) || (isset( $_SESSION['_cache_pmtables'] ) && $_SESSION['_cache_pmtables']['dyn_uid'] != $this->dynUid)) {

            require_once 'classes/model/Dynaform.php';
            $cache = 0;
            $fields = array ();
            $fieldsNames = array ();

            $oCriteria = new Criteria( 'workflow' );
            $oCriteria->addSelectColumn( DynaformPeer::DYN_FILENAME );
            $oCriteria->add( DynaformPeer::PRO_UID, $proUid );
            $oCriteria->add( DynaformPeer::DYN_TYPE, $type );

            if (isset( $this->dynUid )) {
                $oCriteria->add( DynaformPeer::DYN_UID, $this->dynUid );
            }

            $oDataset = DynaformPeer::doSelectRS( $oCriteria );
            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
            $oDataset->next();

            $excludeFieldsList = array ('title','subtitle','link','file','button','reset','submit','listbox','checkgroup','grid','javascript', ''
            );

            $labelFieldsTypeList = array ('dropdown','radiogroup');
            G::loadSystem( 'dynaformhandler' );
            $index = 0;

            while ($aRow = $oDataset->getRow()) {
                if (file_exists( PATH_DYNAFORM . PATH_SEP . $aRow['DYN_FILENAME'] . '.xml' )) {
                    $dynaformHandler = new dynaformHandler( PATH_DYNAFORM . $aRow['DYN_FILENAME'] . '.xml' );
                    $nodeFieldsList = $dynaformHandler->getFields();

                    foreach ($nodeFieldsList as $node) {
                        $arrayNode = $dynaformHandler->getArray( $node );
                        $fieldName = $arrayNode['__nodeName__'];
                        $fieldType = isset($arrayNode['type']) ? $arrayNode['type']: '';
                        $fieldValidate = ( isset($arrayNode['validate'])) ? $arrayNode['validate'] : '';

                        if (! in_array( $fieldType, $excludeFieldsList ) && ! in_array( $fieldName, $fieldsNames ) ) {
                            $fields[] = array (
                                'FIELD_UID' => $fieldName . '-' . $fieldType,
                                'FIELD_NAME' => $fieldName,
                                'FIELD_VALIDATE'=>$fieldValidate,
                                '_index' => $index ++,
                                '_isset' => true
                            );
                            $fieldsNames[] = $fieldName;

                            if (in_array( $fieldType, $labelFieldsTypeList ) && ! in_array( $fieldName . '_label', $fieldsNames )) {
                                $fields[] = array (
                                    'FIELD_UID' => $fieldName . '_label' . '-' . $fieldType,
                                    'FIELD_NAME' => $fieldName . '_label',
                                    'FIELD_VALIDATE'=>$fieldValidate,
                                    '_index' => $index ++,
                                    '_isset' => true
                                );
                                $fieldsNames[] = $fieldName;
                            }
                        }
                    }
                }
                $oDataset->next();
            }
            
            // getting bpmn projects
            $oCriteria = new Criteria('workflow');
            $oCriteria->addSelectColumn(BpmnProcessPeer::PRJ_UID);
            $oCriteria->add(BpmnProcessPeer::PRJ_UID, $proUid);
            $oDataset = BpmnProcessPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro'));
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            $row = $oDataset->getRow();
            if (isset($row["PRJ_UID"])) {
                $oCriteria = new Criteria('workflow');
                $oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_UID);
                $oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_NAME);
                $oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_FIELD_TYPE);
                $oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_SQL);
                $oCriteria->addSelectColumn(ProcessVariablesPeer::VAR_ACCEPTED_VALUES);
                $oCriteria->add(ProcessVariablesPeer::PRJ_UID, $row["PRJ_UID"]);
                $oDataset = ProcessVariablesPeer::doSelectRS($oCriteria);
                $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
                $index = 0;
                while ($oDataset->next()) {
                    $row = $oDataset->getRow();
                    $fieldType = isset($row["VAR_FIELD_TYPE"]) ? $row["VAR_FIELD_TYPE"]: '';
                    $varSql = isset($row["VAR_SQL"]) ? $row["VAR_SQL"] : '';                    
                    $varProcessVariable = isset($row["VAR_ACCEPTED_VALUES"]) ? $row["VAR_ACCEPTED_VALUES"] : '[]';
                    if(! in_array( $fieldType, $excludeFieldsList )){
                        if(strlen($varSql) == 0 && $varProcessVariable == '[]'){
                            array_push($fields, array(
                                "FIELD_UID" => $row["VAR_NAME"] . "-" . $row["VAR_FIELD_TYPE"],
                                "FIELD_NAME" => $row["VAR_NAME"],
                                "FIELD_VALIDATE" => "any",
                                "_index" => $index ++,
                                "_isset" => true
                            ));
                        }                       
                    }
                }
            }

            sort( $fields );

            // if is a editing
            $fieldsEdit = array ();
            if (isset( $_SESSION['ADD_TAB_UID'] )) {
                require_once 'classes/model/AdditionalTables.php';

                $additionalTables = new AdditionalTables();
                $table = $additionalTables->load( $_SESSION['ADD_TAB_UID'], true );

                foreach ($table['FIELDS'] as $i => $field) {
                    array_push( $fieldsEdit, $field['FLD_DYN_NAME'] );
                }
            } //end editing

            $indexes = array();
            foreach ($fields as $i => $field) {
                $fields[$i]['_index'] = $i;
                $indexes[$field['FIELD_NAME']] = $i;

                if (in_array( $field['FIELD_NAME'], $fieldsEdit )) {
                    $fields[$i]['_isset'] = false;
                }
            }

            $_SESSION['_cache_pmtables']['pro_uid'] = $proUid;
            $_SESSION['_cache_pmtables']['dyn_uid'] = $this->dynUid;
            $_SESSION['_cache_pmtables']['rows'] = $fields;
            $_SESSION['_cache_pmtables']['count'] = count( $fields );
            $_SESSION['_cache_pmtables']['indexes'] = $indexes;
        } //end reload


        $fields = array ();
        $tmp = array ();

        foreach ($_SESSION['_cache_pmtables']['rows'] as $i => $row) {
            if (isset( $filter ) && $filter != '') {
                if ($row['_isset'] && stripos( $row['FIELD_NAME'], $filter ) !== false) {
                    $tmp[] = $row;
                }
            } else {
                if ($row['_isset']) {
                    $tmp[] = $row;
                }
            }
        }

        $fields = array_slice( $tmp, $start, $limit );

        return array ('cache' => $cache,'count' => count( $tmp ),'rows' => $fields
        );
    }
 /**
  * Selects a collection of BpmnEvent objects pre-filled with all related objects except BpmnProject.
  *
  * @return     array Array of BpmnEvent objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *       rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptBpmnProject(Criteria $c, $con = null)
 {
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     // $c->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     BpmnEventPeer::addSelectColumns($c);
     $startcol2 = BpmnEventPeer::NUM_COLUMNS - BpmnEventPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     BpmnProcessPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + BpmnProcessPeer::NUM_COLUMNS;
     $c->addJoin(BpmnEventPeer::PRO_UID, BpmnProcessPeer::PRO_UID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = BpmnEventPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = BpmnProcessPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getBpmnProcess();
             //CHECKME
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addBpmnEvent($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initBpmnEvents();
             $obj2->addBpmnEvent($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
Esempio n. 7
0
 public function setProUid($proUid)
 {
     parent::setProUid($proUid);
     $process = BpmnProcessPeer::retrieveByPK($this->getProUid());
     $this->bound->setDiaUid($process->getDiaUid());
 }
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      Connection $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *       rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(BpmnProcessPeer::PRO_UID, $pks, Criteria::IN);
         $objs = BpmnProcessPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
 /**
  * Get the associated BpmnProcess object
  *
  * @param      Connection Optional Connection object.
  * @return     BpmnProcess The associated BpmnProcess object.
  * @throws     PropelException
  */
 public function getBpmnProcess($con = null)
 {
     // include the related Peer class
     include_once 'classes/model/om/BaseBpmnProcessPeer.php';
     if ($this->aBpmnProcess === null && ($this->pro_uid !== "" && $this->pro_uid !== null)) {
         $this->aBpmnProcess = BpmnProcessPeer::retrieveByPK($this->pro_uid, $con);
         /* The following can be used instead of the line above to
              guarantee the related object contains a reference
              to this object, but this level of coupling
              may be undesirable in many circumstances.
              As it can lead to a db query with many results that may
              never be used.
              $obj = BpmnProcessPeer::retrieveByPK($this->pro_uid, $con);
              $obj->addBpmnProcesss($this);
            */
     }
     return $this->aBpmnProcess;
 }
Esempio n. 10
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
  * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = BpmnProcessPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setProUid($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setPrjUid($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setDiaUid($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setProName($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setProType($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setProIsExecutable($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setProIsClosed($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setProIsSubprocess($arr[$keys[7]]);
     }
 }