/** * 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 AppHistoryPeer::populateObjects(AppHistoryPeer::doSelectRS($criteria, $con)); }
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; }
/** * Get data of a DynaForm History * * @param string $dynaFormUid Unique id of DynaForm * * return array Return an array with data of a DynaForm History */ public function getDynaFormHistory($prj_uid, $dynaFormUid, array $arrayData = array()) { try { $filter = ""; if (isset($arrayData["filter"])) { $filter = $arrayData["filter"]; } $start = 0; if (isset($arrayData["start"])) { $start = $arrayData["start"]; } $limit = 50; if (isset($arrayData["limit"])) { $limit = $arrayData["limit"]; } $this->throwExceptionIfNotExistsDynaForm($dynaFormUid, "", $this->arrayFieldNameForException["dynaFormUid"]); $criteria = new \Criteria("workflow"); $subcriteria = $criteria->getNewCriterion(\AppHistoryPeer::HISTORY_DATE, "%" . $filter . "%", \Criteria::LIKE); $criteria->addSelectColumn(\AppHistoryPeer::DYN_UID); $criteria->addSelectColumn(\AppHistoryPeer::HISTORY_DATA); $criteria->addSelectColumn(\AppHistoryPeer::HISTORY_DATE); $criteria->addAnd(\AppHistoryPeer::DYN_UID, $dynaFormUid, \Criteria::EQUAL); $criteria->addAnd(\AppHistoryPeer::OBJ_TYPE, "DYNAFORM", \Criteria::EQUAL); $criteria->addAnd(\AppHistoryPeer::HISTORY_DATA, "%DYN_CONTENT_HISTORY%", \Criteria::LIKE); $criteria->addAnd($subcriteria); $criteria->addDescendingOrderByColumn(\AppHistoryPeer::HISTORY_DATE); $criteria->setOffset($start); $criteria->setLimit($limit); $rsCriteria = \AppHistoryPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $data = array(); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $d = @unserialize($row["HISTORY_DATA"]); $jsonData = ""; if (isset($d["DYN_CONTENT_HISTORY"])) { $decode = base64_decode($d["DYN_CONTENT_HISTORY"], true); if ($decode !== false) { $jsonData = $decode; } } $data[] = array("history_date" => $row["HISTORY_DATE"], "dyn_uid" => $row["DYN_UID"], "dyn_content_history" => $jsonData); } return $data; } catch (\Exception $e) { throw $e; } }
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; }