/** * Get all WebEntry records of a Process * * @param string $processUid Unique id of Process * * return array Return an array with all WebEntry records of a Process */ public function getWebEntries($processUid) { try { $arrayWebEntry = array(); $webEntry = new \ProcessMaker\BusinessModel\WebEntry(); //Get UIDs to exclude $arrayWebEntryUidToExclude = array(); $criteria = new Criteria("workflow"); $criteria->setDistinct(); $criteria->addSelectColumn(WebEntryEventPeer::WEE_WE_UID); $criteria->add(WebEntryEventPeer::PRJ_UID, $processUid, Criteria::EQUAL); $rsCriteria = WebEntryEventPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $arrayWebEntryUidToExclude[] = $row["WEE_WE_UID"]; } //Get data $criteria = new Criteria("workflow"); $criteria->addSelectColumn(WebEntryPeer::WE_UID); $criteria->add(WebEntryPeer::PRO_UID, $processUid, Criteria::EQUAL); $criteria->add(WebEntryPeer::WE_UID, $arrayWebEntryUidToExclude, Criteria::NOT_IN); $rsCriteria = WebEntryPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $arrayWebEntry[] = $webEntry->getWebEntry($row["WE_UID"], true); } //Return return $arrayWebEntry; } catch (Exception $e) { throw $e; } }
/** * 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 = WebEntryPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setWeUid($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setProUid($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setTasUid($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setDynUid($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setUsrUid($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setWeMethod($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setWeInputDocumentAccess($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setWeData($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setWeCreateUsrUid($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setWeUpdateUsrUid($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setWeCreateDate($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setWeUpdateDate($arr[$keys[11]]); } }
public function getData($processUid) { try { $process = new \Processes(); //Get data $workflowData = (array) $process->getWorkflowData($processUid); $workflowData["process"]["PRO_DYNAFORMS"] = empty($workflowData["process"]["PRO_DYNAFORMS"]) ? "" : serialize($workflowData["process"]["PRO_DYNAFORMS"]); $workflowData["process"] = array($workflowData["process"]); $workflowData["processCategory"] = empty($workflowData["processCategory"]) ? array() : array($workflowData["processCategory"]); //Get files $workflowFile = array(); //Getting DynaForms foreach ($workflowData["dynaforms"] as $dynaform) { $dynFile = PATH_DYNAFORM . $dynaform["DYN_FILENAME"] . ".xml"; $workflowFile["DYNAFORMS"][] = array("filename" => $dynaform["DYN_TITLE"], "filepath" => $dynaform["DYN_FILENAME"] . ".xml", "file_content" => file_get_contents($dynFile)); $htmlFile = PATH_DYNAFORM . $dynaform["DYN_FILENAME"] . ".html"; if (file_exists($htmlFile)) { $workflowFile["DYNAFORMS"][] = array("filename" => $dynaform["DYN_FILENAME"] . ".html", "filepath" => $dynaform["DYN_FILENAME"] . ".html", "file_content" => file_get_contents($htmlFile)); } } //Get public files to exclude $arrayPublicFileToExclude = array("wsClient.php"); //WebEntry $criteria = new \Criteria("workflow"); $criteria->addSelectColumn(\WebEntryPeer::WE_DATA); $criteria->add(\WebEntryPeer::PRO_UID, $processUid, \Criteria::EQUAL); $criteria->add(\WebEntryPeer::WE_METHOD, "WS", \Criteria::EQUAL); $rsCriteria = \WebEntryPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $arrayPublicFileToExclude[] = $row["WE_DATA"]; $arrayPublicFileToExclude[] = preg_replace("/^(.+)\\.php\$/", "\$1Post.php", $row["WE_DATA"]); } //Get templates and public files $workspaceTargetDirs = array("TEMPLATES" => "mailTemplates", "PUBLIC" => "public"); $workspaceDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP; foreach ($workspaceTargetDirs as $target => $workspaceTargetDir) { $templatesDir = $workspaceDir . $workspaceTargetDir . PATH_SEP . $processUid; $templatesFiles = Util\Common::rglob("{$templatesDir}/*", 0, true); foreach ($templatesFiles as $templatesFile) { if (is_dir($templatesFile)) { continue; } $filename = basename($templatesFile); if ($target == "PUBLIC" && in_array($filename, $arrayPublicFileToExclude)) { continue; } $workflowFile[$target][] = array("filename" => $filename, "filepath" => $processUid . PATH_SEP . $filename, "file_content" => file_get_contents($templatesFile)); } } //Return self::log("Getting Workflow data Success!"); return array($workflowData, $workflowFile); } catch (\Exception $e) { self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString()); throw $e; } }
/** * Get data of a Web Entry * * @param string $webEntryUid Unique id of Web Entry * @param bool $flagGetRecord Value that set the getting * * return array Return an array with data of a Web Entry */ public function getWebEntry($webEntryUid, $flagGetRecord = false) { try { //Verify data $this->throwExceptionIfNotExistsWebEntry($webEntryUid, $this->arrayFieldNameForException["webEntryUid"]); //Get data //SQL $criteria = $this->getWebEntryCriteria(); $criteria->add(\WebEntryPeer::WE_UID, $webEntryUid, \Criteria::EQUAL); $rsCriteria = \WebEntryPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $rsCriteria->next(); $row = $rsCriteria->getRow(); //Return return !$flagGetRecord ? $this->getWebEntryDataFromRecord($row) : $row; } catch (\Exception $e) { throw $e; } }
/** * Delete WebEntry * * @param string $webEntryUid Unique id of WebEntry * @param string $webEntryTaskUid WebEntry, unique id of Task * * return void */ public function deleteWebEntry($webEntryUid, $webEntryTaskUid) { try { if ($webEntryTaskUid != "") { $obj = \TaskPeer::retrieveByPK($webEntryTaskUid); if (!is_null($obj)) { $task = new \Tasks(); $task->deleteTask($webEntryTaskUid); } } if ($webEntryUid != "") { $obj = \WebEntryPeer::retrieveByPK($webEntryUid); if (!is_null($obj)) { $this->webEntry->delete($webEntryUid); } } } catch (\Exception $e) { throw $e; } }
/** * 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(WebEntryPeer::WE_UID, $pks, Criteria::IN); $objs = WebEntryPeer::doSelect($criteria, $con); } return $objs; }