Esempio n. 1
0
    /**

     * 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;

        }

    }
Esempio n. 2
0
 /**
  * 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;
     }
 }
Esempio n. 3
0
 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;
     }
 }
 /**
  * Method to do selects.
  *
  * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
  * @param      Connection $con
  * @return     array Array of selected Objects
  * @throws     PropelException Any exceptions caught during processing will be
  *       rethrown wrapped into a PropelException.
  */
 public static function doSelect(Criteria $criteria, $con = null)
 {
     return WebEntryPeer::populateObjects(WebEntryPeer::doSelectRS($criteria, $con));
 }