From c1d5f6d791e189db5053335c3f8d5c6f4e6750ed Mon Sep 17 00:00:00 2001 From: Hector Cortez Date: Tue, 5 Mar 2013 14:11:12 -0400 Subject: [PATCH 1/2] BUG 0000 Adjustment for the standardization of code. CODE_STYLE --- workflow/engine/classes/class.case.php | 1079 ++++++++--------- .../engine/classes/class.configuration.php | 504 ++++---- workflow/engine/classes/class.toolBar.php | 91 +- 3 files changed, 840 insertions(+), 834 deletions(-) diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php index a1e636ed7..44cb6846d 100755 --- a/workflow/engine/classes/class.case.php +++ b/workflow/engine/classes/class.case.php @@ -24,25 +24,24 @@ * Coral Gables, FL, 33134, USA, or email info@colosa.com. * */ - -/*require_once ("classes/model/Application.php"); -require_once ("classes/model/AppCacheView.php"); -require_once ("classes/model/AppDelay.php"); -require_once ("classes/model/AppDelegation.php"); -require_once ("classes/model/AppDocument.php"); -require_once ("classes/model/AppEvent.php"); -require_once ("classes/model/AppHistory.php"); -require_once ("classes/model/AppMessage.php"); -require_once ("classes/model/AppNotes.php"); -require_once ("classes/model/AppOwner.php"); -require_once ("classes/model/AppSolrQueue.php"); -require_once ("classes/model/AppThread.php"); -require_once ("classes/model/CaseTracker.php"); -require_once ("classes/model/CaseTrackerObject.php"); -require_once ("classes/model/Configuration.php"); -require_once ("classes/model/Content.php"); -require_once ("classes/model/DbSource.php"); -require_once ("classes/model/Dynaform.php");*/ +/* require_once ("classes/model/Application.php"); + require_once ("classes/model/AppCacheView.php"); + require_once ("classes/model/AppDelay.php"); + require_once ("classes/model/AppDelegation.php"); + require_once ("classes/model/AppDocument.php"); + require_once ("classes/model/AppEvent.php"); + require_once ("classes/model/AppHistory.php"); + require_once ("classes/model/AppMessage.php"); + require_once ("classes/model/AppNotes.php"); + require_once ("classes/model/AppOwner.php"); + require_once ("classes/model/AppSolrQueue.php"); + require_once ("classes/model/AppThread.php"); + require_once ("classes/model/CaseTracker.php"); + require_once ("classes/model/CaseTrackerObject.php"); + require_once ("classes/model/Configuration.php"); + require_once ("classes/model/Content.php"); + require_once ("classes/model/DbSource.php"); + require_once ("classes/model/Dynaform.php"); */ //require_once ("classes/model/InputDocument.php"); //require_once ("classes/model/Language.php"); //require_once ("classes/model/ObjectPermission.php"); @@ -70,6 +69,7 @@ G::LoadClass("pmScript"); */ class Cases { + private $appSolr = null; public function __construct() @@ -85,7 +85,8 @@ class Cases * Ask if an user can start a case * @param string $sUIDUser * @return boolean - */ + */ + public function canStartCase($sUIDUser = '', $processUid = '') { $c = new Criteria(); @@ -98,7 +99,7 @@ class Cases $c->add(TaskPeer::TAS_START, 'TRUE'); $c->add(TaskUserPeer::USR_UID, $sUIDUser); if ($processUid != '') { - $c->add(TaskPeer::PRO_UID, $processUid); + $c->add(TaskPeer::PRO_UID, $processUid); } $rs = TaskPeer::doSelectRS($c); @@ -124,7 +125,7 @@ class Cases $c->add(TaskPeer::TAS_START, 'TRUE'); $c->add(TaskUserPeer::USR_UID, $aGroups, Criteria::IN); if ($processUid != '') { - $c->add(TaskPeer::PRO_UID, $processUid); + $c->add(TaskPeer::PRO_UID, $processUid); } $rs = TaskPeer::doSelectRS($c); @@ -138,7 +139,8 @@ class Cases * get user starting tasks * @param string $sUIDUser * @return $rows - */ + */ + public function getStartCases($sUIDUser = '') { $rows[] = array('uid' => 'char', 'value' => 'char'); @@ -238,7 +240,8 @@ class Cases * get user starting tasks, but per type (dropdown, radio and category type) * @param string $sUIDUser * @return $rows - */ + */ + public function getStartCasesPerType($sUIDUser = '', $typeView = null) { $rows[] = array('uid' => 'char', 'value' => 'char'); @@ -342,9 +345,9 @@ class Cases while ($row = $rs->getRow()) { if ($typeView == 'category') { $taskTitle = TaskPeer::retrieveByPK($row['TAS_UID']); - $row['TAS_TITLE']= $taskTitle->getTasTitle(); + $row['TAS_TITLE'] = $taskTitle->getTasTitle(); $row['CATEGORY_NAME'] = ($row['CATEGORY_NAME'] == '') ? - G::LoadTranslation('ID_PROCESS_NOCATEGORY') : $row['CATEGORY_NAME']; + G::LoadTranslation('ID_PROCESS_NOCATEGORY') : $row['CATEGORY_NAME']; $rows[] = array( 'uid' => $row['TAS_UID'], 'value' => $row['PRO_TITLE'] . ' (' . $row['TAS_TITLE'] . ')', @@ -369,7 +372,8 @@ class Cases * get user's SelfService tasks * @param string $sUIDUser * @return $rows - */ + */ + public function getSelfServiceTasks($sUIDUser = '') { $rows[] = array('uid' => '', 'value' => ''); @@ -484,9 +488,9 @@ class Cases $caseData = $this->LoadCase($APP_UID); if (isset($caseData['APP_DATA'][$tasGroupVariable])) { if (trim($caseData['APP_DATA'][$tasGroupVariable]) != '') { - if (in_array(trim($caseData['APP_DATA'][$tasGroupVariable]), $groups)) { - return true; - } + if (in_array(trim($caseData['APP_DATA'][$tasGroupVariable]), $groups)) { + return true; + } } } } @@ -499,7 +503,8 @@ class Cases * @param string $sAppUid * @param integer $iDelIndex > 0 //get the Delegation fields * @return Fields - */ + */ + public function loadCase($sAppUid, $iDelIndex = 0) { try { @@ -585,7 +590,8 @@ class Cases * LoadCaseByNumber * @param string $caseNumber * @return $aCases - */ + */ + public function loadCaseByNumber($sCaseNumber) { //('SELECT * FROM APP_DELEGATION WHERE APP_PROC_CODE="'.$sCaseNumber.'" '); @@ -625,7 +631,8 @@ class Cases * @param string $aAppData * @param string $sLabel * @return $appLabel - */ + */ + public function refreshCaseLabel($sAppUid, $aAppData, $sLabel) { $getAppLabel = "getApp$sLabel"; @@ -662,7 +669,8 @@ class Cases * @param string $sAppUid * @param array $aAppData * @return $res - */ + */ + public function refreshCaseTitleAndDescription($sAppUid, $aAppData) { $res['APP_TITLE'] = null; @@ -676,7 +684,7 @@ class Cases return $res; } - $res['APP_TITLE'] = $fields['APP_TITLE']; // $oApplication->$getAppLabel(); + $res['APP_TITLE'] = $fields['APP_TITLE']; // $oApplication->$getAppLabel(); $res['APP_DESCRIPTION'] = $fields['APP_DESCRIPTION']; $lang = defined('SYS_LANG') ? SYS_LANG : 'en'; @@ -733,7 +741,8 @@ class Cases * @param string $sAppUid * @param array $aAppData * @return $res - */ + */ + public function newRefreshCaseTitleAndDescription($sAppUid, $fields, $aAppData) { $res = array(); @@ -744,7 +753,7 @@ class Cases $cri = new Criteria; $cri->clearSelectColumns(); - $cri->addSelectColumn(AppDelegationPeer::TAS_UID ); + $cri->addSelectColumn(AppDelegationPeer::TAS_UID); $cri->add(AppDelegationPeer::APP_UID, $sAppUid); $cri->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"); $rsCri = AppDelegationPeer::doSelectRS($cri); @@ -758,7 +767,7 @@ class Cases $c->clearSelectColumns(); $c->addSelectColumn(ContentPeer::CON_CATEGORY); $c->addSelectColumn(ContentPeer::CON_VALUE); - $c->add(ContentPeer::CON_ID, $rowCri['TAS_UID'] ); + $c->add(ContentPeer::CON_ID, $rowCri['TAS_UID']); $c->add(ContentPeer::CON_LANG, $lang); $rs = TaskPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); @@ -771,10 +780,10 @@ class Cases break; } $tasDefTitle = trim($row['CON_VALUE']); - if ($tasDefTitle != '' ) { + if ($tasDefTitle != '') { $newAppTitle = G::replaceDataField($tasDefTitle, $aAppData); $res['APP_TITLE'] = $newAppTitle; - if ( isset($fields['APP_TITLE']) && $fields['APP_TITLE'] == $newAppTitle ) { + if (isset($fields['APP_TITLE']) && $fields['APP_TITLE'] == $newAppTitle) { break; } $bUpdatedDefTitle = true; @@ -787,8 +796,8 @@ class Cases // update set $c2 = new Criteria('workflow'); - $c2->add(ContentPeer::CON_VALUE, $newAppTitle ); - BasePeer::doUpdate($c1, $c2,$con); + $c2->add(ContentPeer::CON_VALUE, $newAppTitle); + BasePeer::doUpdate($c1, $c2, $con); } break; case 'TAS_DEF_DESCRIPTION': @@ -796,11 +805,11 @@ class Cases break; } $tasDefDescription = trim($row['CON_VALUE']); - if ($tasDefDescription != '' ) { + if ($tasDefDescription != '') { $newAppDescription = G::replaceDataField($tasDefDescription, $aAppData); $res['APP_DESCRIPTION'] = $newAppDescription; if (isset($fields['APP_DESCRIPTION']) && - $fields['APP_DESCRIPTION'] == $newAppDescription) { + $fields['APP_DESCRIPTION'] == $newAppDescription) { break; } $bUpdatedDefDescription = true; @@ -812,8 +821,8 @@ class Cases $c1->add(ContentPeer::CON_LANG, $lang); // update set $c2 = new Criteria('workflow'); - $c2->add(ContentPeer::CON_VALUE, $newAppDescription ); - BasePeer::doUpdate($c1, $c2,$con); + $c2->add(ContentPeer::CON_VALUE, $newAppDescription); + BasePeer::doUpdate($c1, $c2, $con); } break; } @@ -835,7 +844,7 @@ class Cases * @param array $aAppData * @access public * @return $appLabel - */ + */ public function refreshCaseTitle($sAppUid, $aAppData) { return $this->refreshCaseLabel($sAppUid, $aAppData, "Title"); @@ -850,7 +859,7 @@ class Cases * @param array $aAppData * @access public * @return $appLabel - */ + */ public function refreshCaseDescription($sAppUid, $aAppData) { return $this->refreshCaseLabel($sAppUid, $aAppData, "Description"); @@ -865,7 +874,7 @@ class Cases * @param array $aAppData * @access public * @return $appLabel - */ + */ public function refreshCaseStatusCode($sAppUid, $aAppData) { return $this->refreshCaseLabel($sAppUid, $aAppData, "ProcCode"); @@ -880,7 +889,7 @@ class Cases * @param array $aArray2 * @access public * @return $appLabel - */ + */ public function arrayRecursiveDiff($aArray1, $aArray2) { $aReturn = array(); @@ -910,22 +919,23 @@ class Cases * @param string $sAppUid * @param integer $iDelIndex > 0 //get the Delegation fields * @return Fields - */ + */ + public function updateCase($sAppUid, $Fields = array()) { try { $aApplicationFields = $Fields['APP_DATA']; - $Fields['APP_UID'] = $sAppUid; + $Fields['APP_UID'] = $sAppUid; $Fields['APP_UPDATE_DATE'] = 'now'; - $Fields['APP_DATA'] = serialize($Fields['APP_DATA']); + $Fields['APP_DATA'] = serialize($Fields['APP_DATA']); /* - $oApp = new Application; - $appFields = $oApp->load($sAppUid); - */ - $oApp = ApplicationPeer::retrieveByPk( $sAppUid ); + $oApp = new Application; + $appFields = $oApp->load($sAppUid); + */ + $oApp = ApplicationPeer::retrieveByPk($sAppUid); $appFields = $oApp->toArray(BasePeer::TYPE_FIELDNAME); if (isset($Fields['APP_TITLE'])) { - $appFields['APP_TITLE'] = $Fields['APP_TITLE']; + $appFields['APP_TITLE'] = $Fields['APP_TITLE']; } if (isset($Fields['APP_DESCRIPTION'])) { $appFields['APP_DESCRIPTION'] = $Fields['APP_DESCRIPTION']; @@ -935,7 +945,7 @@ class Cases //Start: Save History --By JHL if (isset($Fields['CURRENT_DYNAFORM'])) { //only when that variable is set.. from Save - $FieldsBefore = $this->loadCase( $sAppUid ); + $FieldsBefore = $this->loadCase($sAppUid); $FieldsDifference = $this->arrayRecursiveDiff($FieldsBefore['APP_DATA'], $aApplicationFields); $fieldsOnBoth = array_intersect_assoc($FieldsBefore['APP_DATA'], $aApplicationFields); //Add fields that weren't in previous version @@ -953,19 +963,18 @@ class Cases } } //End Save History - //we are removing the app_title and app_description from this array, //because they already be updated in newRefreshCaseTitleAndDescription function if (isset($Fields['APP_TITLE'])) { - unset ($Fields['APP_TITLE']); + unset($Fields['APP_TITLE']); } if (isset($Fields['APP_DESCRIPTION'])) { - unset ($Fields['APP_DESCRIPTION']); + unset($Fields['APP_DESCRIPTION']); } $oApp->update($Fields); $DEL_INDEX = isset($Fields['DEL_INDEX']) ? $Fields['DEL_INDEX'] : ''; - $TAS_UID = isset($Fields['TAS_UID']) ? $Fields['TAS_UID'] : ''; + $TAS_UID = isset($Fields['TAS_UID']) ? $Fields['TAS_UID'] : ''; G::LoadClass('reportTables'); require_once 'classes/model/AdditionalTables.php'; @@ -974,7 +983,7 @@ class Cases $oReportTables->updateTables($appFields['PRO_UID'], $sAppUid, $Fields['APP_NUMBER'], $aApplicationFields); $addtionalTables->updateReportTables( - $appFields['PRO_UID'], $sAppUid, $Fields['APP_NUMBER'], $aApplicationFields, $Fields['APP_STATUS'] + $appFields['PRO_UID'], $sAppUid, $Fields['APP_NUMBER'], $aApplicationFields, $Fields['APP_STATUS'] ); //now update the priority in appdelegation table, using the defined variable in task @@ -983,7 +992,7 @@ class Cases $c = new Criteria(); $c->clearSelectColumns(); $c->addSelectColumn(TaskPeer::TAS_PRIORITY_VARIABLE); - $c->add(TaskPeer::TAS_UID, $TAS_UID ); + $c->add(TaskPeer::TAS_UID, $TAS_UID); $rs = TaskPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); @@ -1000,7 +1009,7 @@ class Cases $array['DEL_INDEX'] = $DEL_INDEX; $array['TAS_UID'] = $TAS_UID; $array['DEL_PRIORITY'] = (isset($x[$VAR_PRI]) ? - ($x[$VAR_PRI] >= 1 && $x[$VAR_PRI] <= 5 ? $x[$VAR_PRI] : '3') : '3'); + ($x[$VAR_PRI] >= 1 && $x[$VAR_PRI] <= 5 ? $x[$VAR_PRI] : '3') : '3'); $oDel->update($array); } } @@ -1021,7 +1030,8 @@ class Cases * @name removeCase * @param string $sAppUid * @return Fields - */ + */ + public function removeCase($sAppUid) { try { @@ -1122,7 +1132,8 @@ class Cases * @param string $sAppUid * @param string $iDelIndex * @return Fields - */ + */ + public function setDelInitDate($sAppUid, $iDelIndex) { try { @@ -1146,7 +1157,8 @@ class Cases * @param string $iDelIndex * @param string $usrId * @return Fields - */ + */ + public function setCatchUser($sAppUid, $iDelIndex, $usrId) { try { @@ -1170,7 +1182,8 @@ class Cases * @name GetOpenThreads * @param string $sAppUid * @return $row (number of APP_DELEGATION rows) - */ + */ + public function GetOpenThreads($sAppUid) { try { @@ -1195,7 +1208,8 @@ class Cases * @param string $sAppUid * @param string $iDelIndex * @return $aThreads - */ + */ + public function getSiblingThreads($sAppUid, $iDelIndex) { try { @@ -1240,7 +1254,8 @@ class Cases * @param string $iDelIndex * @param string $sCurrentTask * @return $aThreads - */ + */ + public function getOpenSiblingThreads($sNextTask, $sAppUid, $iDelIndex, $sCurrentTask) { try { @@ -1257,7 +1272,7 @@ class Cases $oDataset->next(); while ($aRow = $oDataset->getRow()) { $aPrevious = $this->searchOpenPreviousTasks($aRow['TAS_UID'], $sAppUid); - if (is_array($aPrevious) && count($aPrevious) > 0 ) { + if (is_array($aPrevious) && count($aPrevious) > 0) { $aThreads[] = array_merge($aPrevious, $aThreads); } $oDataset->next(); @@ -1277,7 +1292,7 @@ class Cases * @param string $sAppUid * @param array $aPreviousTasks optional array that serves to trace the task routes and avoid infinite loops. * @return $aThreads - */ + */ public function searchOpenPreviousTasks($taskUid, $sAppUid, $aPreviousTasks = array()) { //in this array we are storing all open delegation rows. @@ -1308,7 +1323,7 @@ class Cases while (is_array($aRow)) { $delegations = $this->getReviewedTasks($aRow['TAS_UID'], $sAppUid); if ($delegations !== false) { - if ( count($delegations['open']) > 0) { + if (count($delegations['open']) > 0) { //there is an open delegation, so we need to return the delegation row $aTaskReviewed = array_merge($aTaskReviewed, $delegations['open']); } else { @@ -1378,7 +1393,8 @@ class Cases * @name CountTotalPreviousTasks * @param string $sTasUid $nextDel['TAS_UID'] * @return $row[0] - */ + */ + public function CountTotalPreviousTasks($sTasUid) { try { @@ -1402,7 +1418,8 @@ class Cases * @param string $sAppUid $nextDel['TAS_UID'] * @param string $sTasUid * @return $pendingDel - */ + */ + public function getOpenNullDelegations($sAppUid, $sTasUid) { $pendingDel = array(); @@ -1461,7 +1478,8 @@ class Cases * @param string $sAppUid $nextDel['APP_UID'] * @param string $sTasUid $nextDel['TAS_UID'] * @return true or false - */ + */ + public function isRouteOpen($sAppUid, $sTasUid) { try { @@ -1497,8 +1515,8 @@ class Cases $rs->next(); $row = $rs->getRow(); $sql = 'SELECT D.*,R.* ' . - 'FROM ROUTE R LEFT JOIN APP_DELEGATION D ON (R.TAS_UID=D.TAS_UID) WHERE APP_UID="' . - $sAppUid . '" AND ROU_NEXT_TASK="' . $sTasUid . '"'; + 'FROM ROUTE R LEFT JOIN APP_DELEGATION D ON (R.TAS_UID=D.TAS_UID) WHERE APP_UID="' . + $sAppUid . '" AND ROU_NEXT_TASK="' . $sTasUid . '"'; while (is_array($row)) { switch ($row['DEL_THREAD_STATUS']) { @@ -1543,29 +1561,12 @@ class Cases * @return void */ - public function newAppDelegation( - $sProUid, - $sAppUid, - $sTasUid, - $sUsrUid, - $sPrevious, - $iPriority, - $sDelType, - $iAppThreadIndex = 1, - $nextDel = null - ) { + public function newAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sPrevious, $iPriority, $sDelType, $iAppThreadIndex = 1, $nextDel = null) + { try { $appDel = new AppDelegation(); $result = $appDel->createAppDelegation( - $sProUid, - $sAppUid, - $sTasUid, - $sUsrUid, - $iAppThreadIndex, - $iPriority, - false, - $sPrevious, - $nextDel + $sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iPriority, false, $sPrevious, $nextDel ); //update searchindex if ($this->appSolr != null) { @@ -1586,7 +1587,8 @@ class Cases * @param string $iDelIndex * @param string $iAppThreadIndex, * @return true - */ + */ + public function updateAppDelegation($sAppUid, $iDelIndex, $iAppThreadIndex) { try { @@ -1612,7 +1614,8 @@ class Cases * @name GetAllDelegations * @param string $sAppUid * @return $aDelegations - */ + */ + public function GetAllDelegations($sAppUid) { //('SELECT * FROM APP_DELEGATION WHERE APP_UID="'.$currentDelegation['APP_UID'].'" '); @@ -1641,7 +1644,8 @@ class Cases * @name GetAllDelegations * @param string $sAppUid * @return $aThreads - */ + */ + public function GetAllThreads($sAppUid) { //('SELECT * FROM APP_DELEGATION WHERE APP_UID="'.$currentDelegation['APP_UID'].'" '); @@ -1680,13 +1684,13 @@ class Cases /// updating the DEL_INDEX value in the APP_THREAD $con = Propel::getConnection('workflow'); $c1 = new Criteria('workflow'); - $c1->add(AppThreadPeer::APP_UID, $sAppUid); + $c1->add(AppThreadPeer::APP_UID, $sAppUid); $c1->add(AppThreadPeer::APP_THREAD_INDEX, $iAppThreadIndex); // update set $c2 = new Criteria('workflow'); - $c2->add(AppThreadPeer::DEL_INDEX, $iNewDelIndex ); - BasePeer::doUpdate($c1, $c2,$con); + $c2->add(AppThreadPeer::DEL_INDEX, $iNewDelIndex); + BasePeer::doUpdate($c1, $c2, $con); //update searchindex if ($this->appSolr != null) { $this->appSolr->updateApplicationSearchIndex($sAppUid); @@ -1704,7 +1708,8 @@ class Cases * @param string $sAppUid, * @param string $iAppThreadIndex, * @return true - */ + */ + public function closeAppThread($sAppUid, $iAppThreadIndex) { try { @@ -1727,7 +1732,8 @@ class Cases * @name closeAllDelegations * @param string $sAppUid * @return void - */ + */ + public function closeAllThreads($sAppUid) { try { @@ -1764,7 +1770,8 @@ class Cases * @param string $iNewDelIndex * @param string $iAppParent * @return $iAppThreadIndex $iNewDelIndex, $iAppThreadIndex ); - */ + */ + public function newAppThread($sAppUid, $iNewDelIndex, $iAppParent) { try { @@ -1786,7 +1793,8 @@ class Cases * @name closeAllDelegations * @param string $sAppUid * @return - */ + */ + public function closeAllDelegations($sAppUid) { try { @@ -1822,7 +1830,8 @@ class Cases * @param string $sAppUid * @param string $iDelIndex * @return Fields - */ + */ + public function CloseCurrentDelegation($sAppUid, $iDelIndex) { try { @@ -1845,7 +1854,6 @@ class Cases throw (new PropelException('The row cannot be created!', new PropelException($msg))); } } - } catch (exception $e) { throw ($e); } @@ -1859,7 +1867,8 @@ class Cases * @param string $sAppUid * @param string $iDelIndex * @return Fields - */ + */ + public function ReactivateCurrentDelegation($sAppUid, $iDelegation) { try { @@ -1894,7 +1903,8 @@ class Cases * @param string $sTasUid * @param string $sUsrUid * @return Fields - */ + */ + public function startCase($sTasUid, $sUsrUid, $isSubprocess = false) { if ($sTasUid != '') { @@ -1904,7 +1914,7 @@ class Cases //To allow Self Service as the first task if (($Fields['TAS_ASSIGN_TYPE'] != 'SELF_SERVICE') && ($sUsrUid == '')) { - throw (new Exception('You tried to start a new case without send the USER UID!')); + throw (new Exception('You tried to start a new case without send the USER UID!')); } //Process @@ -1921,7 +1931,7 @@ class Cases $iAppThreadIndex = 1; // Start Thread $iAppDelPrio = 3; // Priority $iDelIndex = $AppDelegation->createAppDelegation( - $sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iAppDelPrio, $isSubprocess + $sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iAppDelPrio, $isSubprocess ); //appThread @@ -1931,9 +1941,9 @@ class Cases //DONE: Al ya existir un delegation, se puede "calcular" el caseTitle. $Fields = $Application->toArray(BasePeer::TYPE_FIELDNAME); $aApplicationFields = $Fields['APP_DATA']; - $newValues = $this->newRefreshCaseTitleAndDescription($sAppUid, $Fields, $aApplicationFields ); - if (! isset($newValues['APP_TITLE']) ) { - $newValues['APP_TITLE'] = ''; + $newValues = $this->newRefreshCaseTitleAndDescription($sAppUid, $Fields, $aApplicationFields); + if (!isset($newValues['APP_TITLE'])) { + $newValues['APP_TITLE'] = ''; } $caseNumber = $Fields['APP_NUMBER']; @@ -1957,11 +1967,11 @@ class Cases //call plugin if (class_exists('folderData')) { $folderData = new folderData( - $sProUid, - $proFields['PRO_TITLE'], - $sAppUid, - $newValues['APP_TITLE'], - $sUsrUid + $sProUid, + $proFields['PRO_TITLE'], + $sAppUid, + $newValues['APP_TITLE'], + $sUsrUid ); $oPluginRegistry = &PMPluginRegistry::getSingleton(); $oPluginRegistry->executeTriggers(PM_CREATE_CASE, $folderData); @@ -1984,7 +1994,8 @@ class Cases * @param integer $iDelIndex * @param integer $iPosition * @return array - */ + */ + public function getNextStep($sProUid = '', $sAppUid = '', $iDelIndex = 0, $iPosition = 0) { G::LoadClass('pmScript'); @@ -2066,8 +2077,8 @@ class Cases 'UID' => $oStep->getStepUidObj(), 'POSITION' => $oStep->getStepPosition(), 'PAGE' => 'cases_Step?TYPE=' . $oStep->getStepTypeObj() . '&UID=' . - $oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() . - '&ACTION=' . $sAction + $oStep->getStepUidObj() . '&POSITION=' . $oStep->getStepPosition() . + '&ACTION=' . $sAction ); $iPosition = $iLastStep; } @@ -2098,7 +2109,8 @@ class Cases * @param integer $iDelIndex * @param integer $iPosition * @return array - */ + */ + public function getPreviousStep($sProUid = '', $sAppUid = '', $iDelIndex = 0, $iPosition = 0) { //Note: Depreciated, delete in the future @@ -2201,7 +2213,8 @@ class Cases * @param string $iPosition * @param integer $sType * @return $aNextStep - */ + */ + public function getNextSupervisorStep($sProcessUID, $iPosition, $sType = 'DYNAFORM') { $iPosition += 1; @@ -2235,7 +2248,8 @@ class Cases * @param string $iPosition * @param integer $sType * @return $aNextStep - */ + */ + public function getPreviousSupervisorStep($sProcessUID, $iPosition, $sType = 'DYNAFORM') { $iPosition -= 1; @@ -2271,7 +2285,8 @@ class Cases * @name getTransferHistoryCriteria * @param string $sAppUid * @return array - */ + */ + public function getTransferHistoryCriteria($sAppUid) { $c = new Criteria('workflow'); @@ -2290,16 +2305,10 @@ class Cases $oDataBase = new database(); $c->addAsColumn('USR_NAME', $oDataBase->concatString("USR_LASTNAME", "' '", "USR_FIRSTNAME")); $c->addAsColumn( - 'DEL_FINISH_DATE', - $oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL", - "'-'", - AppDelegationPeer::DEL_FINISH_DATE ) + 'DEL_FINISH_DATE', $oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL", "'-'", AppDelegationPeer::DEL_FINISH_DATE) ); $c->addAsColumn( - 'APP_TYPE', - $oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL", - "'IN_PROGRESS'", - AppDelayPeer::APP_TYPE ) + 'APP_TYPE', $oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL", "'IN_PROGRESS'", AppDelayPeer::APP_TYPE) ); } $c->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE); @@ -2341,7 +2350,8 @@ class Cases * @param string $sUIDUserLogged * @return array ( 'where' => Criteria, 'group' => Criteria ) * @return array - */ + */ + public function prepareCriteriaForToDo($sUIDUserLogged) { // NEW QUERY @@ -2359,9 +2369,8 @@ class Cases $c->addSelectColumn(AppCacheViewPeer::DEL_INIT_DATE); //$c->addSelectColumn(AppCacheViewPeer::DEL_TASK_DUE_DATE ); $c->addAsColumn( - 'DEL_TASK_DUE_DATE', - " IF (" . AppCacheViewPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('', " . - AppCacheViewPeer::DEL_TASK_DUE_DATE . ", ''), " . AppCacheViewPeer::DEL_TASK_DUE_DATE . ") " + 'DEL_TASK_DUE_DATE', " IF (" . AppCacheViewPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('', " . + AppCacheViewPeer::DEL_TASK_DUE_DATE . ", ''), " . AppCacheViewPeer::DEL_TASK_DUE_DATE . ") " ); $c->addSelectColumn(AppCacheViewPeer::DEL_FINISH_DATE); $c->addSelectColumn(AppCacheViewPeer::DEL_THREAD_STATUS); @@ -2402,13 +2411,9 @@ class Cases * @param string $ClearSession * @param string $aAdditionalFilter * @return array - */ - public function getConditionCasesList( - $sTypeList = 'all', - $sUIDUserLogged = '', - $ClearSession = true, - $aAdditionalFilter = null - ) { + */ + public function getConditionCasesList($sTypeList = 'all', $sUIDUserLogged = '', $ClearSession = true, $aAdditionalFilter = null) + { $c = new Criteria('workflow'); $c->clearSelectColumns(); $c->addSelectColumn(ApplicationPeer::APP_UID); @@ -2419,13 +2424,12 @@ class Cases $c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY); //$c->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE); $c->addAsColumn( - 'DEL_TASK_DUE_DATE', - " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('', " . - AppDelegationPeer::DEL_TASK_DUE_DATE . ", ''), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") " + 'DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('', " . + AppDelegationPeer::DEL_TASK_DUE_DATE . ", ''), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") " ); global $RBAC; - //seems the PM_SUPERVISOR can delete a completed case + //seems the PM_SUPERVISOR can delete a completed case if ($sTypeList == "completed" && $RBAC->userCanAccess('PM_SUPERVISOR') == 1) { $c->addAsColumn("DEL_LINK", "CONCAT('" . G::LoadTranslation('ID_DELETE') . "')"); } @@ -2442,8 +2446,7 @@ class Cases $c->addAsColumn('APP_TAS_TITLE', 'TAS_TITLE.CON_VALUE'); //$c->addAsColumn('APP_DEL_PREVIOUS_USER', 'APP_LAST_USER.USR_USERNAME'); $c->addAsColumn( - 'APP_DEL_PREVIOUS_USER', - "CONCAT(APP_LAST_USER.USR_LASTNAME, + 'APP_DEL_PREVIOUS_USER', "CONCAT(APP_LAST_USER.USR_LASTNAME, ' ', APP_LAST_USER.USR_FIRSTNAME)" ); @@ -2493,7 +2496,7 @@ class Cases //gral, to_revise, to_reassign dont have userid in the query if ($sTypeList != 'gral' && $sTypeList != 'to_revise' && $sTypeList != 'to_reassign' && - $sTypeList != 'my_started' && $sTypeList != 'sent') { + $sTypeList != 'my_started' && $sTypeList != 'sent') { $c->add(UsersPeer::USR_UID, $sUIDUserLogged); } @@ -2538,12 +2541,12 @@ class Cases switch ($sTypeList) { case 'all': $c->add( - $c->getNewCriterion( - AppThreadPeer::APP_THREAD_STATUS, 'OPEN')-> - addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'COMPLETED')-> - addAnd($c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0) - ) - ) + $c->getNewCriterion( + AppThreadPeer::APP_THREAD_STATUS, 'OPEN')-> + addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'COMPLETED')-> + addAnd($c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0) + ) + ) ); $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER); break; @@ -2551,11 +2554,11 @@ class Cases $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(AppDelayPeer::APP_UID); $oCriteria->add( - $oCriteria->getNewCriterion( - AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL - )->addOr( - $oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0) - ) + $oCriteria->getNewCriterion( + AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL + )->addOr( + $oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0) + ) ); //$oCriteria->add(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL); $oDataset = AppDelayPeer::doSelectRS($oCriteria); @@ -2569,15 +2572,15 @@ class Cases $c->add($c->getNewCriterion(ApplicationPeer::APP_INIT_USER, $sUIDUserLogged)); $c->add( - $c->getNewCriterion( - AppThreadPeer::APP_THREAD_STATUS, 'OPEN' - )->addOr( $c->getNewCriterion( - ApplicationPeer::APP_STATUS, 'COMPLETED' - )->addAnd( - $c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0) + AppThreadPeer::APP_THREAD_STATUS, 'OPEN' + )->addOr( + $c->getNewCriterion( + ApplicationPeer::APP_STATUS, 'COMPLETED' + )->addAnd( + $c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0) + ) ) - ) ); $c->add($c->getNewCriterion(ApplicationPeer::APP_UID, $aProcesses, Criteria::NOT_IN)); $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER); @@ -2602,15 +2605,15 @@ class Cases $c->add(AppDelayPeer::APP_DELAY_UID, null, Criteria::ISNOTNULL); $c->add(AppDelayPeer::APP_TYPE, array("REASSIGN", "ADHOC", "CANCEL"), Criteria::NOT_IN); $c->add( - $c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)-> - addOr($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0)) + $c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)-> + addOr($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0)) ); $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER); break; case 'cancelled': $c->add( - $c->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, 'CLOSED')-> - addAnd($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'CANCELLED')) + $c->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, 'CLOSED')-> + addAnd($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'CANCELLED')) ); $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER); break; @@ -2623,9 +2626,9 @@ class Cases break; case 'gral': $c->add( - $c->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, 'OPEN')-> - addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'COMPLETED')-> - addAnd($c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0))) + $c->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, 'OPEN')-> + addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'COMPLETED')-> + addAnd($c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0))) ); $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER); $params = array(); @@ -2670,10 +2673,9 @@ class Cases $c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY); $c->addAsColumn( - 'DEL_TASK_DUE_DATE', - " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), + 'DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('', " . AppDelegationPeer::DEL_TASK_DUE_DATE . - ", ''), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") " + ", ''), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") " ); $c->addSelectColumn(AppDelegationPeer::DEL_INDEX); @@ -2722,8 +2724,8 @@ class Cases break; case 'to_reassign': $c->add( - $c->getNewCriterion(ApplicationPeer::APP_STATUS, 'TO_DO')-> - addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'DRAFT')) + $c->getNewCriterion(ApplicationPeer::APP_STATUS, 'TO_DO')-> + addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'DRAFT')) ); $c->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); $c->add(AppThreadPeer::APP_THREAD_STATUS, 'OPEN'); @@ -2734,11 +2736,11 @@ class Cases $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(AppDelayPeer::APP_UID); $oCriteria->add( - $oCriteria->getNewCriterion( - AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL - )->addOr( - $oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0) - ) + $oCriteria->getNewCriterion( + AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL + )->addOr( + $oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0) + ) ); $oDataset = AppDelayPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); @@ -2752,13 +2754,13 @@ class Cases $c->add($c->getNewCriterion(ApplicationPeer::APP_INIT_USER, $sUIDUserLogged)); } else { $c->add( - $c->getNewCriterion( - ApplicationPeer::APP_INIT_USER, $sUIDUserLogged - )->addOr( $c->getNewCriterion( - AppDelegationPeer::USR_UID, $sUIDUserLogged + ApplicationPeer::APP_INIT_USER, $sUIDUserLogged + )->addOr( + $c->getNewCriterion( + AppDelegationPeer::USR_UID, $sUIDUserLogged + ) ) - ) ); } if (isset($aAdditionalFilter) && isset($aAdditionalFilter['APP_STATUS_FILTER'])) { @@ -2768,15 +2770,15 @@ class Cases } $c->add( - $c->getNewCriterion( - AppDelegationPeer::DEL_THREAD_STATUS, 'CLOSED' - )->addOr( $c->getNewCriterion( - ApplicationPeer::APP_STATUS, 'COMPLETED' - )->addAnd( - $c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0) + AppDelegationPeer::DEL_THREAD_STATUS, 'CLOSED' + )->addOr( + $c->getNewCriterion( + ApplicationPeer::APP_STATUS, 'COMPLETED' + )->addAnd( + $c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0) + ) ) - ) ); $c->add($c->getNewCriterion(ApplicationPeer::APP_UID, $aProcesses, Criteria::NOT_IN)); $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER); @@ -2825,7 +2827,8 @@ class Cases * @param string $sUIDUserLogged * @Author Erik Amaru Ortiz * @return array - */ + */ + public function loadCaseInCurrentDelegation($APP_UID, $titles = false) { $c = new Criteria('workflow'); @@ -2836,8 +2839,7 @@ class Cases $c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY); //$c->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE); $c->addAsColumn( - 'DEL_TASK_DUE_DATE', - " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), + 'DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), " . AppDelegationPeer::DEL_TASK_DUE_DATE . " , " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") " ); @@ -2850,19 +2852,18 @@ class Cases $c->addAsColumn('APP_CURRENT_USER', "CONCAT(USERS.USR_LASTNAME, ' ', USERS.USR_FIRSTNAME)"); $c->addSelectColumn(ApplicationPeer::APP_STATUS); if ($titles) { - $c->addAsColumn('APP_TITLE', 'APP_TITLE.CON_VALUE'); - $c->addAsColumn('APP_PRO_TITLE', 'PRO_TITLE.CON_VALUE'); - $c->addAsColumn('APP_TAS_TITLE', 'TAS_TITLE.CON_VALUE'); + $c->addAsColumn('APP_TITLE', 'APP_TITLE.CON_VALUE'); + $c->addAsColumn('APP_PRO_TITLE', 'PRO_TITLE.CON_VALUE'); + $c->addAsColumn('APP_TAS_TITLE', 'TAS_TITLE.CON_VALUE'); } //$c->addAsColumn('APP_DEL_PREVIOUS_USER', 'APP_LAST_USER.USR_USERNAME'); $c->addAsColumn( - 'APP_DEL_PREVIOUS_USER', - "CONCAT(APP_LAST_USER.USR_LASTNAME, ' ', APP_LAST_USER.USR_FIRSTNAME)"); + 'APP_DEL_PREVIOUS_USER', "CONCAT(APP_LAST_USER.USR_LASTNAME, ' ', APP_LAST_USER.USR_FIRSTNAME)"); if ($titles) { - $c->addAlias("APP_TITLE", 'CONTENT'); - $c->addAlias("PRO_TITLE", 'CONTENT'); - $c->addAlias("TAS_TITLE", 'CONTENT'); + $c->addAlias("APP_TITLE", 'CONTENT'); + $c->addAlias("PRO_TITLE", 'CONTENT'); + $c->addAlias("TAS_TITLE", 'CONTENT'); } $c->addAlias("APP_PREV_DEL", 'APP_DELEGATION'); $c->addAlias("APP_LAST_USER", 'USERS'); @@ -2875,24 +2876,24 @@ class Cases $c->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN); if ($titles) { - $del = DBAdapter::getStringDelimiter(); - $appTitleConds = array(); - $appTitleConds[] = array(ApplicationPeer::APP_UID, 'APP_TITLE.CON_ID'); - $appTitleConds[] = array('APP_TITLE.CON_CATEGORY', $del . 'APP_TITLE' . $del); - $appTitleConds[] = array('APP_TITLE.CON_LANG', $del . SYS_LANG . $del); - $c->addJoinMC($appTitleConds, Criteria::LEFT_JOIN); + $del = DBAdapter::getStringDelimiter(); + $appTitleConds = array(); + $appTitleConds[] = array(ApplicationPeer::APP_UID, 'APP_TITLE.CON_ID'); + $appTitleConds[] = array('APP_TITLE.CON_CATEGORY', $del . 'APP_TITLE' . $del); + $appTitleConds[] = array('APP_TITLE.CON_LANG', $del . SYS_LANG . $del); + $c->addJoinMC($appTitleConds, Criteria::LEFT_JOIN); - $proTitleConds = array(); - $proTitleConds[] = array(ApplicationPeer::PRO_UID, 'PRO_TITLE.CON_ID'); - $proTitleConds[] = array('PRO_TITLE.CON_CATEGORY', $del . 'PRO_TITLE' . $del); - $proTitleConds[] = array('PRO_TITLE.CON_LANG', $del . SYS_LANG . $del); - $c->addJoinMC($proTitleConds, Criteria::LEFT_JOIN); + $proTitleConds = array(); + $proTitleConds[] = array(ApplicationPeer::PRO_UID, 'PRO_TITLE.CON_ID'); + $proTitleConds[] = array('PRO_TITLE.CON_CATEGORY', $del . 'PRO_TITLE' . $del); + $proTitleConds[] = array('PRO_TITLE.CON_LANG', $del . SYS_LANG . $del); + $c->addJoinMC($proTitleConds, Criteria::LEFT_JOIN); - $tasTitleConds = array(); - $tasTitleConds[] = array(AppDelegationPeer::TAS_UID, 'TAS_TITLE.CON_ID'); - $tasTitleConds[] = array('TAS_TITLE.CON_CATEGORY', $del . 'TAS_TITLE' . $del); - $tasTitleConds[] = array('TAS_TITLE.CON_LANG', $del . SYS_LANG . $del); - $c->addJoinMC($tasTitleConds, Criteria::LEFT_JOIN); + $tasTitleConds = array(); + $tasTitleConds[] = array(AppDelegationPeer::TAS_UID, 'TAS_TITLE.CON_ID'); + $tasTitleConds[] = array('TAS_TITLE.CON_CATEGORY', $del . 'TAS_TITLE' . $del); + $tasTitleConds[] = array('TAS_TITLE.CON_LANG', $del . SYS_LANG . $del); + $c->addJoinMC($tasTitleConds, Criteria::LEFT_JOIN); } $prevConds = array(); @@ -2928,7 +2929,7 @@ class Cases * @param string $delIndex * @author gustavo cruz * @return array - */ + */ public function loadCaseByDelegation($appUid, $delIndex) { $c = new Criteria('workflow'); @@ -2939,8 +2940,7 @@ class Cases $c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY); //$c->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE); $c->addAsColumn( - 'DEL_TASK_DUE_DATE', - " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), " . AppDelegationPeer::DEL_TASK_DUE_DATE . " , + 'DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), " . AppDelegationPeer::DEL_TASK_DUE_DATE . " , " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") " ); @@ -2956,8 +2956,7 @@ class Cases $c->addAsColumn('APP_TAS_TITLE', 'TAS_TITLE.CON_VALUE'); //$c->addAsColumn('APP_DEL_PREVIOUS_USER', 'APP_LAST_USER.USR_USERNAME'); $c->addAsColumn( - 'APP_DEL_PREVIOUS_USER', - "CONCAT(APP_LAST_USER.USR_LASTNAME, ' ', APP_LAST_USER.USR_FIRSTNAME)"); + 'APP_DEL_PREVIOUS_USER', "CONCAT(APP_LAST_USER.USR_LASTNAME, ' ', APP_LAST_USER.USR_FIRSTNAME)"); $c->addAlias("APP_TITLE", 'CONTENT'); $c->addAlias("PRO_TITLE", 'CONTENT'); @@ -3024,21 +3023,21 @@ class Cases * Description: This method set all cases with the APP_DISABLE_ACTION_DATE for today * @return void */ - public function ThrowUnpauseDaemon($today, $cron=0) + public function ThrowUnpauseDaemon($today, $cron = 0) { - $today = ($today==date('Y-m-d'))?date('Y-m-d'):$today; + $today = ($today == date('Y-m-d')) ? date('Y-m-d') : $today; $c = new Criteria('workflow'); $c->clearSelectColumns(); $c->add( - $c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)-> - addOr($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0) - ) + $c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)-> + addOr($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0) + ) ); $c->add( - $c->getNewCriterion( - AppDelayPeer::APP_DISABLE_ACTION_DATE, $today . ' 23:59:59', Criteria::LESS_EQUAL)-> - addAnd($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_DATE, null, Criteria::ISNOTNULL) - ) + $c->getNewCriterion( + AppDelayPeer::APP_DISABLE_ACTION_DATE, $today . ' 23:59:59', Criteria::LESS_EQUAL)-> + addAnd($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_DATE, null, Criteria::ISNOTNULL) + ) ); $d = AppDelayPeer::doSelectRS($c); $d->setFetchmode(ResultSet::FETCHMODE_ASSOC); @@ -3062,19 +3061,20 @@ class Cases * @name UnpauseRoutedCasesWithPauseFlagEnabled * @param string $usrLogged * @return void - */ + */ + public function UnpauseRoutedCasesWithPauseFlagEnabled($usrLogged) { $c = new Criteria(); $c->clearSelectColumns(); $c->addSelectColumn(AppDelayPeer::APP_DELAY_UID); $c->add( - $c->getNewCriterion( - AppDelayPeer::APP_DELEGATION_USER, $usrLogged, Criteria::EQUAL)-> - addAnd($c->getNewCriterion(AppDelegationPeer::DEL_THREAD_STATUS, 'CLOSED', Criteria::EQUAL))-> - addAnd($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)-> - addOr($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0)) - ) + $c->getNewCriterion( + AppDelayPeer::APP_DELEGATION_USER, $usrLogged, Criteria::EQUAL)-> + addAnd($c->getNewCriterion(AppDelegationPeer::DEL_THREAD_STATUS, 'CLOSED', Criteria::EQUAL))-> + addAnd($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)-> + addOr($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0)) + ) ); $aConditions = array(); $aConditions[] = array(AppDelayPeer::APP_UID, AppDelegationPeer::APP_UID); @@ -3092,7 +3092,7 @@ class Cases $c2 = new Criteria('workflow'); $c2->add(AppDelayPeer::APP_DISABLE_ACTION_USER, $usrLogged); $c2->add(AppDelayPeer::APP_DISABLE_ACTION_DATE, date('Y-m-d')); - BasePeer::doUpdate($c1, $c2,$con); + BasePeer::doUpdate($c1, $c2, $con); } } } @@ -3103,7 +3103,8 @@ class Cases * @name getApplicationUIDByNumber * @param integer $iApplicationNumber * @return string - */ + */ + public function getApplicationUIDByNumber($iApplicationNumber) { $oCriteria = new Criteria(); @@ -3122,7 +3123,8 @@ class Cases * @param string $sApplicationUID * @param string $sUserUID * @return integer - */ + */ + public function getCurrentDelegation($sApplicationUID = '', $sUserUID = '') { $oCriteria = new Criteria(); @@ -3154,7 +3156,8 @@ class Cases * @param array $sStepUidObj * @param string $sTriggerType * @return integer - */ + */ + public function loadTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType) { $aTriggers = array(); @@ -3205,7 +3208,8 @@ class Cases * @param string $sTriggerType * @param array $aFields * @return integer - */ + */ + public function executeTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType, $aFields = array()) { $aTriggers = $this->loadTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType); @@ -3235,7 +3239,8 @@ class Cases * @name getTriggerNames * @param string $triggers * @return integer - */ + */ + public function getTriggerNames($triggers) { $triggers_info = Array(); @@ -3264,7 +3269,7 @@ class Cases if (isset($info[$val['TRI_UID']])) { $triggers_info[] = $info[$val['TRI_UID']]; } else { - $triggers_info[] = Content::load ( 'TRI_TITLE', '', $val['TRI_UID'], $lang ); + $triggers_info[] = Content::load('TRI_TITLE', '', $val['TRI_UID'], $lang); } } return $triggers_info; @@ -3279,16 +3284,13 @@ class Cases * @param string $sDocumentUID * @param string $sAppDocuUID * @return object - */ + */ + public function getInputDocumentsCriteria($sApplicationUID, $iDelegation, $sDocumentUID, $sAppDocuUID = '') { try { $deletePermission = $this->getAllObjectsFrom( - $_SESSION['PROCESS'], - $sApplicationUID, - $_SESSION['TASK'], - $_SESSION['USER_LOGGED'], - $ACTION = 'DELETE' + $_SESSION['PROCESS'], $sApplicationUID, $_SESSION['TASK'], $_SESSION['USER_LOGGED'], $ACTION = 'DELETE' ); $listing = false; $oPluginRegistry = & PMPluginRegistry::getSingleton(); @@ -3373,7 +3375,7 @@ class Cases $aFields['DOC_VERSION_LABEL'] = $aRow['DOC_VERSION']; $aFields['DOWNLOAD_LABEL'] = G::LoadTranslation('ID_DOWNLOAD'); $aFields['DOWNLOAD_LINK'] = "cases_ShowDocument?a=" . - $aRow['APP_DOC_UID'] . "&v=" . $aRow['DOC_VERSION']; + $aRow['APP_DOC_UID'] . "&v=" . $aRow['DOC_VERSION']; if (is_array($listing)) { foreach ($listing as $folderitem) { @@ -3410,7 +3412,8 @@ class Cases * @name getInputDocumentsCriteriaToRevise * @param string $sApplicationUID * @return object - */ + */ + public function getInputDocumentsCriteriaToRevise($sApplicationUID) { try { @@ -3488,22 +3491,8 @@ class Cases * @param string $fileTmpName File temporal name ($_FILES["form"]["tmp_name"]["APP_DOC_FILENAME"] or null) * @return string Return application document ID */ - public function addInputDocument( - $inputDocumentUid, - $appDocUid, - $docVersion, - $appDocType, - $appDocComment, - $inputDocumentAction, - $applicationUid, - $delIndex, - $taskUid, - $userUid, - $option, - $file, - $fileError = 0, - $fileTmpName = null - ) { + public function addInputDocument($inputDocumentUid, $appDocUid, $docVersion, $appDocType, $appDocComment, $inputDocumentAction, $applicationUid, $delIndex, $taskUid, $userUid, $option, $file, $fileError = 0, $fileTmpName = null) + { $appDocFileName = null; $sw = 0; @@ -3546,17 +3535,17 @@ class Cases //Replace $arrayField = array( "APP_DOC_UID" => $appDocUid, - "APP_UID" => $applicationUid, + "APP_UID" => $applicationUid, "DOC_VERSION" => $docVersion, "DEL_INDEX" => $delIndex, - "USR_UID" => $userUid, - "DOC_UID" => $inputDocumentUid, - "APP_DOC_TYPE" => $appDocType, + "USR_UID" => $userUid, + "DOC_UID" => $inputDocumentUid, + "APP_DOC_TYPE" => $appDocType, "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"), - "APP_DOC_COMMENT" => $appDocComment, - "APP_DOC_TITLE" => "", + "APP_DOC_COMMENT" => $appDocComment, + "APP_DOC_TITLE" => "", "APP_DOC_FILENAME" => $appDocFileName, - "FOLDER_UID" => $folderId, + "FOLDER_UID" => $folderId, "APP_DOC_TAGS" => $tags ); @@ -3566,16 +3555,16 @@ class Cases //New Version $arrayField = array( "APP_DOC_UID" => $appDocUid, - "APP_UID" => $applicationUid, - "DEL_INDEX" => $delIndex, + "APP_UID" => $applicationUid, + "DEL_INDEX" => $delIndex, "USR_UID" => $userUid, "DOC_UID" => $inputDocumentUid, - "APP_DOC_TYPE" => $appDocType, + "APP_DOC_TYPE" => $appDocType, "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"), - "APP_DOC_COMMENT" => $appDocComment, - "APP_DOC_TITLE" => "", + "APP_DOC_COMMENT" => $appDocComment, + "APP_DOC_TITLE" => "", "APP_DOC_FILENAME" => $appDocFileName, - "FOLDER_UID" => $folderId, + "FOLDER_UID" => $folderId, "APP_DOC_TAGS" => $tags ); @@ -3584,16 +3573,16 @@ class Cases default: //New $arrayField = array( - "APP_UID" => $applicationUid, + "APP_UID" => $applicationUid, "DEL_INDEX" => $delIndex, "USR_UID" => $userUid, "DOC_UID" => $inputDocumentUid, - "APP_DOC_TYPE" => $appDocType, + "APP_DOC_TYPE" => $appDocType, "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"), - "APP_DOC_COMMENT" => $appDocComment, - "APP_DOC_TITLE" => "", + "APP_DOC_COMMENT" => $appDocComment, + "APP_DOC_TITLE" => "", "APP_DOC_FILENAME" => $appDocFileName, - "FOLDER_UID" => $folderId, + "FOLDER_UID" => $folderId, "APP_DOC_TAGS" => $tags ); @@ -3605,7 +3594,7 @@ class Cases $appDocUid = $appDocument->getAppDocUid(); $docVersion = $appDocument->getDocVersion(); $arrayInfo = pathinfo($appDocument->getAppDocFilename()); - $extension = (isset($arrayInfo["extension"]))? $arrayInfo["extension"] : null; + $extension = (isset($arrayInfo["extension"])) ? $arrayInfo["extension"] : null; $strPathName = PATH_DOCUMENT . $applicationUid . PATH_SEP; $strFileName = $appDocUid . "_" . $docVersion . "." . $extension; @@ -3632,12 +3621,12 @@ class Cases if ($pluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists("uploadDocumentData")) { $triggerDetail = $pluginRegistry->getTriggerInfo(PM_UPLOAD_DOCUMENT); $documentData = new uploadDocumentData( - $applicationUid, - $userUid, - $strPathName . $strFileName, - $arrayField["APP_DOC_FILENAME"], - $appDocUid, - $docVersion + $applicationUid, + $userUid, + $strPathName . $strFileName, + $arrayField["APP_DOC_FILENAME"], + $appDocUid, + $docVersion ); $uploadReturn = $pluginRegistry->executeTriggers(PM_UPLOAD_DOCUMENT, $documentData); @@ -3668,7 +3657,8 @@ class Cases * @name getInputDocumentsCriteriaToRevise * @param string $sApplicationUID * @return object - */ + */ + public function getOutputDocumentsCriteriaToRevise($sApplicationUID) { try { @@ -3728,7 +3718,8 @@ class Cases * @param string $status * @param string $PRO_UID * @return object - */ + */ + public function getCriteriaProcessCases($status, $PRO_UID) { $c = new Criteria('workflow'); @@ -3746,7 +3737,8 @@ class Cases * @param string $sUserUID * @param string $sUnpauseDate * @return object - */ + */ + public function pauseCase($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate = null) { $this->CloseCurrentDelegation($sApplicationUID, $iDelegation); @@ -3796,7 +3788,8 @@ class Cases * @param string $iDelegation * @param string $sUserUID * @return object - */ + */ + public function unpauseCase($sApplicationUID, $iDelegation, $sUserUID) { //get information about current $iDelegation row @@ -3832,10 +3825,10 @@ class Cases $oCriteria->add(AppDelayPeer::APP_DEL_INDEX, $iDelegation); $oCriteria->add(AppDelayPeer::APP_TYPE, 'PAUSE'); $oCriteria->add( - $oCriteria->getNewCriterion( - AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)-> - addOr($oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0)) - ); + $oCriteria->getNewCriterion( + AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)-> + addOr($oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0)) + ); $oDataset = AppDelayPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); @@ -3875,7 +3868,8 @@ class Cases * @param string $iIndex * @param string $user_logged * @return void - */ + */ + public function cancelCase($sApplicationUID, $iIndex, $user_logged) { $this->getExecuteTriggerProcess($sApplicationUID, 'CANCELED'); @@ -3951,12 +3945,13 @@ class Cases * @param string $iIndex * @param string $user_logged * @return void - */ + */ + public function reactivateCase($sApplicationUID, $iIndex, $user_logged) { $oApplication = new Application(); $aFields = $oApplication->load( - (isset($_POST['sApplicationUID']) ? $_POST['sApplicationUID'] : $_SESSION['APPLICATION']) + (isset($_POST['sApplicationUID']) ? $_POST['sApplicationUID'] : $_SESSION['APPLICATION']) ); $aFields['APP_STATUS'] = 'TO_DO'; $oApplication->update($aFields); @@ -3987,7 +3982,7 @@ class Cases //$this->ReactivateCurrentDelegation($sApplicationUID); $con = Propel::getConnection('workflow'); $sql = "UPDATE APP_THREAD SET APP_THREAD_STATUS = 'OPEN' WHERE APP_UID = '$sApplicationUID' " . - " AND DEL_INDEX ='$iIndex' "; + " AND DEL_INDEX ='$iIndex' "; $stmt = $con->createStatement(); $rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC); @@ -4007,18 +4002,15 @@ class Cases * @param string $newUserUID * @param string $sType * @return true - */ + */ + public function reassignCase($sApplicationUID, $iDelegation, $sUserUID, $newUserUID, $sType = 'REASSIGN') { $this->CloseCurrentDelegation($sApplicationUID, $iDelegation); $oAppDelegation = new AppDelegation(); $aFieldsDel = $oAppDelegation->Load($sApplicationUID, $iDelegation); $iIndex = $oAppDelegation->createAppDelegation( - $aFieldsDel['PRO_UID'], - $aFieldsDel['APP_UID'], - $aFieldsDel['TAS_UID'], - $aFieldsDel['USR_UID'], - $aFieldsDel['DEL_THREAD'] + $aFieldsDel['PRO_UID'], $aFieldsDel['APP_UID'], $aFieldsDel['TAS_UID'], $aFieldsDel['USR_UID'], $aFieldsDel['DEL_THREAD'] ); $aData = array(); $aData['APP_UID'] = $aFieldsDel['APP_UID']; @@ -4033,11 +4025,11 @@ class Cases $oAppDelegation->update($aData); $oAppThread = new AppThread(); $oAppThread->update( - array( - 'APP_UID' => $sApplicationUID, - 'APP_THREAD_INDEX' => $aFieldsDel['DEL_THREAD'], - 'DEL_INDEX' => $iIndex) - ); + array( + 'APP_UID' => $sApplicationUID, + 'APP_THREAD_INDEX' => $aFieldsDel['DEL_THREAD'], + 'DEL_INDEX' => $iIndex) + ); //Save in APP_DELAY $oApplication = new Application(); @@ -4069,7 +4061,8 @@ class Cases * @name getAllDynaformsStepsToRevise * @param string $APP_UID * @return object - */ + */ + public function getAllDynaformsStepsToRevise($APP_UID) { $aCase = $this->loadCase($APP_UID); @@ -4093,7 +4086,8 @@ class Cases * @name getAllInputsStepsToRevise * @param string $APP_UID * @return object - */ + */ + public function getAllInputsStepsToRevise($APP_UID) { $aCase = $this->loadCase($APP_UID); @@ -4117,7 +4111,8 @@ class Cases * @name getAllUploadedDocumentsCriteria * @param string $APP_UID * @return object - */ + */ + public function getAllUploadedDocumentsCriteria($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID) { //verifica si existe la tabla OBJECT_PERMISSION @@ -4171,10 +4166,10 @@ class Cases $oCriteria->add(AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), Criteria::IN); //$oCriteria->add(AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], Criteria::IN); $oCriteria->add( - $oCriteria->getNewCriterion( - AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], Criteria::IN)-> - addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, array($sUserUID, '-1'), Criteria::IN)) - ); + $oCriteria->getNewCriterion( + AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], Criteria::IN)-> + addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, array($sUserUID, '-1'), Criteria::IN)) + ); $aConditions = array(); $aConditions[] = array(AppDocumentPeer::APP_UID, AppDelegationPeer::APP_UID); @@ -4263,12 +4258,10 @@ class Cases $oCriteria->add(AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), Criteria::IN); $oCriteria->add( - $oCriteria->getNewCriterion( - AppDocumentPeer::APP_DOC_UID, - $aObjectPermissions['INPUT_DOCUMENTS'], - Criteria::IN - )-> - addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, array($sUserUID, '-1'), Criteria::IN))); + $oCriteria->getNewCriterion( + AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], Criteria::IN + )-> + addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, array($sUserUID, '-1'), Criteria::IN))); $aConditions = array(); $aConditions[] = array(AppDocumentPeer::APP_UID, AppDelegationPeer::APP_UID); @@ -4341,12 +4334,10 @@ class Cases $oCriteria->add(AppDocumentPeer::DEL_INDEX, 100000); $oCriteria->add( - $oCriteria->getNewCriterion( - AppDocumentPeer::APP_DOC_UID, - $aObjectPermissions['INPUT_DOCUMENTS'], - Criteria::IN - )-> - addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, array($sUserUID, '-1'), Criteria::IN))); + $oCriteria->getNewCriterion( + AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], Criteria::IN + )-> + addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, array($sUserUID, '-1'), Criteria::IN))); $oCriteria->addJoin(AppDocumentPeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN); $oCriteria->add(ApplicationPeer::PRO_UID, $sProcessUID); @@ -4425,12 +4416,13 @@ class Cases * @param string $sTasKUID * @param string $sUserUID * @return object - */ + */ + public function getAllGeneratedDocumentsCriteria($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID) { //verifica si la tabla OBJECT_PERMISSION $this->verifyTable(); - $listing = false; + $listing = false; $oPluginRegistry = & PMPluginRegistry::getSingleton(); if ($oPluginRegistry->existsTrigger(PM_CASE_DOCUMENT_LIST)) { $folderData = new folderData(null, null, $sApplicationUID, null, $sUserUID); @@ -4477,10 +4469,9 @@ class Cases $oCriteria->add(AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), Criteria::IN); //$oCriteria->add(AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['OUTPUT_DOCUMENTS'], Criteria::IN); $oCriteria->add( - $oCriteria->getNewCriterion( - AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['OUTPUT_DOCUMENTS'], - Criteria::IN)->addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, $sUserUID, Criteria::EQUAL)) - ); + $oCriteria->getNewCriterion( + AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['OUTPUT_DOCUMENTS'], Criteria::IN)->addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, $sUserUID, Criteria::EQUAL)) + ); $aConditions = array(); $aConditions[] = array(AppDocumentPeer::APP_UID, AppDelegationPeer::APP_UID); @@ -4529,7 +4520,7 @@ class Cases $fileDoc = 'javascript:alert("NO DOC")'; $fileDocLabel = " "; $filePdf = 'cases_ShowOutputDocument?a=' . - $aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=pdf&random=' . rand(); + $aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=pdf&random=' . rand(); $filePdfLabel = ".pdf"; if (is_array($listing)) { foreach ($listing as $folderitem) { @@ -4543,7 +4534,7 @@ class Cases break; case "DOC": $fileDoc = 'cases_ShowOutputDocument?a=' . - $aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=doc&random=' . rand(); + $aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=doc&random=' . rand(); $fileDocLabel = ".doc"; $filePdf = 'javascript:alert("NO PDF")'; $filePdfLabel = " "; @@ -4559,7 +4550,7 @@ class Cases break; case "BOTH": $fileDoc = 'cases_ShowOutputDocument?a=' . - $aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=doc&random=' . rand(); + $aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=doc&random=' . rand(); $fileDocLabel = ".doc"; if (is_array($listing)) { foreach ($listing as $folderitem) { @@ -4571,7 +4562,7 @@ class Cases } } $filePdf = 'cases_ShowOutputDocument?a=' . - $aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=pdf&random=' . rand(); + $aRow['APP_DOC_UID'] . '&v=' . $aRow['DOC_VERSION'] . '&ext=pdf&random=' . rand(); $filePdfLabel = ".pdf"; if (is_array($listing)) { @@ -4619,10 +4610,10 @@ class Cases 'DOWNLOAD_FILE' => $aAux['APP_DOC_FILENAME'] . $firstDocLabel ); - if (trim($fileDocLabel)!='') { + if (trim($fileDocLabel) != '') { $aFields['FILEDOCLABEL'] = $fileDocLabel; } - if (trim($filePdfLabel)!='') { + if (trim($filePdfLabel) != '') { $aFields['FILEPDFLABEL'] = $filePdfLabel; } if ($aFields['APP_DOC_FILENAME'] != '') { @@ -4660,7 +4651,8 @@ class Cases * @param string $sTasKUID * @param string $sUserUID * @return object - */ + */ + public function getallDynaformsCriteria($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID) { //check OBJECT_PERMISSION table @@ -4742,10 +4734,10 @@ class Cases $distinctOriginalPush = 1; foreach ($distinctOriginal as $distinctOriginalKey => $distinctOriginalValue) { if ($distinctArrayValue == $distinctOriginalValue) { - $distinctOriginalPush=0; + $distinctOriginalPush = 0; } } - if ($distinctOriginalPush==1) { + if ($distinctOriginalPush == 1) { $distinctOriginal[] = $distinctArrayValue; } } @@ -4773,8 +4765,9 @@ class Cases * @param string $iDelegation * @param string $sFrom * @return void - */ - public function sendNotifications($sCurrentTask, $aTasks, $aFields, $sApplicationUID, $iDelegation, $sFrom="") + */ + + public function sendNotifications($sCurrentTask, $aTasks, $aFields, $sApplicationUID, $iDelegation, $sFrom = "") { try { $applicationData = $this->loadCase($sApplicationUID); @@ -4805,14 +4798,14 @@ class Cases $passwd = $aConfiguration["MESS_PASSWORD"]; $passwdDec = G::decrypt($passwd, "EMAILENCRYPT"); $auxPass = explode('hash:', $passwdDec); - if (count($auxPass) > 1) { + if (count($auxPass) > 1) { if (count($auxPass) == 2) { $passwd = $auxPass[1]; } else { array_shift($auxPass); $passwd = implode('', $auxPass); } - } + } $aConfiguration["MESS_PASSWORD"] = $passwd; } else { $aConfiguration = array(); @@ -4832,29 +4825,29 @@ class Cases } if ($sFrom == '') { - $sFrom = '"ProcessMaker"'; + $sFrom = '"ProcessMaker"'; } $hasEmailFrom = preg_match('/(.+)@(.+)\.(.+)/', $sFrom, $match); if (!$hasEmailFrom || strpos($sFrom, $aConfiguration['MESS_ACCOUNT']) === false) { - if (($aConfiguration['MESS_ENGINE'] != 'MAIL') && ($aConfiguration['MESS_ACCOUNT'] != '')) { - $sFrom .= ' <' . $aConfiguration['MESS_ACCOUNT'] . '>'; - } else { - if (($aConfiguration['MESS_ENGINE'] == 'MAIL')) { - $sFrom .= ' '; + if (($aConfiguration['MESS_ENGINE'] != 'MAIL') && ($aConfiguration['MESS_ACCOUNT'] != '')) { + $sFrom .= ' <' . $aConfiguration['MESS_ACCOUNT'] . '>'; } else { - if ($aConfiguration['MESS_SERVER'] != '') { - if (($sAux = @gethostbyaddr($aConfiguration['MESS_SERVER']))) { - $sFrom .= ' '; + if (($aConfiguration['MESS_ENGINE'] == 'MAIL')) { + $sFrom .= ' '; } else { - $sFrom .= ' '; + if ($aConfiguration['MESS_SERVER'] != '') { + if (($sAux = @gethostbyaddr($aConfiguration['MESS_SERVER']))) { + $sFrom .= ' '; + } else { + $sFrom .= ' '; + } + } else { + $sFrom .= ' '; + } } - } else { - $sFrom .= ' '; - } } - } } if (isset($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE']) && $aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'] != '') { @@ -4869,14 +4862,14 @@ class Cases $oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aTaskInfo['TAS_UID'], '', ''); $conf = $oConf->aConfig; - $pathEmail = PATH_DATA_SITE . "mailTemplates" . PATH_SEP . $aTaskInfo["PRO_UID"] . PATH_SEP; + $pathEmail = PATH_DATA_SITE . "mailTemplates" . PATH_SEP . $aTaskInfo["PRO_UID"] . PATH_SEP; $swtplDefault = 0; $sBody = null; if (isset($conf["TAS_DEF_MESSAGE_TYPE"]) && - isset($conf["TAS_DEF_MESSAGE_TEMPLATE"]) && - $conf["TAS_DEF_MESSAGE_TYPE"] == "template" && - $conf["TAS_DEF_MESSAGE_TEMPLATE"] != "" + isset($conf["TAS_DEF_MESSAGE_TEMPLATE"]) && + $conf["TAS_DEF_MESSAGE_TYPE"] == "template" && + $conf["TAS_DEF_MESSAGE_TEMPLATE"] != "" ) { if ($conf["TAS_DEF_MESSAGE_TEMPLATE"] == "alert_message.html") { $swtplDefault = 1; @@ -4897,7 +4890,7 @@ class Cases G::LoadClass("groups"); G::LoadClass("spool"); - $task = new Tasks(); + $task = new Tasks(); $group = new Groups(); $oUser = new Users(); @@ -4956,15 +4949,15 @@ class Cases $row = $rsCriteria->getRow(); $toAux = ( - (($row["USR_FIRSTNAME"] != "") || ($row["USR_LASTNAME"] != ""))? - $row["USR_FIRSTNAME"] . " " . $row["USR_LASTNAME"] . " " : "" - ) . "<" . $row["USR_EMAIL"] . ">"; + (($row["USR_FIRSTNAME"] != "") || ($row["USR_LASTNAME"] != "")) ? + $row["USR_FIRSTNAME"] . " " . $row["USR_LASTNAME"] . " " : "" + ) . "<" . $row["USR_EMAIL"] . ">"; if ($sw == 1) { $to = $toAux; $sw = 0; } else { - $cc = $cc . (($cc != null)? "," : null) . $toAux; + $cc = $cc . (($cc != null) ? "," : null) . $toAux; } } @@ -4977,9 +4970,9 @@ class Cases $aUser = $oUser->load($aTask["USR_UID"]); $sTo = ( - (($aUser["USR_FIRSTNAME"] != "") || ($aUser["USR_LASTNAME"] != ""))? - $aUser["USR_FIRSTNAME"] . " " . $aUser["USR_LASTNAME"] . " " : "" - ) . "<" . $aUser["USR_EMAIL"] . ">"; + (($aUser["USR_FIRSTNAME"] != "") || ($aUser["USR_LASTNAME"] != "")) ? + $aUser["USR_FIRSTNAME"] . " " . $aUser["USR_LASTNAME"] . " " : "" + ) . "<" . $aUser["USR_EMAIL"] . ">"; } break; } @@ -4993,33 +4986,33 @@ class Cases } $oSpool->setConfig(array( - "MESS_ENGINE" => $aConfiguration["MESS_ENGINE"], - "MESS_SERVER" => $aConfiguration["MESS_SERVER"], - "MESS_PORT" => $aConfiguration["MESS_PORT"], - "MESS_ACCOUNT" => $aConfiguration["MESS_ACCOUNT"], + "MESS_ENGINE" => $aConfiguration["MESS_ENGINE"], + "MESS_SERVER" => $aConfiguration["MESS_SERVER"], + "MESS_PORT" => $aConfiguration["MESS_PORT"], + "MESS_ACCOUNT" => $aConfiguration["MESS_ACCOUNT"], "MESS_PASSWORD" => $aConfiguration["MESS_PASSWORD"], - "SMTPAuth" => ($aConfiguration["MESS_RAUTH"] == "1")? true : false, - "SMTPSecure" => (isset($aConfiguration["SMTPSecure"]))? $aConfiguration["SMTPSecure"] : "" + "SMTPAuth" => ($aConfiguration["MESS_RAUTH"] == "1") ? true : false, + "SMTPSecure" => (isset($aConfiguration["SMTPSecure"])) ? $aConfiguration["SMTPSecure"] : "" )); $oSpool->create(array( - "msg_uid" => "", - "app_uid" => $sApplicationUID, + "msg_uid" => "", + "app_uid" => $sApplicationUID, "del_index" => $iDelegation, - "app_msg_type" => "DERIVATION", + "app_msg_type" => "DERIVATION", "app_msg_subject" => $sSubject, - "app_msg_from" => $sFrom, - "app_msg_to" => $sTo, + "app_msg_from" => $sFrom, + "app_msg_to" => $sTo, "app_msg_body" => $sBody, - "app_msg_cc" => $sCc, - "app_msg_bcc" => "", - "app_msg_attach" => "", + "app_msg_cc" => $sCc, + "app_msg_bcc" => "", + "app_msg_attach" => "", "app_msg_template" => "", - "app_msg_status" => "pending" + "app_msg_status" => "pending" )); if (($aConfiguration["MESS_BACKGROUND"] == "") || - ($aConfiguration["MESS_TRY_SEND_INMEDIATLY"] == "1") + ($aConfiguration["MESS_TRY_SEND_INMEDIATLY"] == "1") ) { $oSpool->sendMail(); } @@ -5039,10 +5032,10 @@ class Cases * @access public * @param Process ID, Application ID, Task ID and User ID * @return Array within all user permitions all objects' types - */ + */ public function getAllObjects($PRO_UID, $APP_UID, $TAS_UID = '', $USR_UID = '') { - $ACTIONS = Array('VIEW', 'BLOCK','DELETE'); //TO COMPLETE + $ACTIONS = Array('VIEW', 'BLOCK', 'DELETE'); //TO COMPLETE $MAIN_OBJECTS = Array(); $RESULT_OBJECTS = Array(); @@ -5050,19 +5043,18 @@ class Cases $MAIN_OBJECTS[$action] = $this->getAllObjectsFrom($PRO_UID, $APP_UID, $TAS_UID, $USR_UID, $action); } /* ADDITIONAL OPERATIONS */ - /* * * BETWEN VIEW AND BLOCK** */ + /* * * BETWEN VIEW AND BLOCK** */ $RESULT_OBJECTS['DYNAFORMS'] = G::arrayDiff( - $MAIN_OBJECTS['VIEW']['DYNAFORMS'], $MAIN_OBJECTS['BLOCK']['DYNAFORMS'] + $MAIN_OBJECTS['VIEW']['DYNAFORMS'], $MAIN_OBJECTS['BLOCK']['DYNAFORMS'] ); $RESULT_OBJECTS['INPUT_DOCUMENTS'] = G::arrayDiff( - $MAIN_OBJECTS['VIEW']['INPUT_DOCUMENTS'], $MAIN_OBJECTS['BLOCK']['INPUT_DOCUMENTS'] + $MAIN_OBJECTS['VIEW']['INPUT_DOCUMENTS'], $MAIN_OBJECTS['BLOCK']['INPUT_DOCUMENTS'] ); $RESULT_OBJECTS['OUTPUT_DOCUMENTS'] = array_merge_recursive( - G::arrayDiff($MAIN_OBJECTS['VIEW']['OUTPUT_DOCUMENTS'],$MAIN_OBJECTS['BLOCK']['OUTPUT_DOCUMENTS']), - G::arrayDiff($MAIN_OBJECTS['DELETE']['OUTPUT_DOCUMENTS'],$MAIN_OBJECTS['BLOCK']['OUTPUT_DOCUMENTS']) + G::arrayDiff($MAIN_OBJECTS['VIEW']['OUTPUT_DOCUMENTS'], $MAIN_OBJECTS['BLOCK']['OUTPUT_DOCUMENTS']), G::arrayDiff($MAIN_OBJECTS['DELETE']['OUTPUT_DOCUMENTS'], $MAIN_OBJECTS['BLOCK']['OUTPUT_DOCUMENTS']) ); $RESULT_OBJECTS['CASES_NOTES'] = G::arrayDiff( - $MAIN_OBJECTS['VIEW']['CASES_NOTES'], $MAIN_OBJECTS['BLOCK']['CASES_NOTES'] + $MAIN_OBJECTS['VIEW']['CASES_NOTES'], $MAIN_OBJECTS['BLOCK']['CASES_NOTES'] ); array_push($RESULT_OBJECTS['DYNAFORMS'], -1); array_push($RESULT_OBJECTS['INPUT_DOCUMENTS'], -1); @@ -5080,7 +5072,7 @@ class Cases * @access public * @param Process ID, Application ID, Task ID, User ID, Action * @return Array within all user permitions all objects' types - */ + */ public function getAllObjectsFrom($PRO_UID, $APP_UID, $TAS_UID = '', $USR_UID = '', $ACTION = '') { $aCase = $this->loadCase($APP_UID); @@ -5091,37 +5083,37 @@ class Cases //permissions per user $oCriteria = new Criteria('workflow'); $oCriteria->add( - $oCriteria->getNewCriterion(ObjectPermissionPeer::USR_UID, $USR_UID)->addOr( - $oCriteria->getNewCriterion(ObjectPermissionPeer::USR_UID, '')->addOr( - $oCriteria->getNewCriterion(ObjectPermissionPeer::USR_UID, '0') - ) - ) + $oCriteria->getNewCriterion(ObjectPermissionPeer::USR_UID, $USR_UID)->addOr( + $oCriteria->getNewCriterion(ObjectPermissionPeer::USR_UID, '')->addOr( + $oCriteria->getNewCriterion(ObjectPermissionPeer::USR_UID, '0') + ) + ) ); $oCriteria->add(ObjectPermissionPeer::PRO_UID, $PRO_UID); $oCriteria->add(ObjectPermissionPeer::OP_ACTION, $ACTION); $oCriteria->add( - $oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, $TAS_UID)->addOr( - $oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, '')->addOr( - $oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, '0') - ) - ) + $oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, $TAS_UID)->addOr( + $oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, '')->addOr( + $oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, '0') + ) + ) ); $oCriteria->add( - $oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, 'ALL')->addOr( - $oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, '')->addOr( - $oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, '0') - ) - ) + $oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, 'ALL')->addOr( + $oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, '')->addOr( + $oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, '0') + ) + ) ); $rs = ObjectPermissionPeer::doSelectRS($oCriteria); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); while ($row = $rs->getRow()) { if ( - (($aCase['APP_STATUS'] == $row['OP_CASE_STATUS']) || - ($row['OP_CASE_STATUS'] == '') || - ($row['OP_CASE_STATUS'] == 'ALL')) || - ($row['OP_CASE_STATUS'] == '')) { + (($aCase['APP_STATUS'] == $row['OP_CASE_STATUS']) || + ($row['OP_CASE_STATUS'] == '') || + ($row['OP_CASE_STATUS'] == 'ALL')) || + ($row['OP_CASE_STATUS'] == '')) { array_push($USER_PERMISSIONS, $row); } $rs->next(); @@ -5136,18 +5128,18 @@ class Cases $oCriteria->add(ObjectPermissionPeer::PRO_UID, $PRO_UID); $oCriteria->add(ObjectPermissionPeer::OP_ACTION, $ACTION); $oCriteria->add( - $oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, $TAS_UID)->addOr( - $oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, '')->addOr( - $oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, '0') - ) - ) + $oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, $TAS_UID)->addOr( + $oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, '')->addOr( + $oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, '0') + ) + ) ); $oCriteria->add( - $oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, 'ALL')->addOr( - $oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, '')->addOr( - $oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, '0') - ) - ) + $oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, 'ALL')->addOr( + $oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, '')->addOr( + $oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, '0') + ) + ) ); $rs = ObjectPermissionPeer::doSelectRS($oCriteria); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); @@ -5219,10 +5211,10 @@ class Cases } } $oCriteria->add( - $oCriteria->getNewCriterion(AppDocumentPeer::APP_DOC_TYPE, 'INPUT')-> - addOr($oCriteria->getNewCriterion(AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT'))-> - addOr($oCriteria-> - getNewCriterion(AppDocumentPeer::APP_DOC_TYPE, 'ATTACHED')) + $oCriteria->getNewCriterion(AppDocumentPeer::APP_DOC_TYPE, 'INPUT')-> + addOr($oCriteria->getNewCriterion(AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT'))-> + addOr($oCriteria-> + getNewCriterion(AppDocumentPeer::APP_DOC_TYPE, 'ATTACHED')) ); $aConditions = Array(); $aConditions[] = array(AppDelegationPeer::APP_UID, AppDocumentPeer::APP_UID); @@ -5293,8 +5285,8 @@ class Cases } if ($obj_type == 'INPUT') { $oCriteria->add( - $oCriteria->getNewCriterion(AppDocumentPeer::APP_DOC_TYPE, $obj_type)-> - addOr($oCriteria->getNewCriterion(AppDocumentPeer::APP_DOC_TYPE, 'ATTACHED')) + $oCriteria->getNewCriterion(AppDocumentPeer::APP_DOC_TYPE, $obj_type)-> + addOr($oCriteria->getNewCriterion(AppDocumentPeer::APP_DOC_TYPE, 'ATTACHED')) ); } else { $oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, $obj_type); @@ -5314,7 +5306,8 @@ class Cases } $oDataset->next(); } - if ($obj_type == 'INPUT') { // For supervisor documents + if ($obj_type == 'INPUT') { + // For supervisor documents $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID); $oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_TYPE); @@ -5361,7 +5354,8 @@ class Cases * @access public * @param $case, $pin * @return Array - */ + */ + public function verifyCaseTracker($case, $pin) { //CASE INSENSITIVE pin @@ -5438,19 +5432,20 @@ class Cases * @name caseTrackerPermissions * @param string $PRO_UID * @return string - */ + */ + public function caseTrackerPermissions($PRO_UID) { $newCaseTracker = new CaseTracker(); $caseTracker = $newCaseTracker->load($PRO_UID); if (is_array($caseTracker)) { - $caseTracker['CT_MAP_TYPE'] = ($caseTracker['CT_MAP_TYPE'] != 'NONE')? true : false; + $caseTracker['CT_MAP_TYPE'] = ($caseTracker['CT_MAP_TYPE'] != 'NONE') ? true : false; //$caseTracker['CT_DERIVATION_HISTORY'] = ($caseTracker['CT_DERIVATION_HISTORY'] == 1)? true : false; //$caseTracker['CT_MESSAGE_HISTORY'] = ($caseTracker['CT_MESSAGE_HISTORY'] == 1)? true : false; $criteria = new Criteria(); $criteria->add(CaseTrackerObjectPeer::PRO_UID, $PRO_UID); - $caseTracker['DYNADOC'] = (CaseTrackerObjectPeer::doCount($criteria) > 0)? true : false; + $caseTracker['DYNADOC'] = (CaseTrackerObjectPeer::doCount($criteria) > 0) ? true : false; } return $caseTracker; } @@ -5462,7 +5457,8 @@ class Cases * @name verifyTable * @param * @return object - */ + */ + public function verifyTable() { $oCriteria = new Criteria('workflow'); @@ -5488,7 +5484,8 @@ class Cases * @param string $sApplicationUID * @param string $sDocUID * @return object - */ + */ + public function getAllUploadedDocumentsCriteriaTracker($sProcessUID, $sApplicationUID, $sDocUID) { $oAppDocument = new AppDocument(); @@ -5609,7 +5606,8 @@ class Cases * @param string $sApplicationUID * @param string $sDocUID * @return object - */ + */ + public function getAllGeneratedDocumentsCriteriaTracker($sProcessUID, $sApplicationUID, $sDocUID) { $oAppDocument = new AppDocument(); @@ -5686,7 +5684,8 @@ class Cases * @name getHistoryMessagesTracker * @param string sApplicationUID * @return object - */ + */ + public function getHistoryMessagesTracker($sApplicationUID) { $oAppDocument = new AppDocument(); @@ -5750,7 +5749,8 @@ class Cases * @param string sApplicationUID * @param string Msg_UID * @return array - */ + */ + public function getHistoryMessagesTrackerExt($sApplicationUID) { G::LoadClass('ArrayPeer'); @@ -5802,7 +5802,8 @@ class Cases * @param string sApplicationUID * @param string Msg_UID * @return array - */ + */ + public function getHistoryMessagesTrackerView($sApplicationUID, $Msg_UID) { $oAppDocument = new AppDocument(); @@ -5824,7 +5825,8 @@ class Cases * @param string sApplicationUID * @param object OBJ_TYPE * @return array - */ + */ + public function getAllObjectsFromProcess($PRO_UID, $OBJ_TYPE = '%') { $RESULT = Array(); @@ -5868,16 +5870,11 @@ class Cases * @param string $iStepPosition * @param array $aNewData * @return void - */ - public function executeTriggersAfterExternal( - $sProcess, - $sTask, - $sApplication, - $iIndex, - $iStepPosition, - $aNewData = array() - ) { - //load the variables + */ + + public function executeTriggersAfterExternal($sProcess, $sTask, $sApplication, $iIndex, $iStepPosition, $aNewData = array()) + { + //load the variables $Fields = $this->loadCase($sApplication); $Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants()); $Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], $aNewData); @@ -5885,7 +5882,7 @@ class Cases $oCase = new Cases(); $aNextStep = $this->getNextStep($sProcess, $sApplication, $iIndex, $iStepPosition - 1); $Fields['APP_DATA'] = $this->ExecuteTriggers( - $sTask, 'EXTERNAL', $aNextStep['UID'], 'AFTER', $Fields['APP_DATA'] + $sTask, 'EXTERNAL', $aNextStep['UID'], 'AFTER', $Fields['APP_DATA'] ); //save data $aData = array(); @@ -5907,7 +5904,8 @@ class Cases * @param string $sAction * @param string $sURL * @return void - */ + */ + public function thisIsTheCurrentUser($sApplicationUID, $iIndex, $sUserUID, $sAction = '', $sURL = '') { $c = new Criteria('workflow'); @@ -5932,9 +5930,9 @@ class Cases $oDataset->next(); $aData = $oDataset->getRow(); G::SendMessageText( - G::LoadTranslation('ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER') . ': ' . - $aData['USR_FIRSTNAME'] . ' ' . $aData['USR_LASTNAME'] . - ' (' . $aData['USR_USERNAME'] . ')', 'error' + G::LoadTranslation('ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER') . ': ' . + $aData['USR_FIRSTNAME'] . ' ' . $aData['USR_LASTNAME'] . + ' (' . $aData['USR_USERNAME'] . ')', 'error' ); G::header('Location: ' . $sURL); die; @@ -5961,9 +5959,9 @@ class Cases $oDataset->next(); $aData = $oDataset->getRow(); die('' . - G::LoadTranslation('ID_CASE_ALREADY_DERIVATED') . ': ' . - $aData['USR_FIRSTNAME'] . ' ' . - $aData['USR_LASTNAME'] . ' (' . $aData['USR_USERNAME'] . ')' + G::LoadTranslation('ID_CASE_ALREADY_DERIVATED') . ': ' . + $aData['USR_FIRSTNAME'] . ' ' . + $aData['USR_LASTNAME'] . ' (' . $aData['USR_USERNAME'] . ')' ); } else { $c->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); @@ -6011,19 +6009,8 @@ class Cases * @return object */ - public function getAdvancedSearch ( - $sCase, - $sProcess, - $sTask, - $sCurrentUser, - $sSentby, - $sLastModFrom, - $sLastModTo, - $sStatus, - $permisse, - $userlogged, - $aSupervisor - ) { + public function getAdvancedSearch($sCase, $sProcess, $sTask, $sCurrentUser, $sSentby, $sLastModFrom, $sLastModTo, $sStatus, $permisse, $userlogged, $aSupervisor) + { $sTypeList = ''; $sUIDUserLogged = ''; @@ -6035,9 +6022,8 @@ class Cases $c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY); //$c->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE); $c->addAsColumn( - 'DEL_TASK_DUE_DATE', - " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('', " . - AppDelegationPeer::DEL_TASK_DUE_DATE . ", ''), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") "); + 'DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('', " . + AppDelegationPeer::DEL_TASK_DUE_DATE . ", ''), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") "); $c->addSelectColumn(AppDelegationPeer::DEL_INDEX); $c->addSelectColumn(AppDelegationPeer::TAS_UID); $c->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE); @@ -6050,8 +6036,7 @@ class Cases $c->addAsColumn('APP_TAS_TITLE', 'TAS_TITLE.CON_VALUE'); //$c->addAsColumn('APP_DEL_PREVIOUS_USER', 'APP_LAST_USER.USR_USERNAME'); $c->addAsColumn( - 'APP_DEL_PREVIOUS_USER', - "CONCAT(APP_LAST_USER.USR_LASTNAME, ' ', APP_LAST_USER.USR_FIRSTNAME)" + 'APP_DEL_PREVIOUS_USER', "CONCAT(APP_LAST_USER.USR_LASTNAME, ' ', APP_LAST_USER.USR_FIRSTNAME)" ); $c->addAlias("APP_TITLE", 'CONTENT'); @@ -6099,9 +6084,9 @@ class Cases $c->add( $c->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, 'OPEN')-> - addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'COMPLETED')-> - addAnd($c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS,0))) - ); + addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'COMPLETED')-> + addAnd($c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0))) + ); if ($sCase != '') { $c->add(ApplicationPeer::APP_NUMBER, $sCase); @@ -6120,10 +6105,8 @@ class Cases } if ($sLastModFrom != '0000-00-00' && $sLastModTo != '0000-00-00' && $sLastModFrom != '' && $sLastModTo != '') { $c->add( - $c->getNewCriterion(ApplicationPeer::APP_UPDATE_DATE, $sLastModFrom . ' 00:00:00', - Criteria::GREATER_EQUAL)-> - addAnd($c->getNewCriterion(ApplicationPeer::APP_UPDATE_DATE, $sLastModTo . ' 23:59:59', - Criteria::LESS_EQUAL)) + $c->getNewCriterion(ApplicationPeer::APP_UPDATE_DATE, $sLastModFrom . ' 00:00:00', Criteria::GREATER_EQUAL)-> + addAnd($c->getNewCriterion(ApplicationPeer::APP_UPDATE_DATE, $sLastModTo . ' 23:59:59', Criteria::LESS_EQUAL)) ); } if ($sStatus != '') { @@ -6134,8 +6117,8 @@ class Cases if ($permisse != 0) { $c->add( - $c->getNewCriterion(AppDelegationPeer::USR_UID, $userlogged)-> - addOr($c->getNewCriterion(AppDelegationPeer::PRO_UID, $aSupervisor, Criteria::IN)) + $c->getNewCriterion(AppDelegationPeer::USR_UID, $userlogged)-> + addOr($c->getNewCriterion(AppDelegationPeer::PRO_UID, $aSupervisor, Criteria::IN)) ); } @@ -6151,7 +6134,7 @@ class Cases * @name getConditionCasesCount * @param string $type * @return int - */ + */ public function getConditionCasesCount($type, $sumary = null) { $result = 0; @@ -6191,7 +6174,7 @@ class Cases * @name getAllConditionCasesCount * @param string $type * @return array - */ + */ public function getAllConditionCasesCount($types, $sumary = null) { $aResult = Array(); @@ -6208,7 +6191,8 @@ class Cases * @param string $sAppUid * @param string $sUIDUserLogged * @return int - */ + */ + public function userParticipatedInCase($sAppUid, $sUIDUserLogged) { $c = new Criteria('workflow'); @@ -6231,7 +6215,8 @@ class Cases * @name getCurrentDelegationCase * @param string $sApplicationUID * @return integer - */ + */ + public function getCurrentDelegationCase($sApplicationUID = '') { $oSession = new DBSession(new DBConnection()); @@ -6250,16 +6235,16 @@ class Cases public function clearCaseSessionData() { - if ( isset($_SESSION['APPLICATION']) ) { + if (isset($_SESSION['APPLICATION'])) { unset($_SESSION['APPLICATION']); } - if ( isset($_SESSION['PROCESS']) ) { + if (isset($_SESSION['PROCESS'])) { unset($_SESSION['PROCESS']); } - if ( isset($_SESSION['INDEX']) ) { + if (isset($_SESSION['INDEX'])) { unset($_SESSION['INDEX']); } - if ( isset($_SESSION['STEP_POSITION']) ) { + if (isset($_SESSION['STEP_POSITION'])) { unset($_SESSION['STEP_POSITION']); } } @@ -6271,9 +6256,9 @@ class Cases */ public function jumpToCase($APP_NUMBER) { - $_GET['APP_UID'] = $oCase->getApplicationUIDByNumber($_GET['APP_NUMBER']); + $_GET['APP_UID'] = $oCase->getApplicationUIDByNumber($_GET['APP_NUMBER']); $_GET['DEL_INDEX'] = $oCase->getCurrentDelegation($_GET['APP_UID'], $_SESSION['USER_LOGGED']); - if ( is_null($_GET['DEL_INDEX']) ) { + if (is_null($_GET['DEL_INDEX'])) { $participated = $oCase->userParticipatedInCase($_GET['APP_UID'], $_SESSION['USER_LOGGED']); if ($participated == 0) { if (is_null($_GET['APP_UID'])) { @@ -6290,9 +6275,8 @@ class Cases { $siblingThreadData = $this->GetAllOpenDelegation($aData); foreach ($siblingThreadData as $thread => $threadData) { - $this->closeAppThread ( $aData['APP_UID'], $threadData['DEL_INDEX']); //Close Sibling AppThreads - $this->CloseCurrentDelegation ($aData['APP_UID'], $threadData['DEL_INDEX']); //Close Sibling AppDelegations - + $this->closeAppThread($aData['APP_UID'], $threadData['DEL_INDEX']); //Close Sibling AppThreads + $this->CloseCurrentDelegation($aData['APP_UID'], $threadData['DEL_INDEX']); //Close Sibling AppDelegations //update searchindex if ($this->appSolr != null) { $this->appSolr->updateApplicationSearchIndex($aData['APP_UID']); @@ -6307,15 +6291,16 @@ class Cases * @param string $sAppUid * @param string $sAppParent * @return $aThreads - */ + */ + public function GetAllOpenDelegation($aData) { try { $aThreads = array(); - $c = new Criteria(); + $c = new Criteria(); $c->add(AppDelegationPeer::APP_UID, $aData['APP_UID']); $c->add(AppDelegationPeer::DEL_PREVIOUS, $aData['APP_THREAD_PARENT']); - $c->add(AppDelegationPeer::DEL_THREAD_STATUS,'OPEN'); + $c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN'); $rs = AppDelegationPeer::doSelectRs($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); @@ -6331,7 +6316,6 @@ class Cases } } - public function getUsersToReassign($TAS_UID, $USR_UID) { G::LoadClass('groups'); @@ -6404,7 +6388,8 @@ class Cases * @name getUsersParticipatedInCase * @param string $sAppUid * @return array (criteria+array) - */ + */ + public function getUsersParticipatedInCase($sAppUid) { $c = new Criteria('workflow'); @@ -6418,14 +6403,14 @@ class Cases $rs = AppDelegationPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rows=array(); + $rows = array(); $rs->next(); while ($row = $rs->getRow()) { - $rows[$row['USR_UID']]=$row; + $rows[$row['USR_UID']] = $row; $rs->next(); } - $response['criteria']=$c; - $response['array']=$rows; + $response['criteria'] = $c; + $response['array'] = $rows; return $response; } @@ -6433,7 +6418,7 @@ class Cases { require_once ( "classes/model/AppNotes.php" ); $appNotes = new AppNotes(); - $appNotes = $appNotes->getNotesList($applicationID,$userUid); + $appNotes = $appNotes->getNotesList($applicationID, $userUid); $response = ''; if (is_array($appNotes)) { switch ($type) { @@ -6441,19 +6426,19 @@ class Cases $response = array(); foreach ($appNotes['array']['notes'] as $key => $value) { $list = array(); - $list['FULL_NAME'] = $value['USR_FIRSTNAME']." ".$value['USR_LASTNAME']; + $list['FULL_NAME'] = $value['USR_FIRSTNAME'] . " " . $value['USR_LASTNAME']; foreach ($value as $keys => $value) { if ($keys != 'USR_FIRSTNAME' && $keys != 'USR_LASTNAME' && $keys != 'USR_EMAIL') { $list[$keys] = $value; } } - $response[$key+1] = $list; + $response[$key + 1] = $list; } break; case 'object': $response = new stdclass(); foreach ($appNotes['array']['notes'] as $key => $value) { - $response->$key->FULL_NAME = $value['USR_FIRSTNAME']." ".$value['USR_LASTNAME']; + $response->$key->FULL_NAME = $value['USR_FIRSTNAME'] . " " . $value['USR_LASTNAME']; foreach ($value as $keys => $value) { if ($keys != 'USR_FIRSTNAME' && $keys != 'USR_LASTNAME' && $keys != 'USR_EMAIL') { $response->$key->$keys = $value; @@ -6464,11 +6449,11 @@ class Cases case 'string': $response = ''; foreach ($appNotes['array']['notes'] as $key => $value) { - $response .= $value['USR_FIRSTNAME']." ". - $value['USR_LASTNAME']." ". - "(".$value['USR_USERNAME'].")". - " ".$value['NOTE_CONTENT']." "." (".$value['NOTE_DATE']." ) ". - " \n"; + $response .= $value['USR_FIRSTNAME'] . " " . + $value['USR_LASTNAME'] . " " . + "(" . $value['USR_USERNAME'] . ")" . + " " . $value['NOTE_CONTENT'] . " " . " (" . $value['NOTE_DATE'] . " ) " . + " \n"; } break; } @@ -6478,15 +6463,15 @@ class Cases public function getExecuteTriggerProcess($appUid, $action) { - if ((!isset($appUid) && $appUid == '') || (!isset($action) && $action == '')) { + if ((!isset($appUid) && $appUid == '') || (!isset($action) && $action == '')) { return false; } $aFields = $this->loadCase($appUid); - $proUid = $aFields['PRO_UID']; + $proUid = $aFields['PRO_UID']; require_once ( "classes/model/Process.php" ); - $appProcess = new Process(); + $appProcess = new Process(); $webBotTrigger = $appProcess->getTriggerWebBotProcess($proUid, $action); if ($webBotTrigger != false && $webBotTrigger != '') { @@ -6502,4 +6487,4 @@ class Cases return false; } } - + \ No newline at end of file diff --git a/workflow/engine/classes/class.configuration.php b/workflow/engine/classes/class.configuration.php index 6fb38a9f8..aa9dfd7c2 100755 --- a/workflow/engine/classes/class.configuration.php +++ b/workflow/engine/classes/class.configuration.php @@ -1,4 +1,5 @@ Configuration = new Configuration(); } @@ -73,17 +74,17 @@ class Configurations // extends Configuration * @param array &$cloneObject Array duplicate * @return void */ - function arrayClone (&$object, &$cloneObject) + public function arrayClone(&$object, &$cloneObject) { - if (is_array( $object )) { + if (is_array($object)) { foreach ($object as $k => $v) { - $cloneObject[$k] = NULL; - $this->arrayClone( $object[$k], $cloneObject[$k] ); + $cloneObject[$k] = null; + $this->arrayClone($object[$k], $cloneObject[$k]); } } else { if (is_object( $object )) { } else { - $cloneObject = NULL; + $cloneObject = null; } } } @@ -95,30 +96,35 @@ class Configurations // extends Configuration * @param array &$from * @return void */ - function configObject (&$object, &$from) + public function configObject(&$object, &$from) { - if (! (is_object( $object ) || is_array( $object ))) + if (!(is_object($object) || is_array($object))) { return; + } - if (! isset( $from )) + if (!isset($from)) { $from = &$this->aConfig; + } foreach ($from as $k => $v) { - if (isset( $v ) && array_key_exists( $k, $object )) { - if (is_object( $v )) - throw new Exception( 'Object is not permited inside configuration array.' ); + if (isset($v) && array_key_exists($k, $object)) { + if (is_object($v)) { + throw new Exception('Object is not permited inside configuration array.'); + } - if (is_object( $object )) { - if (is_array( $v )) - $this->configObject( $object->{$k}, $v ); - else + if (is_object($object)) { + if (is_array($v)) { + $this->configObject($object->{$k}, $v); + } else { $object->{$k} = $v; + } } else { - if (is_array( $object )) { - if (is_array( $v )) - $this->configObject( $object[$k], $v ); - else + if (is_array($object)) { + if (is_array($v)) { + $this->configObject($object[$k], $v); + } else { $object[$k] = $v; + } } } } @@ -136,10 +142,10 @@ class Configurations // extends Configuration * @param string $app * @return void */ - function loadConfig (&$object, $cfg, $obj = '', $pro = '', $usr = '', $app = '') + public function loadConfig(&$object, $cfg, $obj = '', $pro = '', $usr = '', $app = '') { - $this->load( $cfg, $obj, $pro, $usr, $app ); - $this->configObject( $object, $this->aConfig ); + $this->load($cfg, $obj, $pro, $usr, $app); + $this->configObject($object, $this->aConfig); } /** @@ -152,21 +158,24 @@ class Configurations // extends Configuration * @param string $app * @return void */ - function load ($cfg, $obj = '', $pro = '', $usr = '', $app = '') + public function load($cfg, $obj = '', $pro = '', $usr = '', $app = '') { - $this->Fields = array (); + $this->Fields = array(); try { - $this->Fields = $this->Configuration->load( $cfg, $obj, $pro, $usr, $app ); + $this->Fields = $this->Configuration->load($cfg, $obj, $pro, $usr, $app); } catch (Exception $e) { + } // the configuration does not exist - if (isset( $this->Fields['CFG_VALUE'] )) - $this->aConfig = unserialize( $this->Fields['CFG_VALUE'] ); + if (isset($this->Fields['CFG_VALUE'])) { + $this->aConfig = unserialize($this->Fields['CFG_VALUE']); + } - if (! is_array( $this->aConfig )) - $this->aConfig = Array (); + if (!is_array($this->aConfig)) { + $this->aConfig = Array(); + } return $this->aConfig; } @@ -178,15 +187,15 @@ class Configurations // extends Configuration * @param array &$from * @return void */ - function saveConfig ($cfg, $obj, $pro = '', $usr = '', $app = '') + public function saveConfig($cfg, $obj, $pro = '', $usr = '', $app = '') { - $aFields = array ('CFG_UID' => $cfg,'OBJ_UID' => $obj,'PRO_UID' => $pro,'USR_UID' => $usr,'APP_UID' => $app,'CFG_VALUE' => serialize( $this->aConfig ) + $aFields = array('CFG_UID' => $cfg, 'OBJ_UID' => $obj, 'PRO_UID' => $pro, 'USR_UID' => $usr, 'APP_UID' => $app, 'CFG_VALUE' => serialize($this->aConfig) ); - if ($this->Configuration->exists( $cfg, $obj, $pro, $usr, $app )) { - $this->Configuration->update( $aFields ); + if ($this->Configuration->exists($cfg, $obj, $pro, $usr, $app)) { + $this->Configuration->update($aFields); } else { - $this->Configuration->create( $aFields ); - $this->Configuration->update( $aFields ); + $this->Configuration->create($aFields); + $this->Configuration->update($aFields); } } @@ -197,16 +206,16 @@ class Configurations // extends Configuration * @param array &$from * @return void */ - function saveObject (&$object, $cfg, $obj, $pro = '', $usr = '', $app = '') + public function saveObject(&$object, $cfg, $obj, $pro = '', $usr = '', $app = '') { - $aFields = array ('CFG_UID' => $cfg,'OBJ_UID' => $obj,'PRO_UID' => $pro,'USR_UID' => $usr,'APP_UID' => $app,'CFG_VALUE' => serialize( array (&$object - ) ) + $aFields = array('CFG_UID' => $cfg, 'OBJ_UID' => $obj, 'PRO_UID' => $pro, 'USR_UID' => $usr, 'APP_UID' => $app, 'CFG_VALUE' => serialize(array(&$object + )) ); - if ($this->Configuration->exists( $cfg, $obj, $pro, $usr, $app )) { - $this->Configuration->update( $aFields ); + if ($this->Configuration->exists($cfg, $obj, $pro, $usr, $app)) { + $this->Configuration->update($aFields); } else { - $this->Configuration->create( $aFields ); - $this->Configuration->update( $aFields ); + $this->Configuration->create($aFields); + $this->Configuration->update($aFields); } } @@ -221,22 +230,24 @@ class Configurations // extends Configuration * @param string $app * @return void */ - function loadObject ($cfg, $obj, $pro = '', $usr = '', $app = '') + public function loadObject($cfg, $obj, $pro = '', $usr = '', $app = '') { - $objectContainer = array ((object) array () - ); - $this->Fields = array (); - if ($this->Configuration->exists( $cfg, $obj, $pro, $usr, $app )) - $this->Fields = $this->Configuration->load( $cfg, $obj, $pro, $usr, $app ); - else + $objectContainer = array((object) array()); + $this->Fields = array(); + if ($this->Configuration->exists($cfg, $obj, $pro, $usr, $app)) { + $this->Fields = $this->Configuration->load($cfg, $obj, $pro, $usr, $app); + } else { return $objectContainer[0]; + } - if (isset( $this->Fields['CFG_VALUE'] )) - $objectContainer = unserialize( $this->Fields['CFG_VALUE'] ); - if (! is_array( $objectContainer ) || sizeof( $objectContainer ) != 1) - return (object) array (); - else + if (isset($this->Fields['CFG_VALUE'])) { + $objectContainer = unserialize($this->Fields['CFG_VALUE']); + } + if (!is_array($objectContainer) || sizeof($objectContainer) != 1) { + return (object) array(); + } else { return $objectContainer[0]; + } } /** @@ -249,15 +260,15 @@ class Configurations // extends Configuration * @param string $app * @return void */ - function getConfiguration ($cfg, $obj, $pro = '', $usr = '', $app = '') + public function getConfiguration($cfg, $obj, $pro = '', $usr = '', $app = '') { try { - $oCfg = ConfigurationPeer::retrieveByPK( $cfg, $obj, $pro, $usr, $app ); - if (! is_null( $oCfg )) { - $row = $oCfg->toArray( BasePeer::TYPE_FIELDNAME ); - $result = unserialize( $row['CFG_VALUE'] ); - if (is_array( $result ) && sizeof( $result ) == 1) { - $arrayKeys = Array_keys( $result ); + $oCfg = ConfigurationPeer::retrieveByPK($cfg, $obj, $pro, $usr, $app); + if (!is_null($oCfg)) { + $row = $oCfg->toArray(BasePeer::TYPE_FIELDNAME); + $result = unserialize($row['CFG_VALUE']); + if (is_array($result) && sizeof($result) == 1) { + $arrayKeys = Array_keys($result); return $result[$arrayKeys[0]]; } else { return $result; @@ -279,17 +290,17 @@ class Configurations // extends Configuration * @param string $lastname * @return string User Name Well-Formatted */ - - function usersNameFormat ($username, $firstname, $lastname) + public function usersNameFormat($username, $firstname, $lastname) { try { - if (! isset( $this->UserConfig )) - $this->UserConfig = $this->getConfiguration( 'ENVIRONMENT_SETTINGS', '' ); - if (isset( $this->UserConfig['format'] )) { + if (!isset($this->UserConfig)) { + $this->UserConfig = $this->getConfiguration('ENVIRONMENT_SETTINGS', ''); + } + if (isset($this->UserConfig['format'])) { $aux = ''; - $aux = str_replace( '@userName', $username, $this->UserConfig['format'] ); - $aux = str_replace( '@firstName', $firstname, $aux ); - $aux = str_replace( '@lastName', $lastname, $aux ); + $aux = str_replace('@userName', $username, $this->UserConfig['format']); + $aux = str_replace('@firstName', $firstname, $aux); + $aux = str_replace('@lastName', $lastname, $aux); return $aux; } else { return $username; @@ -305,38 +316,38 @@ class Configurations // extends Configuration * @author Enrique Ponce de Leon enrique@colosa.com * @return FORMATS array */ - public function getFormats () + public function getFormats() { - if (! isset( $this->UserConfig )) { - $this->UserConfig = $this->getConfiguration( "ENVIRONMENT_SETTINGS", "" ); + if (!isset($this->UserConfig)) { + $this->UserConfig = $this->getConfiguration("ENVIRONMENT_SETTINGS", ""); } //Setting defaults - if (! isset( $this->UserConfig["format"] )) { + if (!isset($this->UserConfig["format"])) { $this->UserConfig["format"] = "@lastName, @firstName (@userName)"; } - if (! isset( $this->UserConfig["dateFormat"] )) { + if (!isset($this->UserConfig["dateFormat"])) { $this->UserConfig["dateFormat"] = "Y-m-d H:i:s"; } - if (! isset( $this->UserConfig["startCaseHideProcessInf"] )) { + if (!isset($this->UserConfig["startCaseHideProcessInf"])) { $this->UserConfig["startCaseHideProcessInf"] = false; } - if (! isset( $this->UserConfig["casesListDateFormat"] )) { + if (!isset($this->UserConfig["casesListDateFormat"])) { $this->UserConfig["casesListDateFormat"] = "Y-m-d H:i:s"; } - if (! isset( $this->UserConfig["casesListRowNumber"] )) { + if (!isset($this->UserConfig["casesListRowNumber"])) { $this->UserConfig["casesListRowNumber"] = 25; } - if (! isset( $this->UserConfig["casesListRefreshTime"] ) || (isset( $this->UserConfig["casesListRefreshTime"] ) && empty( $this->UserConfig["casesListRefreshTime"] ))) { + if (!isset($this->UserConfig["casesListRefreshTime"]) || (isset($this->UserConfig["casesListRefreshTime"]) && empty($this->UserConfig["casesListRefreshTime"]))) { $this->UserConfig["casesListRefreshTime"] = 120; //2 minutes } - $this->UserConfig["TimeZone"] = date( "T" ); + $this->UserConfig["TimeZone"] = date("T"); return $this->UserConfig; } @@ -349,67 +360,74 @@ class Configurations // extends Configuration * @param object &$to * @return void */ - function setConfig ($route, &$object, &$to) + public function setConfig($route, &$object, &$to) { - if (! isset( $to )) + if (!isset($to)) { $to = &$this->aConfig; - $routes = explode( ',', $route ); + } + $routes = explode(',', $route); foreach ($routes as $r) { - $ro = explode( '/', $r ); - if (count( $ro ) > 1) { + $ro = explode('/', $r); + if (count($ro) > 1) { $rou = $ro; - unset( $rou[0] ); + unset($rou[0]); if ($ro[0] === '*') { foreach ($object as $k => $v) { - if (is_object( $object )) { - if (! isset( $to[$k] )) - $to[$k] = array (); - $this->setConfig( implode( '/', $rou ), $object->{$k}, $to[$k] ); + if (is_object($object)) { + if (!isset($to[$k])) { + $to[$k] = array(); + } + $this->setConfig(implode('/', $rou), $object->{$k}, $to[$k]); } else { - if (is_array( $object )) { - if (! isset( $to[$k] )) - $to[$k] = array (); - $this->setConfig( implode( '/', $rou ), $object[$k], $to[$k] ); + if (is_array($object)) { + if (!isset($to[$k])) { + $to[$k] = array(); + } + $this->setConfig(implode('/', $rou), $object[$k], $to[$k]); } } } } else { - if (is_object( $object )) { - if (! isset( $to[$ro[0]] )) - $to[$ro[0]] = array (); - $this->setConfig( implode( '/', $rou ), $object->{$ro[0]}, $to[$ro[0]] ); + if (is_object($object)) { + if (!isset($to[$ro[0]])) { + $to[$ro[0]] = array(); + } + $this->setConfig(implode('/', $rou), $object->{$ro[0]}, $to[$ro[0]]); } else { - if (is_array( $object )) { - if (! isset( $to[$ro[0]] )) - $to[$ro[0]] = array (); - $this->setConfig( implode( '/', $rou ), $object[$ro[0]], $to[$ro[0]] ); + if (is_array($object)) { + if (!isset($to[$ro[0]])) { + $to[$ro[0]] = array(); + } + $this->setConfig(implode('/', $rou), $object[$ro[0]], $to[$ro[0]]); } else { $to = $object; } } - } } else { if ($ro[0] === '*') { foreach ($object as $k => $v) { - if (is_object( $object )) { - if (! isset( $to[$k] )) - $to[$k] = array (); + if (is_object($object)) { + if (!isset($to[$k])) { + $to[$k] = array(); + } $to[$k] = $object->{$k}; } else { - if (is_array( $object )) { - if (! isset( $to[$k] )) - $to[$k] = array (); + if (is_array($object)) { + if (!isset($to[$k])) { + $to[$k] = array(); + } $to[$k] = $object[$k]; } } } } else { - if (! isset( $to[$r] )) - $to[$r] = array (); - if (is_object( $object )) { + if (!isset($to[$r])) { + $to[$r] = array(); + } + if (is_object($object)) { $to[$r] = $object->{$r}; - } elseif (is_array( $object )) { + } elseif (is_array($object)) { $to[$r] = $object[$r]; } else { $to[$r] = $object; @@ -419,86 +437,84 @@ class Configurations // extends Configuration } } - function getDateFormats() + public function getDateFormats() { $arrayFormat = array(); //The id, don't translate - $arrayFormat[] = array("id" => "Y-m-d H:i:s", "name" => G::LoadTranslation("ID_DATE_FORMAT_1")); //"Y-m-d H:i:s" i.e: "2010-11-17 10:25:07" - $arrayFormat[] = array("id" => "d/m/Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_2")); //"d/m/Y" i.e: "17/11/2010" - $arrayFormat[] = array("id" => "m/d/Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_3")); //"m/d/Y" i.e: "11/17/2010" - $arrayFormat[] = array("id" => "Y/d/m", "name" => G::LoadTranslation("ID_DATE_FORMAT_4")); //"Y/d/m" i.e: "2010/17/11" - $arrayFormat[] = array("id" => "Y/m/d", "name" => G::LoadTranslation("ID_DATE_FORMAT_5")); //"Y/m/d" i.e: "2010/11/17" - $arrayFormat[] = array("id" => "F j, Y, g:i a", "name" => G::LoadTranslation("ID_DATE_FORMAT_6")); //"F j, Y, g:i a" i.e: "November 17, 2010, 10:45 am" - $arrayFormat[] = array("id" => "m.d.y", "name" => G::LoadTranslation("ID_DATE_FORMAT_7")); //"m.d.y" i.e: "11.17.10" - $arrayFormat[] = array("id" => "j, n, Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_8")); //"j, n, Y" i.e: "17,11,2010" + $arrayFormat[] = array("id" => "Y-m-d H:i:s", "name" => G::LoadTranslation("ID_DATE_FORMAT_1")); //"Y-m-d H:i:s" i.e: "2010-11-17 10:25:07" + $arrayFormat[] = array("id" => "d/m/Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_2")); //"d/m/Y" i.e: "17/11/2010" + $arrayFormat[] = array("id" => "m/d/Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_3")); //"m/d/Y" i.e: "11/17/2010" + $arrayFormat[] = array("id" => "Y/d/m", "name" => G::LoadTranslation("ID_DATE_FORMAT_4")); //"Y/d/m" i.e: "2010/17/11" + $arrayFormat[] = array("id" => "Y/m/d", "name" => G::LoadTranslation("ID_DATE_FORMAT_5")); //"Y/m/d" i.e: "2010/11/17" + $arrayFormat[] = array("id" => "F j, Y, g:i a", "name" => G::LoadTranslation("ID_DATE_FORMAT_6")); //"F j, Y, g:i a" i.e: "November 17, 2010, 10:45 am" + $arrayFormat[] = array("id" => "m.d.y", "name" => G::LoadTranslation("ID_DATE_FORMAT_7")); //"m.d.y" i.e: "11.17.10" + $arrayFormat[] = array("id" => "j, n, Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_8")); //"j, n, Y" i.e: "17,11,2010" $arrayFormat[] = array("id" => "D M j G:i:s T Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_9")); //"D M j G:i:s T Y" i.e: "Thu Nov 17 10:48:18 BOT 2010" - $arrayFormat[] = array("id" => "D d M, Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_10")); //"D d M, Y" i.e: "Thu 17 Nov, 2010" - $arrayFormat[] = array("id" => "D M, Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_11")); //"D M, Y" i.e: "Thu Nov, 2010" - $arrayFormat[] = array("id" => "d M, Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_12")); //"d M, Y" i.e: "17 Nov, 2010" - $arrayFormat[] = array("id" => "d m, Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_13")); //"d m, Y" i.e: "17 11, 2010" - $arrayFormat[] = array("id" => "d.m.Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_14")); //"d.m.Y" i.e: "17.11.2010" + $arrayFormat[] = array("id" => "D d M, Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_10")); //"D d M, Y" i.e: "Thu 17 Nov, 2010" + $arrayFormat[] = array("id" => "D M, Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_11")); //"D M, Y" i.e: "Thu Nov, 2010" + $arrayFormat[] = array("id" => "d M, Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_12")); //"d M, Y" i.e: "17 Nov, 2010" + $arrayFormat[] = array("id" => "d m, Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_13")); //"d m, Y" i.e: "17 11, 2010" + $arrayFormat[] = array("id" => "d.m.Y", "name" => G::LoadTranslation("ID_DATE_FORMAT_14")); //"d.m.Y" i.e: "17.11.2010" return $arrayFormat; } - function getUserNameFormats () + public function getUserNameFormats() { - $formats[] = Array ('id' => '@firstName @lastName', //the id , don't translate -'name' => G::loadTranslation( 'ID_USERNAME_FORMAT_1' ) //label displayed, can be translated - ); - $formats[] = Array ('id' => '@firstName @lastName (@userName)','name' => G::loadTranslation( 'ID_USERNAME_FORMAT_2' ) - ); - $formats[] = Array ('id' => '@userName','name' => G::loadTranslation( 'ID_USERNAME_FORMAT_3' ) - ); - $formats[] = Array ('id' => '@userName (@firstName @lastName)','name' => G::loadTranslation( 'ID_USERNAME_FORMAT_4' ) - ); - $formats[] = Array ('id' => '@lastName @firstName','name' => G::loadTranslation( 'ID_USERNAME_FORMAT_5' ) - ); - $formats[] = Array ('id' => '@lastName, @firstName','name' => G::loadTranslation( 'ID_USERNAME_FORMAT_6' ) - ); - $formats[] = Array ('id' => '@lastName, @firstName (@userName)','name' => G::loadTranslation( 'ID_USERNAME_FORMAT_7' ) + $formats[] = Array('id' => '@firstName @lastName', //the id , don't translate + 'name' => G::loadTranslation('ID_USERNAME_FORMAT_1') //label displayed, can be translated ); + $formats[] = Array('id' => '@firstName @lastName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_2')); + $formats[] = Array('id' => '@userName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_3')); + $formats[] = Array('id' => '@userName (@firstName @lastName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_4')); + $formats[] = Array('id' => '@lastName @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_5')); + $formats[] = Array('id' => '@lastName, @firstName', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_6')); + $formats[] = Array('id' => '@lastName, @firstName (@userName)', 'name' => G::loadTranslation('ID_USERNAME_FORMAT_7')); return $formats; } - function getSystemDate ($dateTime) + public function getSystemDate($dateTime) { $oConf = new Configurations(); - $oConf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' ); - $creationDateMask = isset( $oConf->aConfig['dateFormat'] ) ? $oConf->aConfig['dateFormat'] : ''; + $oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', ''); + $creationDateMask = isset($oConf->aConfig['dateFormat']) ? $oConf->aConfig['dateFormat'] : ''; if ($creationDateMask != '') { - if (strpos( $dateTime, ' ' ) !== false) { - list ($date, $time) = explode( ' ', $dateTime ); - list ($y, $m, $d) = explode( '-', $date ); - list ($h, $i, $s) = explode( ':', $time ); - $dateTime = date( $creationDateMask, mktime( $h, $i, $s, $m, $d, $y ) ); + if (strpos($dateTime, ' ') !== false) { + list ($date, $time) = explode(' ', $dateTime); + list ($y, $m, $d) = explode('-', $date); + list ($h, $i, $s) = explode(':', $time); + $dateTime = date($creationDateMask, mktime($h, $i, $s, $m, $d, $y)); } else { - list ($y, $m, $d) = explode( '-', $dateTime ); - $dateTime = date( $creationDateMask, mktime( 0, 0, 0, $m, $d, $y ) ); + list ($y, $m, $d) = explode('-', $dateTime); + $dateTime = date($creationDateMask, mktime(0, 0, 0, $m, $d, $y)); } } return $dateTime; } - function getEnvSetting ($key = null, $data = null) + public function getEnvSetting($key = null, $data = null) { - $this->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' ); + $this->loadConfig($obj, 'ENVIRONMENT_SETTINGS', ''); - if (isset( $key )) { - if (isset( $this->aConfig[$key] )) { - if (isset( $data ) && is_array( $data )) - foreach ($data as $k => $v) - $this->aConfig[$key] = str_replace( '@' . $k, $v, $this->aConfig[$key] ); + if (isset($key)) { + if (isset($this->aConfig[$key])) { + if (isset($data) && is_array($data)) { + foreach ($data as $k => $v) { + $this->aConfig[$key] = str_replace('@' . $k, $v, $this->aConfig[$key]); + } + } return $this->aConfig[$key]; - } else + } else { return ''; - } else + } + } else { return $this->aConfig; + } } /** @@ -521,14 +537,14 @@ class Configurations // extends Configuration $caseColumns[] = array("header" => "#", "dataIndex" => "APP_NUMBER", "width" => 45, "align" => "center"); $caseColumns[] = array("header" => "UserUid", "dataIndex" => "USR_UID", "width" => 50, "hidden" => true, "hideable" => false); $caseColumns[] = array("header" => "PreUsrUid", "dataIndex" => "PREVIOUS_USR_UID", "width" => 50, "hidden" => true, "hideable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_DUE_DATE") : "**ID_DUE_DATE**", "dataIndex" => "DEL_TASK_DUE_DATE", "width" => 110); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 110); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_PRIORITY") : "**ID_PRIORITY**", "dataIndex" => "DEL_PRIORITY", "width" => 50); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_DUE_DATE") : "**ID_DUE_DATE**", "dataIndex" => "DEL_TASK_DUE_DATE", "width" => 110); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 110); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_PRIORITY") : "**ID_PRIORITY**", "dataIndex" => "DEL_PRIORITY", "width" => 50); $caseReaderFields[] = array("name" => "APP_UID"); $caseReaderFields[] = array("name" => "USR_UID"); @@ -552,15 +568,15 @@ class Configurations // extends Configuration case "paused": $caseColumns[] = array("header" => "#", "dataIndex" => "APP_NUMBER", "width" => 45, "align" => "center"); $caseColumns[] = array("header" => "UserUid", "dataIndex" => "USR_UID", "width" => 50, "hidden" => true, "hideable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SENT_BY") : "**ID_SENT_BY**", "dataIndex" => "APP_DEL_PREVIOUS_USER", "width" => 90); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 80); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_THREAD_INDEX") : "**ID_THREAD_INDEX**", "dataIndex" => "APP_THREAD_INDEX", "width" => 80); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_DEL_INDEX") : "**ID_DEL_INDEX**", "dataIndex" => "DEL_INDEX", "width" => 80); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_SENT_BY") : "**ID_SENT_BY**", "dataIndex" => "APP_DEL_PREVIOUS_USER", "width" => 90); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 80); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_THREAD_INDEX") : "**ID_THREAD_INDEX**", "dataIndex" => "APP_THREAD_INDEX", "width" => 80); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_DEL_INDEX") : "**ID_DEL_INDEX**", "dataIndex" => "DEL_INDEX", "width" => 80); $caseReaderFields[] = array("name" => "APP_UID"); $caseReaderFields[] = array("name" => "USR_UID"); @@ -588,14 +604,14 @@ class Configurations // extends Configuration case "unassigned": $caseColumns[] = array("header" => "#", "dataIndex" => "APP_NUMBER", "width" => 45, "align" => "center"); $caseColumns[] = array("header" => "UserUid", "dataIndex" => "USR_UID", "width" => 50, "hidden" => true, "hideable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SENT_BY") : "**ID_SENT_BY**", "dataIndex" => "APP_DEL_PREVIOUS_USER", "width" => 90); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_DUE_DATE") : "**ID_DUE_DATE**", "dataIndex" => "DEL_TASK_DUE_DATE", "width" => 110); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 80); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_SENT_BY") : "**ID_SENT_BY**", "dataIndex" => "APP_DEL_PREVIOUS_USER", "width" => 90); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_DUE_DATE") : "**ID_DUE_DATE**", "dataIndex" => "DEL_TASK_DUE_DATE", "width" => 110); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 80); //$caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_COMPLETED_BY_USER") : "**ID_COMPLETED_BY_USER**", "dataIndex" => "APP_CURRENT_USER", "width" => 110); //$caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_FINISH_DATE") : "**ID_FINISH_DATE**", "dataIndex" => "APP_FINISH_DATE", "width" => 50); @@ -626,14 +642,14 @@ class Configurations // extends Configuration $caseColumns[] = array("header" => "#", "dataIndex" => "APP_NUMBER", "width" => 45, "align" => "center"); $caseColumns[] = array("header" => "UserUid", "dataIndex" => "USR_UID", "width" => 50, "hidden" => true, "hideable" => false); $caseColumns[] = array("header" => "PreUsrUid", "dataIndex" => "PREVIOUS_USR_UID", "width" => 50, "hidden" => true, "hideable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CURRENT_USER") : "**ID_CURRENT_USER**", "dataIndex" => "APP_CURRENT_USER", "width" => 120, "sortable" => true); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 80); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_STATUS") : "**ID_STATUS**", "dataIndex" => "APP_STATUS", "width" => 50); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CURRENT_USER") : "**ID_CURRENT_USER**", "dataIndex" => "APP_CURRENT_USER", "width" => 120, "sortable" => true); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 80); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_STATUS") : "**ID_STATUS**", "dataIndex" => "APP_STATUS", "width" => 50); $caseReaderFields[] = array("name" => "APP_UID"); $caseReaderFields[] = array("name" => "USR_UID"); @@ -662,17 +678,17 @@ class Configurations // extends Configuration $caseColumns[] = array("header" => "#", "dataIndex" => "APP_NUMBER", "width" => 45, "align" => "center"); $caseColumns[] = array("header" => "UserUid", "dataIndex" => "USR_UID", "width" => 50, "hidden" => true, "hideable" => false); $caseColumns[] = array("header" => "PreUsrUid", "dataIndex" => "PREVIOUS_USR_UID", "width" => 50, "hidden" => true, "hideable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); //$caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SENT_BY") : "**ID_SENT_BY**", "dataIndex" => "APP_DEL_PREVIOUS_USER", "width" => 120 ); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CURRENT_USER") : "**ID_CURRENT_USER**", "dataIndex" => "APP_CURRENT_USER", "width" => 120, "sortable" => true); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 80); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_DELEGATION_DATE") : "**ID_DELEGATION_DATE**", "dataIndex" => "DEL_DELEGATE_DATE", "width" => 80); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_DUE_DATE") : "**ID_DUE_DATE**", "dataIndex" => "DEL_TASK_DUE_DATE", "width" => 80); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_STATUS") : "**ID_STATUS**", "dataIndex" => "APP_STATUS", "width" => 50); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CURRENT_USER") : "**ID_CURRENT_USER**", "dataIndex" => "APP_CURRENT_USER", "width" => 120, "sortable" => true); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 80); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_DELEGATION_DATE") : "**ID_DELEGATION_DATE**", "dataIndex" => "DEL_DELEGATE_DATE", "width" => 80); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_DUE_DATE") : "**ID_DUE_DATE**", "dataIndex" => "DEL_TASK_DUE_DATE", "width" => 80); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_STATUS") : "**ID_STATUS**", "dataIndex" => "APP_STATUS", "width" => 50); $caseReaderFields[] = array("name" => "APP_UID"); $caseReaderFields[] = array("name" => "USR_UID"); @@ -696,19 +712,19 @@ class Configurations // extends Configuration break; case "to_revise": $caseColumns[] = array("header" => "#", "dataIndex" => "APP_NUMBER", "width" => 45, "align" => "center"); - $caseColumns[] = array("header" => "UserUid", "dataIndex" => "USR_UID", "width" => 50,"hidden" => true, "hideable" => false); + $caseColumns[] = array("header" => "UserUid", "dataIndex" => "USR_UID", "width" => 50, "hidden" => true, "hideable" => false); $caseColumns[] = array("header" => "PreUsrUid", "dataIndex" => "PREVIOUS_USR_UID", "width" => 50, "hidden" => true, "hideable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SENT_BY") : "**ID_SENT_BY**", "dataIndex" => "APP_DEL_PREVIOUS_USER", "width" => 90); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CURRENT_USER") : "**ID_CURRENT_USER**", "dataIndex" => "APP_CURRENT_USER", "width" => 90, "sortable" => true); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_SENT_BY") : "**ID_SENT_BY**", "dataIndex" => "APP_DEL_PREVIOUS_USER", "width" => 90); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CURRENT_USER") : "**ID_CURRENT_USER**", "dataIndex" => "APP_CURRENT_USER", "width" => 90, "sortable" => true); //$caseColumns[] = array("header" => "Sent By", "dataIndex" => "APP_DEL_PREVIOUS_USER", "width" => 90); //$caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 110); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_PRIORITY") : "**ID_PRIORITY**", "dataIndex" => "DEL_PRIORITY", "width" => 50); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_STATUS") : "**ID_STATUS**", "dataIndex" => "APP_STATUS", "width" => 50); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_PRIORITY") : "**ID_PRIORITY**", "dataIndex" => "DEL_PRIORITY", "width" => 50); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_STATUS") : "**ID_STATUS**", "dataIndex" => "APP_STATUS", "width" => 50); $caseReaderFields[] = array("name" => "APP_UID"); $caseReaderFields[] = array("name" => "USR_UID"); @@ -736,15 +752,15 @@ class Configurations // extends Configuration $caseColumns[] = array("header" => "#", "dataIndex" => "APP_NUMBER", "width" => 45, "align" => "center"); $caseColumns[] = array("header" => "UserUid", "dataIndex" => "USR_UID", "width" => 50, "hidden" => true, "hideable" => false); $caseColumns[] = array("header" => "PreUsrUid", "dataIndex" => "PREVIOUS_USR_UID", "width" => 50, "hidden" => true, "hideable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CURRENT_USER") : "**ID_CURRENT_USER**", "dataIndex" => "APP_CURRENT_USER", "width" => 90, "sortable" => true); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CURRENT_USER") : "**ID_CURRENT_USER**", "dataIndex" => "APP_CURRENT_USER", "width" => 90, "sortable" => true); //$caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SENT_BY") : "**ID_SENT_BY**", "dataIndex" => "APP_DEL_PREVIOUS_USER", "width" => 90); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 110); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_STATUS") : "**ID_STATUS**", "dataIndex" => "APP_STATUS", "width" => 50); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 110); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_STATUS") : "**ID_STATUS**", "dataIndex" => "APP_STATUS", "width" => 50); $caseReaderFields[] = array("name" => "TAS_UID"); $caseReaderFields[] = array("name" => "DEL_INDEX"); @@ -766,15 +782,15 @@ class Configurations // extends Configuration $caseColumns[] = array("header" => "#", "dataIndex" => "APP_NUMBER", "width" => 45, "align" => "center"); $caseColumns[] = array("header" => "UserUid", "dataIndex" => "USR_UID", "width" => 50, "hidden" => true, "hideable" => false); $caseColumns[] = array("header" => "PreUsrUid", "dataIndex" => "PREVIOUS_USR_UID", "width" => 50, "hidden" => true, "hideable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CURRENT_USER") : "**ID_CURRENT_USER**", "dataIndex" => "APP_CURRENT_USER", "width" => 90, "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SENT_BY") : "**ID_SENT_BY**", "dataIndex" => "APP_DEL_PREVIOUS_USER", "width" => 90); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 110); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_STATUS") : "**ID_STATUS**", "dataIndex" => "APP_STATUS", "width" => 50); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CURRENT_USER") : "**ID_CURRENT_USER**", "dataIndex" => "APP_CURRENT_USER", "width" => 90, "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_SENT_BY") : "**ID_SENT_BY**", "dataIndex" => "APP_DEL_PREVIOUS_USER", "width" => 90); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 110); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_STATUS") : "**ID_STATUS**", "dataIndex" => "APP_STATUS", "width" => 50); $caseReaderFields[] = array("name" => "APP_UID"); $caseReaderFields[] = array("name" => "USR_UID"); @@ -795,15 +811,15 @@ class Configurations // extends Configuration //todo $caseColumns[] = array("header" => "#", "dataIndex" => "APP_NUMBER", "width" => 45, "align" => "center"); $caseColumns[] = array("header" => "UserUid", "dataIndex" => "USR_UID", "width" => 50, "hidden" => true, "hideable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_SENT_BY") : "**ID_SENT_BY**", "dataIndex" => "APP_DEL_PREVIOUS_USER", "width" => 90); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_DUE_DATE") : "**ID_DUE_DATE**", "dataIndex" => "DEL_TASK_DUE_DATE", "width" => 110); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 110); - $caseColumns[] = array("header" => ($translation == 1)? G::LoadTranslation("ID_PRIORITY") : "**ID_PRIORITY**", "dataIndex" => "DEL_PRIORITY", "width" => 50); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_SUMMARY") : "**ID_SUMMARY**", "dataIndex" => "CASE_SUMMARY", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASES_NOTES") : "**ID_CASES_NOTES**", "dataIndex" => "CASE_NOTES_COUNT", "width" => 45, "align" => "center", "sortable" => false); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_CASE") : "**ID_CASE**", "dataIndex" => "APP_TITLE", "width" => 150); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_PROCESS") : "**ID_PROCESS**", "dataIndex" => "APP_PRO_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_TASK") : "**ID_TASK**", "dataIndex" => "APP_TAS_TITLE", "width" => 120); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_SENT_BY") : "**ID_SENT_BY**", "dataIndex" => "APP_DEL_PREVIOUS_USER", "width" => 90); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_DUE_DATE") : "**ID_DUE_DATE**", "dataIndex" => "DEL_TASK_DUE_DATE", "width" => 110); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_LAST_MODIFY") : "**ID_LAST_MODIFY**", "dataIndex" => "APP_UPDATE_DATE", "width" => 110); + $caseColumns[] = array("header" => ($translation == 1) ? G::LoadTranslation("ID_PRIORITY") : "**ID_PRIORITY**", "dataIndex" => "DEL_PRIORITY", "width" => 50); $caseReaderFields[] = array("name" => "APP_UID"); $caseReaderFields[] = array("name" => "USR_UID"); @@ -831,4 +847,4 @@ class Configurations // extends Configuration return array("caseColumns" => $caseColumns, "caseReaderFields" => $caseReaderFields, "rowsperpage" => 20, "dateformat" => "M d, Y"); } } - + \ No newline at end of file diff --git a/workflow/engine/classes/class.toolBar.php b/workflow/engine/classes/class.toolBar.php index 23ed05246..1fc354c1e 100755 --- a/workflow/engine/classes/class.toolBar.php +++ b/workflow/engine/classes/class.toolBar.php @@ -33,8 +33,8 @@ */ class ToolBar extends form { - var $type = 'toolbar'; - var $align = 'left'; + public $type = 'toolbar'; + public $align = 'left'; } /** @@ -44,11 +44,12 @@ class ToolBar extends form */ class XmlForm_Field_ToolBar extends XmlForm_Field { - var $xmlfile = ''; - var $type = 'toolbar'; - var $toolBar; - var $home = ''; - var $withoutLabel = true; + + public $xmlfile = ''; + public $type = 'toolbar'; + public $toolBar; + public $home = ''; + public $withoutLabel = true; /** * Constructor of the class XmlForm_Field_ToolBar @@ -59,9 +60,9 @@ class XmlForm_Field_ToolBar extends XmlForm_Field * @param string $owner * @return void */ - function XmlForm_Field_ToolBar ($xmlNode, $lang = 'en', $home = '', $owner) + public function XmlForm_Field_ToolBar($xmlNode, $lang = 'en', $home = '', $owner = ' ') { - parent::XmlForm_Field( $xmlNode, $lang, $home, $owner ); + parent::XmlForm_Field($xmlNode, $lang, $home, $owner); $this->home = $home; } @@ -71,14 +72,14 @@ class XmlForm_Field_ToolBar extends XmlForm_Field * @param string $value * @return string */ - function render ($value) + public function render($value) { - $this->toolBar = new toolBar( $this->xmlfile, $this->home ); + $this->toolBar = new toolBar($this->xmlfile, $this->home); $template = PATH_CORE . 'templates/' . $this->type . '.html'; - $out = $this->toolBar->render( $template, $scriptCode ); + $out = $this->toolBar->render($template, $scriptCode); $oHeadPublisher = & headPublisher::getSingleton(); - $oHeadPublisher->addScriptFile( $this->toolBar->scriptURL ); - $oHeadPublisher->addScriptCode( $scriptCode ); + $oHeadPublisher->addScriptFile($this->toolBar->scriptURL); + $oHeadPublisher->addScriptCode($scriptCode); return $out; } } @@ -90,23 +91,24 @@ class XmlForm_Field_ToolBar extends XmlForm_Field */ class XmlForm_Field_toolButton extends XmlForm_Field { - var $file = ''; - var $fileAlt = ''; - var $url = ''; - var $urlAlt = ''; - var $home = 'public_html'; + + public $file = ''; + public $fileAlt = ''; + public $url = ''; + public $urlAlt = ''; + public $home = 'public_html'; /* types of buttons: * image * text * image/text * text/image */ - var $buttonType = 'image'; - var $withoutLabel = false; - var $buttonStyle = ''; - /*$hoverMethod : back | switch*/ - var $hoverMethod = 'back'; - var $class; + public $buttonType = 'image'; + public $withoutLabel = false; + public $buttonStyle = ''; + /* $hoverMethod : back | switch */ + public $hoverMethod = 'back'; + public $class; /** * Prints the components of the toolBar @@ -114,19 +116,23 @@ class XmlForm_Field_toolButton extends XmlForm_Field * @param string $value * @return string */ - function render ($value) + public function render($value) { $url = $this->file; - if ($this->home === "methods") - $url = G::encryptlink( SYS_URI . $url ); - if ($this->home === "public_html") + if ($this->home === "methods") { + $url = G::encryptlink(SYS_URI . $url); + } + if ($this->home === "public_html") { $url = '/' . $url; + } $urlAlt = $this->fileAlt; if ($this->fileAlt !== '') { - if ($this->home === "methods") - $urlAlt = G::encryptlink( SYS_URI . $urlAlt ); - if ($this->home === "public_html") + if ($this->home === "methods") { + $urlAlt = G::encryptlink(SYS_URI . $urlAlt); + } + if ($this->home === "public_html") { $urlAlt = '/' . $urlAlt; + } } $this->url = $url; $this->urlAlt = $urlAlt; @@ -134,26 +140,26 @@ class XmlForm_Field_toolButton extends XmlForm_Field case 'image': $html = ''; if ($this->hoverMethod === 'back') { - $html = 'style) ? ' style="' . $this->style . '"' : '') . ' onmouseover=\'backImage(this,"url(' . htmlentities( $urlAlt, ENT_QUOTES, 'utf-8' ) . ') no-repeat")\' onmouseout=\'backImage(this,"")\' title=\'' . addslashes( $this->label ) . '\' />'; + $html = 'style) ? ' style="' . $this->style . '"' : '') . ' onmouseover=\'backImage(this,"url(' . htmlentities($urlAlt, ENT_QUOTES, 'utf-8') . ') no-repeat")\' onmouseout=\'backImage(this,"")\' title=\'' . addslashes($this->label) . '\' />'; } elseif ($this->hoverMethod === 'switch') { - $html = 'style) ? ' style="' . $this->style . '"' : '') . ' onmouseover=\'switchImage(this,"' . htmlentities( $url, ENT_QUOTES, 'utf-8' ) . '","' . htmlentities( $urlAlt, ENT_QUOTES, 'utf-8' ) . '")\' onmouseout=\'switchImage(this,"' . htmlentities( $url, ENT_QUOTES, 'utf-8' ) . '","' . htmlentities( $urlAlt, ENT_QUOTES, 'utf-8' ) . '")\'/>'; + $html = 'style) ? ' style="' . $this->style . '"' : '') . ' onmouseover=\'switchImage(this,"' . htmlentities($url, ENT_QUOTES, 'utf-8') . '","' . htmlentities($urlAlt, ENT_QUOTES, 'utf-8') . '")\' onmouseout=\'switchImage(this,"' . htmlentities($url, ENT_QUOTES, 'utf-8') . '","' . htmlentities($urlAlt, ENT_QUOTES, 'utf-8') . '")\'/>'; } else { - $html = 'style) ? ' style="' . $this->style . '"' : '') . '/>'; + $html = 'style) ? ' style="' . $this->style . '"' : '') . '/>'; } break; case 'text': - $html = $this->htmlentities( $this->label, ENT_QUOTES, 'utf-8' ); + $html = $this->htmlentities($this->label, ENT_QUOTES, 'utf-8'); break; case 'html': - $html = '
' . $this->label . '
'; + $html = '
' . $this->label . '
'; //$html=$this->label; break; case 'image/text': - $html = 'style) ? ' style="' . $this->style . '"' : '') . '/>
' . $this->htmlentities( $this->label, ENT_QUOTES, 'utf-8' ); + $html = 'style) ? ' style="' . $this->style . '"' : '') . '/>
' . $this->htmlentities($this->label, ENT_QUOTES, 'utf-8'); break; case 'text/image': - $html = $this->htmlentities( $this->label, ENT_QUOTES, 'utf-8' ) . '
style) ? ' style="' . $this->style . '"' : '') . '/>'; + $html = $this->htmlentities($this->label, ENT_QUOTES, 'utf-8') . '
style) ? ' style="' . $this->style . '"' : '') . '/>'; break; case 'dropdown': $html = ''; @@ -180,12 +186,11 @@ class XmlForm_Field_toolButton extends XmlForm_Field break; case 'class': $html = ' -
+
'; return $html; - } - return 'buttonStyle) ? ' style="' . $this->buttonStyle . '"' : '') . (($this->onclick) ? ' onclick="' . htmlentities( $this->onclick, ENT_QUOTES, 'utf-8' ) . '"' : '') . '>' . $html . ''; + return 'buttonStyle) ? ' style="' . $this->buttonStyle . '"' : '') . (($this->onclick) ? ' onclick="' . htmlentities($this->onclick, ENT_QUOTES, 'utf-8') . '"' : '') . '>' . $html . ''; } } -?> + \ No newline at end of file From f92822d87b0d623cc5e251407e45cce8ee10b723 Mon Sep 17 00:00:00 2001 From: Hector Cortez Date: Tue, 5 Mar 2013 15:07:55 -0400 Subject: [PATCH 2/2] BUG 0000 Adjustment for the standardization of code. CODE_STYLE --- workflow/engine/classes/class.webdav.php | 667 +++++++++--------- .../methods/processes/processes_Ajax.php | 513 +++++++------- workflow/engine/methods/users/usersAjax.php | 441 ++++++------ workflow/engine/methods/users/users_Ajax.php | 357 +++++----- 4 files changed, 975 insertions(+), 1003 deletions(-) diff --git a/workflow/engine/classes/class.webdav.php b/workflow/engine/classes/class.webdav.php index 1564bed9a..7683417dd 100755 --- a/workflow/engine/classes/class.webdav.php +++ b/workflow/engine/classes/class.webdav.php @@ -1,10 +1,10 @@ base = '/'; $this->uriBase = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/webdav/'; @@ -51,7 +52,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param string Password * @return bool true on successful authentication */ - function check_auth ($type, $user, $pass) + public function check_auth($type, $user, $pass) { return true; } @@ -63,201 +64,192 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param array return array for file properties * @return bool true on success */ - function PROPFIND (&$options, &$files) + public function PROPFIND(&$options, &$files) { $paths = $this->paths; // prepare property array - $files["files"] = array (); + $files["files"] = array(); $pathClasses = PATH_DB . PATH_SEP . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; - if (count( $paths ) == 0 && is_dir( $pathClasses )) { - $props = array (); - $props[] = $this->mkprop( "displayname", 'Classes' ); - $props[] = $this->mkprop( "creationdate", filectime( $pathClasses ) ); - $props[] = $this->mkprop( "getlastmodified", filemtime( $pathClasses ) ); - $props[] = $this->mkprop( "lastaccessed", filemtime( $pathClasses ) ); - $props[] = $this->mkprop( "resourcetype", 'collection' ); - $props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' ); - $files["files"][] = array ('path' => 'classes','props' => $props + if (count($paths) == 0 && is_dir($pathClasses)) { + $props = array(); + $props[] = $this->mkprop("displayname", 'Classes'); + $props[] = $this->mkprop("creationdate", filectime($pathClasses)); + $props[] = $this->mkprop("getlastmodified", filemtime($pathClasses)); + $props[] = $this->mkprop("lastaccessed", filemtime($pathClasses)); + $props[] = $this->mkprop("resourcetype", 'collection'); + $props[] = $this->mkprop("getcontenttype", 'httpd/unix-directory'); + $files["files"][] = array('path' => 'classes', 'props' => $props ); } - if (count( $paths ) > 0 && $paths[0] == 'classes' && is_dir( $pathClasses )) { + if (count($paths) > 0 && $paths[0] == 'classes' && is_dir($pathClasses)) { // try to open directory - $handle = @opendir( $pathClasses ); + $handle = @opendir($pathClasses); if ($handle) { - while ($filename = readdir( $handle )) { - $ext = array_pop( explode( '.', $filename ) ); - if ($filename != "." && $filename != ".." && ! is_dir( $pathClasses . $filename ) && $ext == 'php') { - $props = array (); - $props[] = $this->mkprop( "displayname", $filename ); - $props[] = $this->mkprop( "creationdate", filectime( $pathClasses . $filename ) ); - $props[] = $this->mkprop( "getlastmodified", filemtime( $pathClasses . $filename ) ); - $props[] = $this->mkprop( "getetag", fileatime( $pathClasses . $filename ) ); - $props[] = $this->mkprop( "lastaccessed", filemtime( $pathClasses . $filename ) ); - $props[] = $this->mkprop( "resourcetype", '' ); - $props[] = $this->mkprop( "getcontenttype", 'text/plain' ); - $props[] = $this->mkprop( "getcontentlength", filesize( $pathClasses . $filename ) ); - if (count( $paths ) == 1 || (count( $paths ) == 2 && $paths[1] == $filename)) - $files["files"][] = array ('path' => "classes/$filename",'props' => $props - ); + while ($filename = readdir($handle)) { + $ext = array_pop(explode('.', $filename)); + if ($filename != "." && $filename != ".." && !is_dir($pathClasses . $filename) && $ext == 'php') { + $props = array(); + $props[] = $this->mkprop("displayname", $filename); + $props[] = $this->mkprop("creationdate", filectime($pathClasses . $filename)); + $props[] = $this->mkprop("getlastmodified", filemtime($pathClasses . $filename)); + $props[] = $this->mkprop("getetag", fileatime($pathClasses . $filename)); + $props[] = $this->mkprop("lastaccessed", filemtime($pathClasses . $filename)); + $props[] = $this->mkprop("resourcetype", ''); + $props[] = $this->mkprop("getcontenttype", 'text/plain'); + $props[] = $this->mkprop("getcontentlength", filesize($pathClasses . $filename)); + if (count($paths) == 1 || (count($paths) == 2 && $paths[1] == $filename)) { + $files["files"][] = array('path' => "classes/$filename", 'props' => $props); + } } } } - } //path classes $pathProcesses = PATH_DB . SYS_SYS . PATH_SEP; - if (count( $paths ) == 0 && is_dir( $pathProcesses )) { - $props = array (); - $props[] = $this->mkprop( "displayname", 'Processes' ); - $props[] = $this->mkprop( "creationdate", filectime( $pathProcesses ) ); - $props[] = $this->mkprop( "getlastmodified", filemtime( $pathProcesses ) ); - $props[] = $this->mkprop( "resourcetype", 'collection' ); - $props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' ); - $files["files"][] = array ('path' => 'processes','props' => $props + if (count($paths) == 0 && is_dir($pathProcesses)) { + $props = array(); + $props[] = $this->mkprop("displayname", 'Processes'); + $props[] = $this->mkprop("creationdate", filectime($pathProcesses)); + $props[] = $this->mkprop("getlastmodified", filemtime($pathProcesses)); + $props[] = $this->mkprop("resourcetype", 'collection'); + $props[] = $this->mkprop("getcontenttype", 'httpd/unix-directory'); + $files["files"][] = array('path' => 'processes', 'props' => $props ); } //list all active processes - if (count( $paths ) == 1 && $paths[0] == 'processes' && is_dir( $pathProcesses )) { + if (count($paths) == 1 && $paths[0] == 'processes' && is_dir($pathProcesses)) { // try to get the process directory list - G::LoadClass( 'processMap' ); - G::LoadClass( 'model/Process' ); + G::LoadClass('processMap'); + G::LoadClass('model/Process'); $oProcessMap = new processMap(); $oProcess = new Process(); $c = $oProcessMap->getConditionProcessList(); - $oDataset = ProcessPeer::doSelectRS( $c ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset = ProcessPeer::doSelectRS($c); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { if ($aRow['PRO_STATUS'] == 'ACTIVE') { - $aProcess = $oProcess->load( $aRow['PRO_UID'] ); - $props = array (); - $props[] = $this->mkprop( "displayname", $aProcess['PRO_TITLE'] ); - $props[] = $this->mkprop( "creationdate", filectime( $pathProcesses ) ); - $props[] = $this->mkprop( "getlastmodified", filemtime( $pathProcesses ) ); - $props[] = $this->mkprop( "lastaccessed", filemtime( $pathProcesses ) ); - $props[] = $this->mkprop( "resourcetype", 'collection' ); - $props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' ); - $files["files"][] = array ('path' => "processes/" . $aRow['PRO_UID'],'props' => $props + $aProcess = $oProcess->load($aRow['PRO_UID']); + $props = array(); + $props[] = $this->mkprop("displayname", $aProcess['PRO_TITLE']); + $props[] = $this->mkprop("creationdate", filectime($pathProcesses)); + $props[] = $this->mkprop("getlastmodified", filemtime($pathProcesses)); + $props[] = $this->mkprop("lastaccessed", filemtime($pathProcesses)); + $props[] = $this->mkprop("resourcetype", 'collection'); + $props[] = $this->mkprop("getcontenttype", 'httpd/unix-directory'); + $files["files"][] = array('path' => "processes/" . $aRow['PRO_UID'], 'props' => $props ); } $oDataset->next(); } } //dir of processes - - //content of any process ( the three major folders of Processes ) $pathXmlform = $pathProcesses . 'xmlForms' . PATH_SEP; - if (count( $paths ) == 2 && $paths[0] == 'processes' && is_dir( $pathProcesses )) { - $props = array (); - $props[] = $this->mkprop( "displayname", 'xmlforms' ); - $props[] = $this->mkprop( "creationdate", filectime( $pathXmlform ) ); - $props[] = $this->mkprop( "getlastmodified", filemtime( $pathXmlform ) ); - $props[] = $this->mkprop( "lastaccessed", filemtime( $pathXmlform ) ); - $props[] = $this->mkprop( "resourcetype", 'collection' ); - $props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' ); - $files["files"][] = array ('path' => 'processes/' . $paths[1] . '/xmlforms','props' => $props + if (count($paths) == 2 && $paths[0] == 'processes' && is_dir($pathProcesses)) { + $props = array(); + $props[] = $this->mkprop("displayname", 'xmlforms'); + $props[] = $this->mkprop("creationdate", filectime($pathXmlform)); + $props[] = $this->mkprop("getlastmodified", filemtime($pathXmlform)); + $props[] = $this->mkprop("lastaccessed", filemtime($pathXmlform)); + $props[] = $this->mkprop("resourcetype", 'collection'); + $props[] = $this->mkprop("getcontenttype", 'httpd/unix-directory'); + $files["files"][] = array('path' => 'processes/' . $paths[1] . '/xmlforms', 'props' => $props ); - $props[] = $this->mkprop( "displayname", 'mailTemplates' ); - $props[] = $this->mkprop( "creationdate", filectime( $pathProcesses ) ); - $props[] = $this->mkprop( "getlastmodified", filemtime( $pathProcesses ) ); - $props[] = $this->mkprop( "lastaccessed", filemtime( $pathProcesses ) ); - $props[] = $this->mkprop( "resourcetype", 'collection' ); - $props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' ); - $files["files"][] = array ('path' => 'processes/' . $paths[1] . '/mailTemplates','props' => $props + $props[] = $this->mkprop("displayname", 'mailTemplates'); + $props[] = $this->mkprop("creationdate", filectime($pathProcesses)); + $props[] = $this->mkprop("getlastmodified", filemtime($pathProcesses)); + $props[] = $this->mkprop("lastaccessed", filemtime($pathProcesses)); + $props[] = $this->mkprop("resourcetype", 'collection'); + $props[] = $this->mkprop("getcontenttype", 'httpd/unix-directory'); + $files["files"][] = array('path' => 'processes/' . $paths[1] . '/mailTemplates', 'props' => $props ); - $props[] = $this->mkprop( "displayname", 'public_html' ); - $props[] = $this->mkprop( "creationdate", filectime( $pathProcesses ) ); - $props[] = $this->mkprop( "getlastmodified", filemtime( $pathProcesses ) ); - $props[] = $this->mkprop( "lastaccessed", filemtime( $pathProcesses ) ); - $props[] = $this->mkprop( "resourcetype", 'collection' ); - $props[] = $this->mkprop( "getcontenttype", 'httpd/unix-directory' ); - $files["files"][] = array ('path' => 'processes/' . $paths[1] . '/public_html','props' => $props + $props[] = $this->mkprop("displayname", 'public_html'); + $props[] = $this->mkprop("creationdate", filectime($pathProcesses)); + $props[] = $this->mkprop("getlastmodified", filemtime($pathProcesses)); + $props[] = $this->mkprop("lastaccessed", filemtime($pathProcesses)); + $props[] = $this->mkprop("resourcetype", 'collection'); + $props[] = $this->mkprop("getcontenttype", 'httpd/unix-directory'); + $files["files"][] = array('path' => 'processes/' . $paths[1] . '/public_html', 'props' => $props ); } //content of any processes - - //list available xmlforms - if (count( $paths ) == 3 && $paths[0] == 'processes' && $paths[2] == 'xmlforms' && is_dir( $pathXmlform )) { + if (count($paths) == 3 && $paths[0] == 'processes' && $paths[2] == 'xmlforms' && is_dir($pathXmlform)) { $pathXmlform = $pathProcesses . 'xmlForms' . PATH_SEP . $paths[1] . PATH_SEP; - $handle = @opendir( $pathXmlform ); + $handle = @opendir($pathXmlform); if ($handle) { - while ($filename = readdir( $handle )) { - $ext = array_pop( explode( '.', $filename ) ); - if ($filename != "." && $filename != ".." && ! is_dir( $pathXmlform . $filename ) && ($ext == 'xml' || $ext == 'html')) { - $props = array (); - $props[] = $this->mkprop( "displayname", $filename ); - $props[] = $this->mkprop( "creationdate", filectime( $pathXmlform . $filename ) ); - $props[] = $this->mkprop( "getlastmodified", filemtime( $pathXmlform . $filename ) ); - $props[] = $this->mkprop( "getetag", fileatime( $pathXmlform . $filename ) ); - $props[] = $this->mkprop( "lastaccessed", filemtime( $pathXmlform . $filename ) ); - $props[] = $this->mkprop( "resourcetype", '' ); - $props[] = $this->mkprop( "getcontenttype", 'text/plain' ); - $props[] = $this->mkprop( "getcontentlength", filesize( $pathXmlform . $filename ) ); + while ($filename = readdir($handle)) { + $ext = array_pop(explode('.', $filename)); + if ($filename != "." && $filename != ".." && !is_dir($pathXmlform . $filename) && ($ext == 'xml' || $ext == 'html')) { + $props = array(); + $props[] = $this->mkprop("displayname", $filename); + $props[] = $this->mkprop("creationdate", filectime($pathXmlform . $filename)); + $props[] = $this->mkprop("getlastmodified", filemtime($pathXmlform . $filename)); + $props[] = $this->mkprop("getetag", fileatime($pathXmlform . $filename)); + $props[] = $this->mkprop("lastaccessed", filemtime($pathXmlform . $filename)); + $props[] = $this->mkprop("resourcetype", ''); + $props[] = $this->mkprop("getcontenttype", 'text/plain'); + $props[] = $this->mkprop("getcontentlength", filesize($pathXmlform . $filename)); //if ( count( $paths ) == 1 || ( count( $paths ) == 2 && $paths[1] == $filename ) ) - $files["files"][] = array ('path' => 'processes/' . $paths[1] . '/xmlforms/' . $filename,'props' => $props + $files["files"][] = array('path' => 'processes/' . $paths[1] . '/xmlforms/' . $filename, 'props' => $props ); } } } } //content of xmlforms - - //list available mailTemplates $pathTemplates = $pathProcesses . 'mailTemplates' . PATH_SEP; - if (count( $paths ) == 3 && $paths[0] == 'processes' && $paths[2] == 'mailTemplates' && is_dir( $pathTemplates )) { + if (count($paths) == 3 && $paths[0] == 'processes' && $paths[2] == 'mailTemplates' && is_dir($pathTemplates)) { $pathTemplates = $pathProcesses . 'mailTemplates' . PATH_SEP . $paths[1] . PATH_SEP; - $handle = @opendir( $pathTemplates ); + $handle = @opendir($pathTemplates); if ($handle) { - while ($filename = readdir( $handle )) { - $ext = array_pop( explode( '.', $filename ) ); - if ($filename != "." && $filename != ".." && ! is_dir( $pathTemplates . $filename ) /* && ( $ext == 'xml' || $ext == 'html' ) */ ) { - $props = array (); - $props[] = $this->mkprop( "displayname", $filename ); - $props[] = $this->mkprop( "creationdate", filectime( $pathTemplates . $filename ) ); - $props[] = $this->mkprop( "getlastmodified", filemtime( $pathTemplates . $filename ) ); - $props[] = $this->mkprop( "getetag", fileatime( $pathTemplates . $filename ) ); - $props[] = $this->mkprop( "lastaccessed", filemtime( $pathTemplates . $filename ) ); - $props[] = $this->mkprop( "resourcetype", '' ); - $props[] = $this->mkprop( "getcontenttype", 'text/plain' ); - $props[] = $this->mkprop( "getcontentlength", filesize( $pathTemplates . $filename ) ); + while ($filename = readdir($handle)) { + $ext = array_pop(explode('.', $filename)); + if ($filename != "." && $filename != ".." && !is_dir($pathTemplates . $filename) /* && ( $ext == 'xml' || $ext == 'html' ) */) { + $props = array(); + $props[] = $this->mkprop("displayname", $filename); + $props[] = $this->mkprop("creationdate", filectime($pathTemplates . $filename)); + $props[] = $this->mkprop("getlastmodified", filemtime($pathTemplates . $filename)); + $props[] = $this->mkprop("getetag", fileatime($pathTemplates . $filename)); + $props[] = $this->mkprop("lastaccessed", filemtime($pathTemplates . $filename)); + $props[] = $this->mkprop("resourcetype", ''); + $props[] = $this->mkprop("getcontenttype", 'text/plain'); + $props[] = $this->mkprop("getcontentlength", filesize($pathTemplates . $filename)); //if ( count( $paths ) == 1 || ( count( $paths ) == 2 && $paths[1] == $filename ) ) - $files["files"][] = array ('path' => 'processes/' . $paths[1] . '/mailTemplates/' . $filename,'props' => $props + $files["files"][] = array('path' => 'processes/' . $paths[1] . '/mailTemplates/' . $filename, 'props' => $props ); } } } } //content of mailTemplates - - //list available public_html files $pathPublic = $pathProcesses . 'public' . PATH_SEP; - if (count( $paths ) == 3 && $paths[0] == 'processes' && $paths[2] == 'public_html' && is_dir( $pathTemplates )) { + if (count($paths) == 3 && $paths[0] == 'processes' && $paths[2] == 'public_html' && is_dir($pathTemplates)) { $pathPublic = $pathProcesses . 'public' . PATH_SEP . $paths[1] . PATH_SEP; - $handle = @opendir( $pathPublic ); + $handle = @opendir($pathPublic); if ($handle) { - while ($filename = readdir( $handle )) { - $ext = array_pop( explode( '.', $filename ) ); - if ($filename != "." && $filename != ".." && ! is_dir( $pathPublic . $filename ) /* && ( $ext == 'xml' || $ext == 'html' ) */ ) { - $props = array (); - $props[] = $this->mkprop( "displayname", $filename ); - $props[] = $this->mkprop( "creationdate", filectime( $pathPublic . $filename ) ); - $props[] = $this->mkprop( "getlastmodified", filemtime( $pathPublic . $filename ) ); - $props[] = $this->mkprop( "getetag", fileatime( $pathPublic . $filename ) ); - $props[] = $this->mkprop( "lastaccessed", filemtime( $pathPublic . $filename ) ); - $props[] = $this->mkprop( "resourcetype", '' ); - $props[] = $this->mkprop( "getcontenttype", 'text/plain' ); - $props[] = $this->mkprop( "getcontentlength", filesize( $pathPublic . $filename ) ); + while ($filename = readdir($handle)) { + $ext = array_pop(explode('.', $filename)); + if ($filename != "." && $filename != ".." && !is_dir($pathPublic . $filename) /* && ( $ext == 'xml' || $ext == 'html' ) */) { + $props = array(); + $props[] = $this->mkprop("displayname", $filename); + $props[] = $this->mkprop("creationdate", filectime($pathPublic . $filename)); + $props[] = $this->mkprop("getlastmodified", filemtime($pathPublic . $filename)); + $props[] = $this->mkprop("getetag", fileatime($pathPublic . $filename)); + $props[] = $this->mkprop("lastaccessed", filemtime($pathPublic . $filename)); + $props[] = $this->mkprop("resourcetype", ''); + $props[] = $this->mkprop("getcontenttype", 'text/plain'); + $props[] = $this->mkprop("getcontentlength", filesize($pathPublic . $filename)); //if ( count( $paths ) == 1 || ( count( $paths ) == 2 && $paths[1] == $filename ) ) - $files["files"][] = array ('path' => 'processes/' . $paths[1] . '/public_html/' . $filename,'props' => $props + $files["files"][] = array('path' => 'processes/' . $paths[1] . '/public_html/' . $filename, 'props' => $props ); } } @@ -266,15 +258,15 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server /* - if ( 1 ) { - $props = array (); - $props[] = $this->mkprop("displayname", print_r ($pathPublic, 1) ); - $props[] = $this->mkprop("creationdate", filectime( PATH_DB ) ); - $props[] = $this->mkprop("getlastmodified", filemtime( PATH_DB ) ); - $props[] = $this->mkprop("resourcetype", 'collection' ); - $props[] = $this->mkprop("getcontenttype", 'httpd/unix-directory' ); - $files["files"][] = array ( 'path' => '/' , 'props' => $props); - } */ + if ( 1 ) { + $props = array (); + $props[] = $this->mkprop("displayname", print_r ($pathPublic, 1) ); + $props[] = $this->mkprop("creationdate", filectime( PATH_DB ) ); + $props[] = $this->mkprop("getlastmodified", filemtime( PATH_DB ) ); + $props[] = $this->mkprop("resourcetype", 'collection' ); + $props[] = $this->mkprop("getcontenttype", 'httpd/unix-directory' ); + $files["files"][] = array ( 'path' => '/' , 'props' => $props); + } */ // ok, all done return true; @@ -290,38 +282,41 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param string optional search path, defaults to $PATH * @return bool true if executable program found in path */ - function _can_execute ($name, $path = false) + public function _can_execute($name, $path = false) { // path defaults to PATH from environment if not set if ($path === false) { - $path = getenv( "PATH" ); + $path = getenv("PATH"); } // check method depends on operating system - if (! strncmp( PHP_OS, "WIN", 3 )) { + if (!strncmp(PHP_OS, "WIN", 3)) { // on Windows an appropriate COM or EXE file needs to exist - $exts = array (".exe",".com" + $exts = array(".exe", ".com" ); $check_fn = "file_exists"; } else { // anywhere else we look for an executable file of that name - $exts = array ("" + $exts = array("" ); $check_fn = "is_executable"; } // now check the directories in the path for the program - foreach (explode( PATH_SEPARATOR, $path ) as $dir) { + foreach (explode(PATH_SEPARATOR, $path) as $dir) { // skip invalid path entries - if (! file_exists( $dir )) + if (!file_exists($dir)) { continue; - if (! is_dir( $dir )) + } + if (!is_dir($dir)) { continue; + } - // and now look for the file + // and now look for the file foreach ($exts as $ext) { - if ($check_fn( "$dir/$name" . $ext )) + if ($check_fn("$dir/$name" . $ext)) { return true; + } } } @@ -334,37 +329,35 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param string file path * @return string guessed mime type */ - function _mimetype ($fspath) + public function _mimetype($fspath) { - if (@is_dir( $fspath )) { + if (@is_dir($fspath)) { // directories are easy return "httpd/unix-directory"; - } else if (function_exists( "mime_content_type" )) { + } elseif (function_exists("mime_content_type")) { // use mime magic extension if available - $mime_type = mime_content_type( $fspath ); - } else if ($this->_can_execute( "file" )) { + $mime_type = mime_content_type($fspath); + } elseif ($this->_can_execute("file")) { // it looks like we have a 'file' command, // lets see it it does have mime support - $fp = popen( "file -i '$fspath' 2>/dev/null", "r" ); - $reply = fgets( $fp ); - pclose( $fp ); + $fp = popen("file -i '$fspath' 2>/dev/null", "r"); + $reply = fgets($fp); + pclose($fp); // popen will not return an error if the binary was not found // and find may not have mime support using "-i" // so we test the format of the returned string - - // the reply begins with the requested filename - if (! strncmp( $reply, "$fspath: ", strlen( $fspath ) + 2 )) { - $reply = substr( $reply, strlen( $fspath ) + 2 ); + if (!strncmp($reply, "$fspath: ", strlen($fspath) + 2)) { + $reply = substr($reply, strlen($fspath) + 2); // followed by the mime type (maybe including options) - if (preg_match( '/^[[:alnum:]_-]+/[[:alnum:]_-]+;?.*/', $reply, $matches )) { + if (preg_match('/^[[:alnum:]_-]+/[[:alnum:]_-]+;?.*/', $reply, $matches)) { $mime_type = $matches[0]; } } } - if (empty( $mime_type )) { + if (empty($mime_type)) { // Fallback solution: try to guess the type by the file extension // TODO: add more ... // TODO: it has been suggested to delegate mimetype detection @@ -378,7 +371,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server // anyway (overriding it with information taken from // the registry) // TODO: have a seperate PEAR class for mimetype detection? - switch (strtolower( strrchr( basename( $fspath ), "." ) )) { + switch (strtolower(strrchr(basename($fspath), "."))) { case ".html": $mime_type = "text/html"; break; @@ -403,101 +396,99 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param array parameter passing array * @return bool true on success */ - function GET (&$options) + public function GET(&$options) { $paths = $this->paths; $pathClasses = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; - if (count( $paths ) > 0 && $paths[0] == 'classes' && is_dir( $pathClasses )) { + if (count($paths) > 0 && $paths[0] == 'classes' && is_dir($pathClasses)) { $fsFile = $pathClasses . $paths[1]; - if (count( $paths ) == 2 && file_exists( $fsFile )) { - $content = file_get_contents( $fsFile ); + if (count($paths) == 2 && file_exists($fsFile)) { + $content = file_get_contents($fsFile); print $content; - header( "Content-Type: " . mime_content_type( $fsFile ) ); - header( "Last-Modified: " . date( "D, j M Y H:m:s ", file_mtime( $fsFile ) ) . "GMT" ); - header( "Content-Length: " . filesize( $fsFile ) ); + header("Content-Type: " . mime_content_type($fsFile)); + header("Last-Modified: " . date("D, j M Y H:m:s ", file_mtime($fsFile)) . "GMT"); + header("Content-Length: " . filesize($fsFile)); return true; } } $pathProcesses = PATH_DB . SYS_SYS . PATH_SEP; - if (count( $paths ) > 0 && $paths[0] == 'processes' && is_dir( $pathProcesses )) { - if (count( $paths ) == 4 && $paths[2] == 'xmlforms') { + if (count($paths) > 0 && $paths[0] == 'processes' && is_dir($pathProcesses)) { + if (count($paths) == 4 && $paths[2] == 'xmlforms') { $pathXmlform = $pathProcesses . 'xmlForms' . PATH_SEP . $paths[1] . PATH_SEP; $fsFile = $pathXmlform . $paths[3]; - if (count( $paths ) == 4 && file_exists( $fsFile )) { - $content = file_get_contents( $fsFile ); + if (count($paths) == 4 && file_exists($fsFile)) { + $content = file_get_contents($fsFile); print $content; - header( "Content-Type: " . mime_content_type( $fsFile ) ); - header( "Last-Modified: " . date( "D, j M Y H:m:s ", file_mtime( $fsFile ) ) . "GMT" ); - header( "Content-Length: " . filesize( $fsFile ) ); + header("Content-Type: " . mime_content_type($fsFile)); + header("Last-Modified: " . date("D, j M Y H:m:s ", file_mtime($fsFile)) . "GMT"); + header("Content-Length: " . filesize($fsFile)); return true; } } - if (count( $paths ) == 4 && $paths[2] == 'mailTemplates') { + if (count($paths) == 4 && $paths[2] == 'mailTemplates') { $pathTemplates = $pathProcesses . 'mailTemplates' . PATH_SEP . $paths[1] . PATH_SEP; $fsFile = $pathTemplates . $paths[3]; - if (count( $paths ) == 4 && file_exists( $fsFile )) { - $content = file_get_contents( $fsFile ); + if (count($paths) == 4 && file_exists($fsFile)) { + $content = file_get_contents($fsFile); print $content; - header( "Content-Type: " . mime_content_type( $fsFile ) ); - header( "Last-Modified: " . date( "D, j M Y H:m:s ", file_mtime( $fsFile ) ) . "GMT" ); - header( "Content-Length: " . filesize( $fsFile ) ); + header("Content-Type: " . mime_content_type($fsFile)); + header("Last-Modified: " . date("D, j M Y H:m:s ", file_mtime($fsFile)) . "GMT"); + header("Content-Length: " . filesize($fsFile)); return true; } } - if (count( $paths ) == 4 && $paths[2] == 'public_html') { + if (count($paths) == 4 && $paths[2] == 'public_html') { $pathPublic = $pathProcesses . 'public' . PATH_SEP . $paths[1] . PATH_SEP; $fsFile = $pathPublic . $paths[3]; - if (count( $paths ) == 4 && file_exists( $fsFile )) { - $content = file_get_contents( $fsFile ); + if (count($paths) == 4 && file_exists($fsFile)) { + $content = file_get_contents($fsFile); print $content; - header( "Content-Type: " . mime_content_type( $fsFile ) ); - header( "Last-Modified: " . date( "D, j M Y H:m:s ", file_mtime( $fsFile ) ) . "GMT" ); - header( "Content-Length: " . filesize( $fsFile ) ); + header("Content-Type: " . mime_content_type($fsFile)); + header("Last-Modified: " . date("D, j M Y H:m:s ", file_mtime($fsFile)) . "GMT"); + header("Content-Length: " . filesize($fsFile)); return true; } } - } - print_r( $paths ); + print_r($paths); return true; if ($options["path"] == '/') { - return $this->getRoot( $options ); + return $this->getRoot($options); } //print_r ($options); - - // get absolute fs path to requested resource $fspath = $this->base . $options["path"]; // sanity check - if (! file_exists( $fspath )) + if (!file_exists($fspath)) { return false; + } - // is this a collection? - if (is_dir( $fspath )) { - return $this->GetDir( $fspath, $options ); + // is this a collection? + if (is_dir($fspath)) { + return $this->GetDir($fspath, $options); } // detect resource type - $options['mimetype'] = $this->_mimetype( $fspath ); + $options['mimetype'] = $this->_mimetype($fspath); // detect modification time // see rfc2518, section 13.7 // some clients seem to treat this as a reverse rule // requiering a Last-Modified header if the getlastmodified header was set - $options['mtime'] = filemtime( $fspath ); + $options['mtime'] = filemtime($fspath); // detect resource size - $options['size'] = filesize( $fspath ); + $options['size'] = filesize($fspath); // no need to check result here, it is handled by the base class - $options['stream'] = fopen( $fspath, "r" ); + $options['stream'] = fopen($fspath, "r"); return true; } @@ -508,26 +499,26 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param string &$options * @return boolean false */ - function getRoot (&$options) + public function getRoot(&$options) { - $path = $this->_slashify( $options["path"] ); + $path = $this->_slashify($options["path"]); // fixed width directory column format $format = "%15s %-19s %-s\n"; - echo "Index of " . htmlspecialchars( $options['path'] ) . "\n"; - echo "

Index of " . htmlspecialchars( $options['path'] ) . "

\n"; + echo "Index of " . htmlspecialchars($options['path']) . "\n"; + echo "

Index of " . htmlspecialchars($options['path']) . "

\n"; echo "
";
-        printf( $format, "Size", "Last modified", "Filename" );
+        printf($format, "Size", "Last modified", "Filename");
         echo "
"; - $pathRoot = array ('xmlforms','public_html','dir1','dir2' + $pathRoot = array('xmlforms', 'public_html', 'dir1', 'dir2' ); foreach ($pathRoot as $key => $val) { $fullpath = $fspath . "/" . $filename; - $name = htmlspecialchars( $val ); - printf( $format, number_format( filesize( $fullpath ) ), strftime( "%Y-%m-%d %H:%M:%S", filemtime( $fullpath ) ), "$name" ); + $name = htmlspecialchars($val); + printf($format, number_format(filesize($fullpath)), strftime("%Y-%m-%d %H:%M:%S", filemtime($fullpath)), "$name"); } echo "
"; @@ -535,22 +526,22 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server die(); - $handle = @opendir( $fspath ); - if (! $handle) { + $handle = @opendir($fspath); + if (!$handle) { return false; } - while ($filename = readdir( $handle )) { + while ($filename = readdir($handle)) { if ($filename != "." && $filename != "..") { $fullpath = $fspath . "/" . $filename; - $name = htmlspecialchars( $filename ); - printf( $format, number_format( filesize( $fullpath ) ), strftime( "%Y-%m-%d %H:%M:%S", filemtime( $fullpath ) ), "$name" ); + $name = htmlspecialchars($filename); + printf($format, number_format(filesize($fullpath)), strftime("%Y-%m-%d %H:%M:%S", filemtime($fullpath)), "$name"); } } echo ""; - closedir( $handle ); + closedir($handle); echo "\n"; @@ -566,41 +557,41 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param string directory path * @return void function has to handle HTTP response itself */ - function GetDir ($fspath, &$options) + public function GetDir($fspath, &$options) { - $path = $this->_slashify( $options["path"] ); + $path = $this->_slashify($options["path"]); if ($path != $options["path"]) { - header( "Location: " . $this->base_uri . $path ); + header("Location: " . $this->base_uri . $path); exit(); } // fixed width directory column format $format = "%15s %-19s %-s\n"; - $handle = @opendir( $fspath ); - if (! $handle) { + $handle = @opendir($fspath); + if (!$handle) { return false; } - echo "Index of " . htmlspecialchars( $options['path'] ) . "\n"; + echo "Index of " . htmlspecialchars($options['path']) . "\n"; - echo "

Index of " . htmlspecialchars( $options['path'] ) . "

\n"; + echo "

Index of " . htmlspecialchars($options['path']) . "

\n"; echo "
";
-        printf( $format, "Size", "Last modified", "Filename" );
+        printf($format, "Size", "Last modified", "Filename");
         echo "
"; - while ($filename = readdir( $handle )) { + while ($filename = readdir($handle)) { if ($filename != "." && $filename != "..") { $fullpath = $fspath . "/" . $filename; - $name = htmlspecialchars( $filename ); - printf( $format, number_format( filesize( $fullpath ) ), strftime( "%Y-%m-%d %H:%M:%S", filemtime( $fullpath ) ), "$name" ); + $name = htmlspecialchars($filename); + printf($format, number_format(filesize($fullpath)), strftime("%Y-%m-%d %H:%M:%S", filemtime($fullpath)), "$name"); } } echo "
"; - closedir( $handle ); + closedir($handle); echo "\n"; @@ -613,39 +604,39 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param array parameter passing array * @return bool true on success */ - function PUT (&$options) + public function PUT(&$options) { $paths = $this->paths; $pathClasses = PATH_DB . PATH_SEP . 'classes' . PATH_SEP; - if (count( $paths ) > 0 && $paths[0] == 'classes' && is_dir( $pathClasses )) { + if (count($paths) > 0 && $paths[0] == 'classes' && is_dir($pathClasses)) { $fsFile = $pathClasses . $paths[1]; - if (count( $paths ) == 2 && file_exists( $fsFile )) { - $fp = fopen( $fsFile, "w" ); - if (is_resource( $fp ) && is_resource( $options["stream"] )) { - while (! feof( $options["stream"] )) { - fwrite( $fp, fread( $options["stream"], 4096 ) ); + if (count($paths) == 2 && file_exists($fsFile)) { + $fp = fopen($fsFile, "w"); + if (is_resource($fp) && is_resource($options["stream"])) { + while (!feof($options["stream"])) { + fwrite($fp, fread($options["stream"], 4096)); } - fclose( $fp ); - fclose( $options["stream"] ); + fclose($fp); + fclose($options["stream"]); } return "201 Created " . $fsFile; } } $pathProcesses = PATH_DB . SYS_SYS . PATH_SEP; - if (count( $paths ) > 0 && $paths[0] == 'processes' && is_dir( $pathProcesses )) { + if (count($paths) > 0 && $paths[0] == 'processes' && is_dir($pathProcesses)) { if ($paths[2] == 'xmlforms') { $pathTemplates = $pathProcesses . 'xmlForms' . PATH_SEP . $paths[1] . PATH_SEP; $fsFile = $pathTemplates . $paths[3]; - if (count( $paths ) == 4 && file_exists( $fsFile )) { - $fp = fopen( $fsFile, "w" ); - if (is_resource( $fp ) && is_resource( $options["stream"] )) { - while (! feof( $options["stream"] )) { - fwrite( $fp, fread( $options["stream"], 4096 ) ); + if (count($paths) == 4 && file_exists($fsFile)) { + $fp = fopen($fsFile, "w"); + if (is_resource($fp) && is_resource($options["stream"])) { + while (!feof($options["stream"])) { + fwrite($fp, fread($options["stream"], 4096)); } - fclose( $fp ); - fclose( $options["stream"] ); + fclose($fp); + fclose($options["stream"]); } return "201 Created " . $fsFile; } @@ -654,14 +645,14 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server if ($paths[2] == 'mailTemplates') { $pathTemplates = $pathProcesses . 'mailTemplates' . PATH_SEP . $paths[1] . PATH_SEP; $fsFile = $pathTemplates . $paths[3]; - if (count( $paths ) == 4 && file_exists( $fsFile )) { - $fp = fopen( $fsFile, "w" ); - if (is_resource( $fp ) && is_resource( $options["stream"] )) { - while (! feof( $options["stream"] )) { - fwrite( $fp, fread( $options["stream"], 4096 ) ); + if (count($paths) == 4 && file_exists($fsFile)) { + $fp = fopen($fsFile, "w"); + if (is_resource($fp) && is_resource($options["stream"])) { + while (!feof($options["stream"])) { + fwrite($fp, fread($options["stream"], 4096)); } - fclose( $fp ); - fclose( $options["stream"] ); + fclose($fp); + fclose($options["stream"]); } return "201 Created " . $fsFile; } @@ -670,23 +661,21 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server if ($paths[2] == 'public_html') { $pathPublic = $pathProcesses . 'public' . PATH_SEP . $paths[1] . PATH_SEP; $fsFile = $pathPublic . $paths[3]; - if (count( $paths ) == 4 && file_exists( $fsFile )) { - $fp = fopen( $fsFile, "w" ); - if (is_resource( $fp ) && is_resource( $options["stream"] )) { - while (! feof( $options["stream"] )) { - fwrite( $fp, fread( $options["stream"], 4096 ) ); + if (count($paths) == 4 && file_exists($fsFile)) { + $fp = fopen($fsFile, "w"); + if (is_resource($fp) && is_resource($options["stream"])) { + while (!feof($options["stream"])) { + fwrite($fp, fread($options["stream"], 4096)); } - fclose( $fp ); - fclose( $options["stream"] ); + fclose($fp); + fclose($options["stream"]); } return "201 Created " . $fsFile; } } - } return "409 Conflict"; - } /** @@ -695,30 +684,31 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param array general parameter passing array * @return bool true on success */ - function MKCOL ($options) + public function MKCOL($options) { $path = $this->base . $options["path"]; - $parent = dirname( $path ); - $name = basename( $path ); + $parent = dirname($path); + $name = basename($path); - if (! file_exists( $parent )) { + if (!file_exists($parent)) { return "409 Conflict"; } - if (! is_dir( $parent )) { + if (!is_dir($parent)) { return "403 Forbidden"; } - if (file_exists( $parent . "/" . $name )) { + if (file_exists($parent . "/" . $name)) { return "405 Method not allowed"; } - if (! empty( $_SERVER["CONTENT_LENGTH"] )) { // no body parsing yet + if (!empty($_SERVER["CONTENT_LENGTH"])) { + // no body parsing yet return "415 Unsupported media type"; } - $stat = mkdir( $parent . "/" . $name, 0777 ); - if (! $stat) { + $stat = mkdir($parent . "/" . $name, 0777); + if (!$stat) { return "403 Forbidden"; } @@ -731,23 +721,23 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param array general parameter passing array * @return bool true on success */ - function DELETE ($options) + public function DELETE($options) { $path = $this->base . "/" . $options["path"]; - if (! file_exists( $path )) { + if (!file_exists($path)) { return "404 Not found"; } - if (is_dir( $path )) { - $query = "DELETE FROM properties WHERE path LIKE '" . $this->_slashify( $options["path"] ) . "%'"; - mysql_query( $query ); - System::rm( "-rf $path" ); + if (is_dir($path)) { + $query = "DELETE FROM properties WHERE path LIKE '" . $this->_slashify($options["path"]) . "%'"; + mysql_query($query); + System::rm("-rf $path"); } else { - unlink( $path ); + unlink($path); } $query = "DELETE FROM properties WHERE path = '$options[path]'"; - mysql_query( $query ); + mysql_query($query); return "204 No Content"; } @@ -758,7 +748,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param array general parameter passing array * @return bool true on success */ - function MOVE ($options) + public function MOVE($options) { return "423 Locked"; //return $this->COPY($options, true); @@ -770,37 +760,39 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param array general parameter passing array * @return bool true on success */ - function COPY ($options, $del = false) + public function COPY($options, $del = false) { // TODO Property updates still broken (Litmus should detect this?) - if (! empty( $_SERVER["CONTENT_LENGTH"] )) { // no body parsing yet + if (!empty($_SERVER["CONTENT_LENGTH"])) { + // no body parsing yet return "415 Unsupported media type"; } // no copying to different WebDAV Servers yet - if (isset( $options["dest_url"] )) { + if (isset($options["dest_url"])) { return "502 bad gateway"; } $source = $this->base . $options["path"]; - if (! file_exists( $source )) + if (!file_exists($source)) { return "404 Not found"; + } $dest = $this->base . $options["dest"]; - $new = ! file_exists( $dest ); + $new = !file_exists($dest); $existing_col = false; - if (! $new) { - if ($del && is_dir( $dest )) { - if (! $options["overwrite"]) { + if (!$new) { + if ($del && is_dir($dest)) { + if (!$options["overwrite"]) { return "412 precondition failed"; } - $dest .= basename( $source ); - if (file_exists( $dest )) { - $options["dest"] .= basename( $source ); + $dest .= basename($source); + if (file_exists($dest)) { + $options["dest"] .= basename($source); } else { $new = true; $existing_col = true; @@ -808,11 +800,11 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server } } - if (! $new) { + if (!$new) { if ($options["overwrite"]) { - $stat = $this->DELETE( array ("path" => $options["dest"] - ) ); - if (($stat{0} != "2") && (substr( $stat, 0, 3 ) != "404")) { + $stat = $this->DELETE(array("path" => $options["dest"] + )); + if (($stat{0} != "2") && (substr($stat, 0, 3) != "404")) { return $stat; } } else { @@ -820,58 +812,58 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server } } - if (is_dir( $source ) && ($options["depth"] != "infinity")) { + if (is_dir($source) && ($options["depth"] != "infinity")) { // RFC 2518 Section 9.2, last paragraph return "400 Bad request"; } if ($del) { - if (! rename( $source, $dest )) { + if (!rename($source, $dest)) { return "500 Internal server error"; } - $destpath = $this->_unslashify( $options["dest"] ); - if (is_dir( $source )) { + $destpath = $this->_unslashify($options["dest"]); + if (is_dir($source)) { $query = "UPDATE properties SET path = REPLACE(path, '" . $options["path"] . "', '" . $destpath . "') - WHERE path LIKE '" . $this->_slashify( $options["path"] ) . "%'"; - mysql_query( $query ); + WHERE path LIKE '" . $this->_slashify($options["path"]) . "%'"; + mysql_query($query); } $query = "UPDATE properties SET path = '" . $destpath . "' WHERE path = '" . $options["path"] . "'"; - mysql_query( $query ); + mysql_query($query); } else { - if (is_dir( $source )) { - $files = System::find( $source ); - $files = array_reverse( $files ); + if (is_dir($source)) { + $files = System::find($source); + $files = array_reverse($files); } else { - $files = array ($source + $files = array($source ); } - if (! is_array( $files ) || empty( $files )) { + if (!is_array($files) || empty($files)) { return "500 Internal server error"; } foreach ($files as $file) { - if (is_dir( $file )) { - $file = $this->_slashify( $file ); + if (is_dir($file)) { + $file = $this->_slashify($file); } - $destfile = str_replace( $source, $dest, $file ); + $destfile = str_replace($source, $dest, $file); - if (is_dir( $file )) { - if (! is_dir( $destfile )) { + if (is_dir($file)) { + if (!is_dir($destfile)) { // TODO "mkdir -p" here? (only natively supported by PHP 5) - if (! mkdir( $destfile )) { + if (!mkdir($destfile)) { return "409 Conflict"; } } else { - error_log( "existing dir '$destfile'" ); + error_log("existing dir '$destfile'"); } } else { - if (! copy( $file, $destfile )) { + if (!copy($file, $destfile)) { return "409 Conflict"; } } @@ -880,7 +872,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server $query = "INSERT INTO properties SELECT ... FROM properties WHERE path = '" . $options['path'] . "'"; } - return ($new && ! $existing_col) ? "201 Created" : "204 No Content"; + return ($new && !$existing_col) ? "201 Created" : "204 No Content"; } /** @@ -889,7 +881,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param array general parameter passing array * @return bool true on success */ - function PROPPATCH (&$options) + public function PROPPATCH(&$options) { global $prefs, $tab; @@ -897,20 +889,20 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server $path = $options["path"]; - $dir = dirname( $path ) . "/"; - $base = basename( $path ); + $dir = dirname($path) . "/"; + $base = basename($path); foreach ($options["props"] as $key => $prop) { if ($prop["ns"] == "DAV:") { $options["props"][$key]['status'] = "403 Forbidden"; } else { - if (isset( $prop["val"] )) { + if (isset($prop["val"])) { $query = "REPLACE INTO properties SET path = '$options[path]', name = '$prop[name]', ns= '$prop[ns]', value = '$prop[val]'"; - error_log( $query ); + error_log($query); } else { $query = "DELETE FROM properties WHERE path = '$options[path]' AND name = '$prop[name]' AND ns = '$prop[ns]'"; } - mysql_query( $query ); + mysql_query($query); } } return ""; @@ -922,11 +914,12 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param array general parameter passing array * @return bool true on success */ - function LOCK (&$options) + public function LOCK(&$options) { - if (isset( $options["update"] )) { // Lock Update + if (isset($options["update"])) { + // Lock Update $query = "UPDATE locks SET expires = " . (time() + 300); - mysql_query( $query ); + mysql_query($query); if (mysql_affected_rows()) { $options["timeout"] = 300; // 5min hardcoded @@ -945,7 +938,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server , owner = '$options[owner]' , expires = '$options[timeout]' , exclusivelock = " . ($options['scope'] === "exclusive" ? "1" : "0"); - mysql_query( $query ); + mysql_query($query); return mysql_affected_rows() ? "200 OK" : "409 Conflict"; } @@ -956,12 +949,12 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param array general parameter passing array * @return bool true on success */ - function UNLOCK (&$options) + public function UNLOCK(&$options) { $query = "DELETE FROM locks WHERE path = '$options[path]' AND token = '$options[token]'"; - mysql_query( $query ); + mysql_query($query); return mysql_affected_rows() ? "204 No Content" : "409 Conflict"; } @@ -972,21 +965,21 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param string resource path to check for locks * @return bool true on success */ - function checkLock ($path) + public function checkLock($path) { $result = false; $query = "SELECT owner, token, expires, exclusivelock FROM locks WHERE path = '$path' "; - $res = mysql_query( $query ); + $res = mysql_query($query); if ($res) { - $row = mysql_fetch_array( $res ); - mysql_free_result( $res ); + $row = mysql_fetch_array($res); + mysql_free_result($res); if ($row) { - $result = array ("type" => "write","scope" => $row["exclusivelock"] ? "exclusive" : "shared","depth" => 0,"owner" => $row['owner'],"token" => $row['token'],"expires" => $row['expires'] + $result = array("type" => "write", "scope" => $row["exclusivelock"] ? "exclusive" : "shared", "depth" => 0, "owner" => $row['owner'], "token" => $row['token'], "expires" => $row['expires'] ); } } @@ -1000,12 +993,10 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * @param void * @return bool true on success */ - function create_database () + public function create_database() { // TODO return false; } - } - -?> + \ No newline at end of file diff --git a/workflow/engine/methods/processes/processes_Ajax.php b/workflow/engine/methods/processes/processes_Ajax.php index e0a37c224..78ab9373e 100755 --- a/workflow/engine/methods/processes/processes_Ajax.php +++ b/workflow/engine/methods/processes/processes_Ajax.php @@ -1,4 +1,5 @@ userCanAccess('PM_FACTORY')) - { - case -2: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - case -1: - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - break; - }*/ + /* global $RBAC; + switch ($RBAC->userCanAccess('PM_FACTORY')) + { + case -2: + G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); + G::header('location: ../login/login'); + die; + break; + case -1: + G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); + G::header('location: ../login/login'); + die; + break; + } */ //$oJSON = new Services_JSON(); - if (isset( $_REQUEST['data'] )) { - $oData = Bootstrap::json_decode( stripslashes( $_REQUEST['data'] ) ); + if (isset($_REQUEST['data'])) { + $oData = Bootstrap::json_decode(stripslashes($_REQUEST['data'])); //$oData = $oJSON->decode( stripslashes( $_REQUEST['data'] ) ); $sOutput = ''; $sTask = ''; } //G::LoadClass( 'processMap' ); - $oProcessMap = new processMap( new DBConnection() ); + $oProcessMap = new processMap(new DBConnection()); switch ($_REQUEST['action']) { case 'load': $_SESSION['PROCESS'] = $oData->uid; if ($oData->ct) { - $sOutput = $oProcessMap->load( $oData->uid, true, $_SESSION['APPLICATION'], - 1, $_SESSION['TASK'], $oData->ct ); + $sOutput = $oProcessMap->load($oData->uid, true, $_SESSION['APPLICATION'], - 1, $_SESSION['TASK'], $oData->ct); } else { if ($oData->mode) { - $sOutput = $oProcessMap->load( $oData->uid ); + $sOutput = $oProcessMap->load($oData->uid); } else { if ($_SESSION['TASK'] != - 1) { $taskUid = $_SESSION['TASK']; } else { - $c = new Criteria( 'workflow' ); + $c = new Criteria('workflow'); $c->clearSelectColumns(); - $c->addSelectColumn( AppDelegationPeer::TAS_UID ); - $c->add( AppDelegationPeer::APP_UID, $_SESSION['APPLICATION'] ); - $c->add( AppDelegationPeer::DEL_INDEX, $_SESSION['INDEX'] ); - $oDataset = AppDelegationPeer::doSelectRS( $c ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $c->addSelectColumn(AppDelegationPeer::TAS_UID); + $c->add(AppDelegationPeer::APP_UID, $_SESSION['APPLICATION']); + $c->add(AppDelegationPeer::DEL_INDEX, $_SESSION['INDEX']); + $oDataset = AppDelegationPeer::doSelectRS($c); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aData = $oDataset->getRow(); - $taskUid = isset( $aData['TAS_UID'] ) ? $aData['TAS_UID'] : - 1; + $taskUid = isset($aData['TAS_UID']) ? $aData['TAS_UID'] : - 1; } - $sOutput = $oProcessMap->load( $oData->uid, true, $_SESSION['APPLICATION'], $_SESSION['INDEX'], $taskUid ); + $sOutput = $oProcessMap->load($oData->uid, true, $_SESSION['APPLICATION'], $_SESSION['INDEX'], $taskUid); } } break; case 'process_Edit': - $oProcessMap->editProcess( $oData->pro_uid ); + $oProcessMap->editProcess($oData->pro_uid); break; case 'process_Export': include (PATH_METHODS . 'processes/processes_Export.php'); @@ -96,138 +97,138 @@ try { break; case 'webEntry_delete': $form = $_REQUEST; - unlink( PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . $form['FILENAME'] ); - unlink( PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . str_replace( ".php", "Post", $form['FILENAME'] ) . ".php" ); - $oProcessMap->webEntry( $_REQUEST['PRO_UID'] ); + unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . $form['FILENAME']); + unlink(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . str_replace(".php", "Post", $form['FILENAME']) . ".php"); + $oProcessMap->webEntry($_REQUEST['PRO_UID']); break; case 'webEntry_new': - $oProcessMap->webEntry_new( $oData->PRO_UID ); + $oProcessMap->webEntry_new($oData->PRO_UID); break; case 'assignProcessUser': - $oProcessMap->assignProcessUser( $oData->PRO_UID, $oData->USR_UID, $oData->TYPE_UID ); - G::LoadClass( 'processMap' ); + $oProcessMap->assignProcessUser($oData->PRO_UID, $oData->USR_UID, $oData->TYPE_UID); + G::LoadClass('processMap'); $oProcessMap = new ProcessMap(); - $oProcessMap->listProcessesUser( $oData->PRO_UID ); + $oProcessMap->listProcessesUser($oData->PRO_UID); break; case 'removeProcessUser': - $oProcessMap->removeProcessUser( $oData->PU_UID ); + $oProcessMap->removeProcessUser($oData->PU_UID); foreach ($_SESSION['_DBArray']['data'] as $key => $value) { if ($value['LA_PU_UID'] == $oData->PU_UID) { - unset( $_SESSION['_DBArray']['data'][$key] ); + unset($_SESSION['_DBArray']['data'][$key]); break; } } break; case 'supervisorDynaforms': - $oProcessMap->supervisorDynaforms( $oData->pro_uid ); + $oProcessMap->supervisorDynaforms($oData->pro_uid); break; case 'supervisorInputs': - $oProcessMap->supervisorInputs( $oData->pro_uid ); + $oProcessMap->supervisorInputs($oData->pro_uid); break; case 'webEntry': - $oProcessMap->webEntry( $oData->pro_uid ); + $oProcessMap->webEntry($oData->pro_uid); break; case 'webEntry_Val_Assig': include (PATH_METHODS . 'processes/webEntry_Val_Assig.php'); break; case 'saveTitlePosition': - $sOutput = $oProcessMap->saveTitlePosition( $oData->pro_uid, $oData->position->x, $oData->position->y ); + $sOutput = $oProcessMap->saveTitlePosition($oData->pro_uid, $oData->position->x, $oData->position->y); break; case 'steps': switch ($oData->option) { case 1: - $oProcessMap->steps( $oData->proUid, $oData->tasUid ); + $oProcessMap->steps($oData->proUid, $oData->tasUid); break; case 2: - $oProcessMap->stepsConditions( $oData->proUid, $oData->tasUid ); + $oProcessMap->stepsConditions($oData->proUid, $oData->tasUid); break; case 3: - $oProcessMap->stepsTriggers( $oData->proUid, $oData->tasUid ); + $oProcessMap->stepsTriggers($oData->proUid, $oData->tasUid); break; } break; case 'users': - $oProcessMap->users( $oData->pro_uid, $oData->tas_uid ); + $oProcessMap->users($oData->pro_uid, $oData->tas_uid); break; case 'users_adhoc': - $oProcessMap->users_adhoc( $oData->pro_uid, $oData->tas_uid ); + $oProcessMap->users_adhoc($oData->pro_uid, $oData->tas_uid); break; case 'addTask': - $sOutput = $oProcessMap->addTask( $oData->uid, $oData->position->x, $oData->position->y ); + $sOutput = $oProcessMap->addTask($oData->uid, $oData->position->x, $oData->position->y); break; case 'addSubProcess': - $sOutput = $oProcessMap->addSubProcess( $oData->uid, $oData->position->x, $oData->position->y ); + $sOutput = $oProcessMap->addSubProcess($oData->uid, $oData->position->x, $oData->position->y); break; case 'taskColor': - $oTask->taskColor( $oData->pro_uid, $oData->tas_uid ); + $oTask->taskColor($oData->pro_uid, $oData->tas_uid); break; case 'addTaskHidden': - $sOutput = $oProcessMap->addTaskHidden( $oData->uid, $oData->position->x, $oData->position->y ); + $sOutput = $oProcessMap->addTaskHidden($oData->uid, $oData->position->x, $oData->position->y); break; case 'editTaskProperties': - $oProcessMap->editTaskProperties( $oData->uid, (isset( $oData->iForm ) ? $oData->iForm : 1), $oData->index ); + $oProcessMap->editTaskProperties($oData->uid, (isset($oData->iForm) ? $oData->iForm : 1), $oData->index); break; case 'saveTaskPosition': - $sOutput = $oProcessMap->saveTaskPosition( $oData->uid, $oData->position->x, $oData->position->y ); + $sOutput = $oProcessMap->saveTaskPosition($oData->uid, $oData->position->x, $oData->position->y); break; case 'deleteTask': - $sOutput = $oProcessMap->deleteTask( $oData->tas_uid ); + $sOutput = $oProcessMap->deleteTask($oData->tas_uid); break; case 'addGuide': - $sOutput = $oProcessMap->addGuide( $oData->uid, $oData->position, $oData->direction ); + $sOutput = $oProcessMap->addGuide($oData->uid, $oData->position, $oData->direction); break; case 'saveGuidePosition': - $sOutput = $oProcessMap->saveGuidePosition( $oData->uid, $oData->position, $oData->direction ); + $sOutput = $oProcessMap->saveGuidePosition($oData->uid, $oData->position, $oData->direction); break; case 'deleteGuide': - $sOutput = $oProcessMap->deleteGuide( $oData->uid ); + $sOutput = $oProcessMap->deleteGuide($oData->uid); break; case 'deleteGuides': - $sOutput = $oProcessMap->deleteGuides( $oData->pro_uid ); + $sOutput = $oProcessMap->deleteGuides($oData->pro_uid); break; case 'addText': - $sOutput = $oProcessMap->addText( $oData->uid, $oData->label, $oData->position->x, $oData->position->y ); + $sOutput = $oProcessMap->addText($oData->uid, $oData->label, $oData->position->x, $oData->position->y); break; case 'updateText': - $sOutput = $oProcessMap->updateText( $oData->uid, $oData->label ); + $sOutput = $oProcessMap->updateText($oData->uid, $oData->label); break; case 'saveTextPosition': - $sOutput = $oProcessMap->saveTextPosition( $oData->uid, $oData->position->x, $oData->position->y ); + $sOutput = $oProcessMap->saveTextPosition($oData->uid, $oData->position->x, $oData->position->y); break; case 'deleteText': - $sOutput = $oProcessMap->deleteText( $oData->uid ); + $sOutput = $oProcessMap->deleteText($oData->uid); break; case 'dynaforms': - $oProcessMap->dynaformsList( $oData->pro_uid ); + $oProcessMap->dynaformsList($oData->pro_uid); break; case 'inputs': - $oProcessMap->inputdocsList( $oData->pro_uid ); + $oProcessMap->inputdocsList($oData->pro_uid); break; case 'outputs': - $oProcessMap->outputdocsList( $oData->pro_uid ); + $oProcessMap->outputdocsList($oData->pro_uid); break; case 'triggers': - $oProcessMap->triggersList( $oData->pro_uid ); + $oProcessMap->triggersList($oData->pro_uid); break; case 'case_scheduler': - if (isset( $_REQUEST['PRO_UID'] )) { - $oProcessMap->caseSchedulerList( $_REQUEST['PRO_UID'] ); + if (isset($_REQUEST['PRO_UID'])) { + $oProcessMap->caseSchedulerList($_REQUEST['PRO_UID']); } break; case 'log_case_scheduler': - if (isset( $_REQUEST['PRO_UID'] )) { - $oProcessMap->logCaseSchedulerList( $_REQUEST['PRO_UID'] ); + if (isset($_REQUEST['PRO_UID'])) { + $oProcessMap->logCaseSchedulerList($_REQUEST['PRO_UID']); } break; case 'messages': - $oProcessMap->messagesList( $oData->pro_uid ); + $oProcessMap->messagesList($oData->pro_uid); break; case 'reportTables': - $oProcessMap->reportTablesList( $oData->pro_uid ); + $oProcessMap->reportTablesList($oData->pro_uid); break; case 'derivations': - if (! isset( $oData->type )) { - $oProcessMap->currentPattern( $oData->pro_uid, $oData->tas_uid ); + if (!isset($oData->type)) { + $oProcessMap->currentPattern($oData->pro_uid, $oData->tas_uid); } else { switch ($oData->type) { case 0: @@ -252,7 +253,7 @@ try { $oData->type = 'DISCRIMINATOR'; break; } - $oProcessMap->newPattern( $oData->pro_uid, $oData->tas_uid, $oData->next_task, $oData->type ); + $oProcessMap->newPattern($oData->pro_uid, $oData->tas_uid, $oData->next_task, $oData->type); } break; case 'saveNewPattern': @@ -280,90 +281,90 @@ try { break; } if (($oData->type != 0) && ($oData->type != 5) && ($oData->type != 8)) { - if ($oProcessMap->getNumberOfRoutes( $oData->pro_uid, $oData->tas_uid, $oData->next_task, $sType ) > 0) { + if ($oProcessMap->getNumberOfRoutes($oData->pro_uid, $oData->tas_uid, $oData->next_task, $sType) > 0) { die(); } - unset( $aRow ); + unset($aRow); } if (($oData->delete) || ($oData->type == 0) || ($oData->type == 5) || ($oData->type == 8)) { - G::LoadClass( 'tasks' ); + G::LoadClass('tasks'); $oTasks = new Tasks(); - $oTasks->deleteAllRoutesOfTask( $oData->pro_uid, $oData->tas_uid ); - $oTasks->deleteAllGatewayOfTask( $oData->pro_uid, $oData->tas_uid ); + $oTasks->deleteAllRoutesOfTask($oData->pro_uid, $oData->tas_uid); + $oTasks->deleteAllGatewayOfTask($oData->pro_uid, $oData->tas_uid); } - $oProcessMap->saveNewPattern( $oData->pro_uid, $oData->tas_uid, $oData->next_task, $sType, $oData->delete ); + $oProcessMap->saveNewPattern($oData->pro_uid, $oData->tas_uid, $oData->next_task, $sType, $oData->delete); break; case 'deleteAllRoutes': - G::LoadClass( 'tasks' ); + G::LoadClass('tasks'); $oTasks = new Tasks(); - $oTasks->deleteAllRoutesOfTask( $oData->pro_uid, $oData->tas_uid ); + $oTasks->deleteAllRoutesOfTask($oData->pro_uid, $oData->tas_uid); break; case 'objectPermissions': - $oProcessMap->objectsPermissionsList( $oData->pro_uid ); + $oProcessMap->objectsPermissionsList($oData->pro_uid); break; case 'newObjectPermission': - $oProcessMap->newObjectPermission( $oData->pro_uid ); + $oProcessMap->newObjectPermission($oData->pro_uid); break; case 'editObjectPermission': // we also need the process uid variable for the function. - $oProcessMap->editObjectPermission( $oData->op_uid, $oData->pro_uid ); + $oProcessMap->editObjectPermission($oData->op_uid, $oData->pro_uid); break; case 'caseTracker': - $oProcessMap->caseTracker( $oData->pro_uid ); + $oProcessMap->caseTracker($oData->pro_uid); break; case 'caseTrackerObjects': - $oProcessMap->caseTrackerObjects( $oData->pro_uid ); + $oProcessMap->caseTrackerObjects($oData->pro_uid); break; case 'processFilesManager': $_SESSION['PFMDirectory'] = ''; - $oProcessMap->processFilesManager( $oData->pro_uid ); + $oProcessMap->processFilesManager($oData->pro_uid); break; case 'exploreDirectory': $_SESSION["PFMDirectory"] = $oData->main_directory; - $oProcessMap->exploreDirectory( $oData->pro_uid, $oData->main_directory, $oData->directory ); + $oProcessMap->exploreDirectory($oData->pro_uid, $oData->main_directory, $oData->directory); break; case 'deleteFile': - $oProcessMap->deleteFile( $oData->pro_uid, $oData->main_directory, $oData->directory, $oData->file ); + $oProcessMap->deleteFile($oData->pro_uid, $oData->main_directory, $oData->directory, $oData->file); break; case 'deleteDirectory': - $oProcessMap->deleteDirectory( $oData->pro_uid, $oData->main_directory, $oData->directory, $oData->dir_to_delete ); + $oProcessMap->deleteDirectory($oData->pro_uid, $oData->main_directory, $oData->directory, $oData->dir_to_delete); break; case 'downloadFile': - $oProcessMap->downloadFile( $oData->pro_uid, $oData->main_directory, $oData->directory, $oData->file ); + $oProcessMap->downloadFile($oData->pro_uid, $oData->main_directory, $oData->directory, $oData->file); break; case 'deleteSubProcess': - $sOutput = $oProcessMap->deleteSubProcess( $oData->pro_uid, $oData->tas_uid ); + $sOutput = $oProcessMap->deleteSubProcess($oData->pro_uid, $oData->tas_uid); break; case 'subProcess_Properties': - $oProcessMap->subProcess_Properties( $oData->pro_uid, $oData->tas_uid, $oData->index ); + $oProcessMap->subProcess_Properties($oData->pro_uid, $oData->tas_uid, $oData->index); break; case 'showDetailsPMDWL': - G::LoadClass( 'processes' ); + G::LoadClass('processes'); $oProcesses = new Processes(); $oProcesses->ws_open_public(); - $aFields = get_object_vars( $oProcesses->ws_processGetData( $oData->pro_uid ) ); + $aFields = get_object_vars($oProcesses->ws_processGetData($oData->pro_uid)); - $aFields['description'] = nl2br( $aFields['description'] ); - $aFields['installSteps'] = nl2br( $aFields['installSteps'] ); + $aFields['description'] = nl2br($aFields['description']); + $aFields['installSteps'] = nl2br($aFields['installSteps']); switch ($aFields['privacy']) { case 'FREE': - $aFields['link_label'] = G::LoadTranslation( 'ID_DOWNLOAD' ); + $aFields['link_label'] = G::LoadTranslation('ID_DOWNLOAD'); $aFields['link_href'] = '../processes/downloadPML?id=' . $oData->pro_uid . '&s=' . $sessionId; break; case 'PUBLIC': require_once 'classes/model/Configuration.php'; - $oCriteria = new Criteria( 'workflow' ); - $oCriteria->addSelectColumn( ConfigurationPeer::CFG_VALUE ); - $oCriteria->add( ConfigurationPeer::CFG_UID, 'REGISTER_INFORMATION' ); - $oCriteria->add( ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED'] ); - if (ConfigurationPeer::doCount( $oCriteria ) > 0) { - $oDataset = ConfigurationPeer::doSelectRS( $oCriteria ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oCriteria = new Criteria('workflow'); + $oCriteria->addSelectColumn(ConfigurationPeer::CFG_VALUE); + $oCriteria->add(ConfigurationPeer::CFG_UID, 'REGISTER_INFORMATION'); + $oCriteria->add(ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED']); + if (ConfigurationPeer::doCount($oCriteria) > 0) { + $oDataset = ConfigurationPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aRow = $oDataset->getRow(); - $aRI = unserialize( $aRow['CFG_VALUE'] ); + $aRI = unserialize($aRow['CFG_VALUE']); try { - if ($oProcesses->ws_open( $aRI['u'], $aRI['p'] ) == 1) { + if ($oProcesses->ws_open($aRI['u'], $aRI['p']) == 1) { $bExists = true; } else { $bExists = false; @@ -372,36 +373,36 @@ try { $bExists = false; } if ($bExists) { - $aFields['link_label'] = G::LoadTranslation( 'ID_DOWNLOAD' ); + $aFields['link_label'] = G::LoadTranslation('ID_DOWNLOAD'); $aFields['link_href'] = '../processes/downloadPML?id=' . $oData->pro_uid . '&s=' . $sessionId; } else { - $aFields['link_label'] = G::LoadTranslation( 'ID_NEED_REGISTER' ); + $aFields['link_label'] = G::LoadTranslation('ID_NEED_REGISTER'); $aFields['link_href'] = "javascript:registerPML('" . $oData->pro_uid . "');"; } } else { - $aFields['link_label'] = G::LoadTranslation( 'ID_NEED_REGISTER' ); + $aFields['link_label'] = G::LoadTranslation('ID_NEED_REGISTER'); $aFields['link_href'] = "javascript:registerPML('" . $oData->pro_uid . "');"; } break; } $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/objectpmView', '', $aFields, '' ); - G::RenderPage( 'publish', 'raw' ); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/objectpmView', '', $aFields, ''); + G::RenderPage('publish', 'raw'); break; case 'registerPML': - $aFields = array (); + $aFields = array(); $aFields['pro_uid'] = $oData->pro_uid; $aFields['link_create_account'] = PML_SERVER; $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/registerPML', '', $aFields, '' ); - G::RenderPage( 'publish', 'raw' ); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/registerPML', '', $aFields, ''); + G::RenderPage('publish', 'raw'); break; case 'loginPML': - G::LoadClass( 'processes' ); + G::LoadClass('processes'); //G::LoadThirdParty( 'pear/json', 'class.json' ); $oProcesses = new Processes(); try { - if ($oProcesses->ws_open( $oData->u, $oData->p ) == 1) { + if ($oProcesses->ws_open($oData->u, $oData->p) == 1) { $bExists = true; } else { $bExists = false; @@ -413,15 +414,15 @@ try { if ($bExists) { require_once 'classes/model/Configuration.php'; $oConfiguration = new Configuration(); - $oConfiguration->create( array ('CFG_UID' => 'REGISTER_INFORMATION','OBJ_UID' => '','CFG_VALUE' => serialize( array ('u' => $oData->u,'p' => $oData->p - ) ),'PRO_UID' => '','USR_UID' => $_SESSION['USER_LOGGED'],'APP_UID' => '' - ) ); - $oResponse->sLabel = G::LoadTranslation( 'ID_DOWNLOAD' ); + $oConfiguration->create(array('CFG_UID' => 'REGISTER_INFORMATION', 'OBJ_UID' => '', 'CFG_VALUE' => serialize(array('u' => $oData->u, 'p' => $oData->p + )), 'PRO_UID' => '', 'USR_UID' => $_SESSION['USER_LOGGED'], 'APP_UID' => '' + )); + $oResponse->sLabel = G::LoadTranslation('ID_DOWNLOAD'); $oResponse->sLink = '../processes/downloadPML?id=' . $oData->pro_uid . '&s=' . $sessionId; } $oResponse->bExists = $bExists; //$oJSON = new Services_JSON(); - echo Bootstrap::json_encode( $oResponse ); + echo Bootstrap::json_encode($oResponse); break; case 'editFile': //echo $_REQUEST['filename']; @@ -429,7 +430,7 @@ try { $G_PUBLISH = new Publisher(); ///-- $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; $sDir = ""; - if (isset( $_SESSION['PFMDirectory'] )) { + if (isset($_SESSION['PFMDirectory'])) { $sDir = $_SESSION['PFMDirectory']; } switch ($sDir) { @@ -443,58 +444,58 @@ try { $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; break; } - $fcontent = file_get_contents( $sDirectory ); - $extion = explode( ".", $_REQUEST['filename'] ); -// $oHeadPublisher = &headPublisher::getSingleton(); -// $oHeadPublisher->clearScripts(); -// $oHeadPublisher->addScriptFile( '/js/tinymce/jscripts/tiny_mce/tiny_mce.js' ); -// $jscriptCode .= ' -// -//// var tmpArrToStr = Array.prototype.toStr; -//// var tmpObjToStr = Object.prototype.toStr; -//// var tmpObjConcat = Object.prototype.concat; -//// var tmpObjGetByKey = Object.prototype.get_by_key; -//// var tmpObjExpand = Object.prototype.expand; -//// var tmpObjSetParent = Object.prototype.setParent; -//// var tmpObjIsSetKey = Object.prototype.isset_key; -//// -//// delete Array.prototype.toStr; -//// delete Object.prototype.toStr; -//// delete Object.prototype.concat; -//// delete Object.prototype.get_by_key; -//// delete Object.prototype.expand; -//// delete Object.prototype.setParent; -//// delete Object.prototype.isset_key; -//// alert ("hi"); -//// document.body.onload = function(){ -// alert ("hello"); -// tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"; -// tinyMCE.init({ -// theme : "advanced", -// plugins : "fullpage", -// mode : "specific_textareas", -// editor_selector : "tmceEditor", -// width : "640", -// height : "300", -// theme_advanced_buttons3_add : "fullpage" -// }); -//// alert ("goodbye"); -//// } -// '; -// $oHeadPublisher->addScriptCode($jscriptCode); + $fcontent = file_get_contents($sDirectory); + $extion = explode(".", $_REQUEST['filename']); + // $oHeadPublisher = &headPublisher::getSingleton(); + // $oHeadPublisher->clearScripts(); + // $oHeadPublisher->addScriptFile( '/js/tinymce/jscripts/tiny_mce/tiny_mce.js' ); + // $jscriptCode .= ' + // + //// var tmpArrToStr = Array.prototype.toStr; + //// var tmpObjToStr = Object.prototype.toStr; + //// var tmpObjConcat = Object.prototype.concat; + //// var tmpObjGetByKey = Object.prototype.get_by_key; + //// var tmpObjExpand = Object.prototype.expand; + //// var tmpObjSetParent = Object.prototype.setParent; + //// var tmpObjIsSetKey = Object.prototype.isset_key; + //// + //// delete Array.prototype.toStr; + //// delete Object.prototype.toStr; + //// delete Object.prototype.concat; + //// delete Object.prototype.get_by_key; + //// delete Object.prototype.expand; + //// delete Object.prototype.setParent; + //// delete Object.prototype.isset_key; + //// alert ("hi"); + //// document.body.onload = function(){ + // alert ("hello"); + // tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"; + // tinyMCE.init({ + // theme : "advanced", + // plugins : "fullpage", + // mode : "specific_textareas", + // editor_selector : "tmceEditor", + // width : "640", + // height : "300", + // theme_advanced_buttons3_add : "fullpage" + // }); + //// alert ("goodbye"); + //// } + // '; + // $oHeadPublisher->addScriptCode($jscriptCode); $_REQUEST['fcontent'] = $fcontent; //if($extion[count($extion)-1]=='html' || $extion[count($extion)-1]=='txt'){ - $aData = Array ( 'pro_uid' => $_REQUEST['pro_uid'],'fcontent' => $fcontent,'filename' => $_REQUEST['filename'] ); - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_FileEdit', '', $aData ); - G::RenderPage( 'publish', 'raw' ); -// $G_PUBLISH->AddContent( 'view', 'processes/processesFileEditEmail' ); -// G::RenderPage( 'publish', 'blank' ); + $aData = Array('pro_uid' => $_REQUEST['pro_uid'], 'fcontent' => $fcontent, 'filename' => $_REQUEST['filename']); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_FileEdit', '', $aData); + G::RenderPage('publish', 'raw'); + // $G_PUBLISH->AddContent( 'view', 'processes/processesFileEditEmail' ); + // G::RenderPage( 'publish', 'blank' ); break; case 'saveFile': global $G_PUBLISH; $G_PUBLISH = new Publisher(); $sDir = ""; - if (isset( $_REQUEST['MAIN_DIRECTORY'] )) { + if (isset($_REQUEST['MAIN_DIRECTORY'])) { $sDir = $_REQUEST['MAIN_DIRECTORY']; } @@ -510,77 +511,77 @@ try { break; } - $fp = fopen( $sDirectory, 'w' ); - $content = stripslashes( $_REQUEST['fcontent'] ); - $content = str_replace( "@amp@", "&", $content ); - $content = base64_decode( $content ); - fwrite( $fp, $content ); - fclose( $fp ); + $fp = fopen($sDirectory, 'w'); + $content = stripslashes($_REQUEST['fcontent']); + $content = str_replace("@amp@", "&", $content); + $content = base64_decode($content); + fwrite($fp, $content); + fclose($fp); echo 'saved: ' . $sDirectory; break; case 'events': - $oProcessMap->eventsList( $oData->pro_uid, $oData->type ); + $oProcessMap->eventsList($oData->pro_uid, $oData->type); break; - /** - * returns an array with all Dynaforms Fields - */ + /** + * returns an array with all Dynaforms Fields + */ case 'getVariableList': G::LoadClass('xmlfield_InputPM'); - $proUid= isset( $_REQUEST['process'] )?$_REQUEST['process']:''; - $queryText= isset( $_REQUEST['queryText'] )?$_REQUEST['queryText']:''; - if ($_REQUEST['type']=='system'){ + $proUid = isset($_REQUEST['process']) ? $_REQUEST['process'] : ''; + $queryText = isset($_REQUEST['queryText']) ? $_REQUEST['queryText'] : ''; + if ($_REQUEST['type'] == 'system') { $isSystem = true; } else { $isSystem = false; } - if ($_REQUEST['type']=='all'){ - $aFields = getDynaformsVars( $proUid ); + if ($_REQUEST['type'] == 'all') { + $aFields = getDynaformsVars($proUid); } else { - $aFields = getDynaformsVars( $proUid, $isSystem, isset( $_REQUEST['bIncMulSelFields'] ) ? $_REQUEST['bIncMulSelFields'] : 1); + $aFields = getDynaformsVars($proUid, $isSystem, isset($_REQUEST['bIncMulSelFields']) ? $_REQUEST['bIncMulSelFields'] : 1); } $aVariables = array(); - foreach ($aFields as $key => $value){ - if($queryText!='') { - if(stristr($aFields[$key]['sName'], $queryText)){ + foreach ($aFields as $key => $value) { + if ($queryText != '') { + if (stristr($aFields[$key]['sName'], $queryText)) { $aVariables[] = $aFields[$key]; } } else { $aVariables[] = $aFields[$key]; } } - echo Bootstrap::json_encode( $aVariables ); + echo Bootstrap::json_encode($aVariables); break; - /** - * returns the prefix mean - * - */ + /** + * returns the prefix mean + * + */ case 'getVariablePrefix': - $_REQUEST['prefix'] = $_REQUEST['prefix']!=null?$_REQUEST['prefix']:'ID_TO_STRING'; + $_REQUEST['prefix'] = $_REQUEST['prefix'] != null ? $_REQUEST['prefix'] : 'ID_TO_STRING'; echo G::LoadTranslation($_REQUEST['prefix']); break; - /** - * return an array with all Variables of Grid type - */ + /** + * return an array with all Variables of Grid type + */ case 'getGridList': G::LoadClass('xmlfield_InputPM'); - $proUid= isset( $_REQUEST['PRO_UID'] )?$_REQUEST['PRO_UID']:''; + $proUid = isset($_REQUEST['PRO_UID']) ? $_REQUEST['PRO_UID'] : ''; - $aFields = getGridsVars( $proUid ); + $aFields = getGridsVars($proUid); $aVariables = array(); - foreach ($aFields as $key => $value){ + foreach ($aFields as $key => $value) { $aVariables[] = $aFields[$key]; } - echo Bootstrap::json_encode( $aVariables ); + echo Bootstrap::json_encode($aVariables); break; - /** - * return an array with all Grid Variables according to Grid - */ + /** + * return an array with all Grid Variables according to Grid + */ case 'getVariableGrid': G::LoadClass('xmlfield_InputPM'); - $proUid= isset( $_REQUEST['PRO_UID'] )?$_REQUEST['PRO_UID']:''; - $dynUid= isset( $_REQUEST['DYN_UID'] )?$_REQUEST['DYN_UID']:''; + $proUid = isset($_REQUEST['PRO_UID']) ? $_REQUEST['PRO_UID'] : ''; + $dynUid = isset($_REQUEST['DYN_UID']) ? $_REQUEST['DYN_UID'] : ''; $aFields = getVarsGrid($proUid, $dynUid); @@ -590,74 +591,74 @@ try { $aVariables[] = $key; } - echo Bootstrap::json_encode( $aVariables ); + echo Bootstrap::json_encode($aVariables); break; case 'getDynaformFieldList': - G::LoadClass( 'dynaformhandler' ); - $dynaformFields = array (); - $resultArray = array (); - $proUid= isset( $_REQUEST['PRO_UID'] )?$_REQUEST['PRO_UID']:''; - $dynUid= isset( $_REQUEST['DYN_UID'] )?$_REQUEST['DYN_UID']:''; - if (is_file( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) { - $dyn = new dynaFormHandler( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' ); + G::LoadClass('dynaformhandler'); + $dynaformFields = array(); + $resultArray = array(); + $proUid = isset($_REQUEST['PRO_UID']) ? $_REQUEST['PRO_UID'] : ''; + $dynUid = isset($_REQUEST['DYN_UID']) ? $_REQUEST['DYN_UID'] : ''; + if (is_file(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) { + $dyn = new dynaFormHandler(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml'); $dynaformFields[] = $dyn->getFields(); } foreach ($dynaformFields as $aDynFormFields) { foreach ($aDynFormFields as $field) { - $resultArray[] = array ("id"=>$field->nodeName, "name"=>$field->nodeName ); + $resultArray[] = array("id" => $field->nodeName, "name" => $field->nodeName); } } - echo Bootstrap::json_encode( $resultArray ); -// var_dump($resultArray); + echo Bootstrap::json_encode($resultArray); + // var_dump($resultArray); break; /* - case 'saveFile': - global $G_PUBLISH; - $G_PUBLISH = new Publisher(); - $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; + case 'saveFile': + global $G_PUBLISH; + $G_PUBLISH = new Publisher(); + $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename']; - $fp = fopen($sDirectory, 'w'); - $content = stripslashes($_REQUEST['fcontent']); - $content = str_replace("@amp@", "&", $content); - fwrite($fp, $content); - fclose($fp); - echo 'saved: '. $sDirectory; - break; - */ + $fp = fopen($sDirectory, 'w'); + $content = stripslashes($_REQUEST['fcontent']); + $content = str_replace("@amp@", "&", $content); + fwrite($fp, $content); + fclose($fp); + echo 'saved: '. $sDirectory; + break; + */ case 'emptyFileOptions': global $G_PUBLISH; $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_FileEditCreateEmpty', '' ); - G::RenderPage( 'publish', 'raw' ); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'processes/processes_FileEditCreateEmpty', ''); + G::RenderPage('publish', 'raw'); break; case "taskCases": require_once 'classes/model/AppDelegation.php'; - $criteria = new Criteria( 'workflow' ); - $criteria->addSelectColumn( AppDelegationPeer::APP_UID ); - $criteria->addSelectColumn( AppDelegationPeer::DEL_INDEX ); - $criteria->addSelectColumn( AppDelegationPeer::TAS_UID ); - $criteria->add( AppDelegationPeer::TAS_UID, $oData->task_uid ); - $criteria->add( AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' ); - $casesNumRec = AppDelegationPeer::doCount( $criteria ); + $criteria = new Criteria('workflow'); + $criteria->addSelectColumn(AppDelegationPeer::APP_UID); + $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); + $criteria->addSelectColumn(AppDelegationPeer::TAS_UID); + $criteria->add(AppDelegationPeer::TAS_UID, $oData->task_uid); + $criteria->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN'); + $casesNumRec = AppDelegationPeer::doCount($criteria); if ($casesNumRec == 0) { require_once 'classes/model/AppDelay.php'; - $criteria = new Criteria( 'workflow' ); - $criteria->addSelectColumn( AppDelayPeer::APP_UID ); - $criteria->addSelectColumn( AppDelayPeer::APP_DEL_INDEX ); - $criteria->add( AppDelayPeer::PRO_UID, $oData->pro_uid ); - $criteria->add( AppDelayPeer::APP_TYPE, 'PAUSE' ); - $criteria->add( AppDelayPeer::APP_DISABLE_ACTION_DATE, null, Criteria::ISNULL ); - $dataset = AppDelayPeer::doSelectRS( $criteria ); + $criteria = new Criteria('workflow'); + $criteria->addSelectColumn(AppDelayPeer::APP_UID); + $criteria->addSelectColumn(AppDelayPeer::APP_DEL_INDEX); + $criteria->add(AppDelayPeer::PRO_UID, $oData->pro_uid); + $criteria->add(AppDelayPeer::APP_TYPE, 'PAUSE'); + $criteria->add(AppDelayPeer::APP_DISABLE_ACTION_DATE, null, Criteria::ISNULL); + $dataset = AppDelayPeer::doSelectRS($criteria); if ($dataset->getRecordCount() > 0) { - $dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); while ($row = $dataset->getRow()) { - $criteria = new Criteria( 'workflow' ); - $criteria->addSelectColumn( AppDelegationPeer::TAS_UID ); - $criteria->add( AppDelegationPeer::APP_UID, $row['APP_UID'] ); - $criteria->add( AppDelegationPeer::DEL_INDEX, $row['APP_DEL_INDEX'] ); - $criteria->add( AppDelegationPeer::TAS_UID, $oData->task_uid ); - $casesNumRec += AppDelegationPeer::doCount( $criteria ); + $criteria = new Criteria('workflow'); + $criteria->addSelectColumn(AppDelegationPeer::TAS_UID); + $criteria->add(AppDelegationPeer::APP_UID, $row['APP_UID']); + $criteria->add(AppDelegationPeer::DEL_INDEX, $row['APP_DEL_INDEX']); + $criteria->add(AppDelegationPeer::TAS_UID, $oData->task_uid); + $casesNumRec += AppDelegationPeer::doCount($criteria); $dataset->next(); } } @@ -665,13 +666,13 @@ try { $response = new stdclass(); $response->casesNumRec = $casesNumRec; //$json = new Services_JSON(); - $sOutput = Bootstrap::json_encode( $response ); + $sOutput = Bootstrap::json_encode($response); break; } - if (isset( $sOutput )) { - die( $sOutput ); + if (isset($sOutput)) { + die($sOutput); } } catch (Exception $oException) { - die( $oException->getMessage() . "\n" . $oException->getTraceAsString() ); + die($oException->getMessage() . "\n" . $oException->getTraceAsString()); } diff --git a/workflow/engine/methods/users/usersAjax.php b/workflow/engine/methods/users/usersAjax.php index e21c5097f..11009ad94 100644 --- a/workflow/engine/methods/users/usersAjax.php +++ b/workflow/engine/methods/users/usersAjax.php @@ -6,134 +6,124 @@ switch ($_POST['action']) { case 'countryList': require_once ("classes/model/IsoCountry.php"); $c = new Criteria(); - $c->add( IsoCountryPeer::IC_UID, NULL, Criteria::ISNOTNULL ); + $c->add(IsoCountryPeer::IC_UID, null, Criteria::ISNOTNULL); - $countries = IsoCountryPeer::doSelect( $c ); + $countries = IsoCountryPeer::doSelect($c); foreach ($countries as $rowid => $row) { - $oData[] = Array ('IC_UID' => $row->getICUid(),'IC_NAME' => $row->getICName() - ); + $oData[] = Array('IC_UID' => $row->getICUid(), 'IC_NAME' => $row->getICName()); } - print (G::json_encode( $oData )) ; + print (G::json_encode($oData)); break; - case 'stateList': require_once ("classes/model/IsoSubdivision.php"); $c = new Criteria(); $country = $_POST['IC_UID']; - $c->add( IsoSubdivisionPeer::IC_UID, $country, Criteria::EQUAL ); - $locations = IsoSubdivisionPeer::doSelect( $c ); + $c->add(IsoSubdivisionPeer::IC_UID, $country, Criteria::EQUAL); + $locations = IsoSubdivisionPeer::doSelect($c); - $oData = Array (); + $oData = Array(); foreach ($locations as $rowid => $row) { - if (($row->getISUid() != '') && ($row->getISName() != '')) - $oData[] = Array ('IS_UID' => $row->getISUid(),'IS_NAME' => $row->getISName() - ); + if (($row->getISUid() != '') && ($row->getISName() != '')) { + $oData[] = Array('IS_UID' => $row->getISUid(), 'IS_NAME' => $row->getISName()); + } } - print (G::json_encode( $oData )) ; + print (G::json_encode($oData)); break; - case 'locationList': require_once ("classes/model/IsoLocation.php"); $c = new Criteria(); $country = $_POST['IC_UID']; $state = $_POST['IS_UID']; - $c->add( IsoLocationPeer::IC_UID, $country, Criteria::EQUAL ); - $c->add( IsoLocationPeer::IS_UID, $state, Criteria::EQUAL ); - $locations = IsoLocationPeer::doSelect( $c ); + $c->add(IsoLocationPeer::IC_UID, $country, Criteria::EQUAL); + $c->add(IsoLocationPeer::IS_UID, $state, Criteria::EQUAL); + $locations = IsoLocationPeer::doSelect($c); - $oData = Array (); + $oData = Array(); foreach ($locations as $rowid => $row) { - if (($row->getILUid() != '') && ($row->getILName() != '')) - $oData[] = Array ('IL_UID' => $row->getILUid(),'IL_NAME' => $row->getILName() - ); + if (($row->getILUid() != '') && ($row->getILName() != '')) { + $oData[] = Array('IL_UID' => $row->getILUid(), 'IL_NAME' => $row->getILName()); + } } - print (G::json_encode( $oData )) ; + print (G::json_encode($oData)); break; case 'usersList': require_once 'classes/model/Users.php'; $oCriteria = new Criteria(); - $oCriteria->addSelectColumn( UsersPeer::USR_UID ); - $oCriteria->addSelectColumn( UsersPeer::USR_USERNAME ); - $oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME ); - $oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME ); - $oCriteria->addSelectColumn( UsersPeer::USR_EMAIL ); - $oCriteria->add( UsersPeer::USR_STATUS, array ('ACTIVE','VACATION' - ), Criteria::IN ); - if (isset( $_POST['USR_UID'] )) { - $oCriteria->add( UsersPeer::USR_UID, $_POST['USR_UID'], Criteria::NOT_EQUAL ); + $oCriteria->addSelectColumn(UsersPeer::USR_UID); + $oCriteria->addSelectColumn(UsersPeer::USR_USERNAME); + $oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); + $oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME); + $oCriteria->addSelectColumn(UsersPeer::USR_EMAIL); + $oCriteria->add(UsersPeer::USR_STATUS, array('ACTIVE', 'VACATION'), Criteria::IN); + if (isset($_POST['USR_UID'])) { + $oCriteria->add(UsersPeer::USR_UID, $_POST['USR_UID'], Criteria::NOT_EQUAL); } - $oDataset = UsersPeer::doSelectRS( $oCriteria ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset = UsersPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - G::loadClass( 'configuration' ); + G::loadClass('configuration'); $oConf = new Configurations(); - $oConf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' ); + $oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', ''); - $defaultOption = isset( $oConf->aConfig['format'] ) ? $oConf->aConfig['format'] : ''; + $defaultOption = isset($oConf->aConfig['format']) ? $oConf->aConfig['format'] : ''; - $aUserInfo = array (); - if (isset( $_POST['addNone'] ) && $_POST['addNone'] == '1') { - $aUserInfo[] = array ('USR_UID' => '','USER_FULLNAME' => '- ' . G::LoadTranslation( 'ID_NONE' ) . ' -' - ); + $aUserInfo = array(); + if (isset($_POST['addNone']) && $_POST['addNone'] == '1') { + $aUserInfo[] = array('USR_UID' => '', 'USER_FULLNAME' => '- ' . G::LoadTranslation('ID_NONE') . ' -'); } while ($oDataset->next()) { $aRow1 = $oDataset->getRow(); - $infoUser = G::getFormatUserList( $defaultOption, $aRow1 ); - $aUserInfo[] = array ('USR_UID' => $aRow1['USR_UID'],'USER_FULLNAME' => $infoUser - ); + $infoUser = G::getFormatUserList($defaultOption, $aRow1); + $aUserInfo[] = array('USR_UID' => $aRow1['USR_UID'], 'USER_FULLNAME' => $infoUser); } - print (G::json_encode( $aUserInfo )) ; + print (G::json_encode($aUserInfo)); break; - case 'availableCalendars': - G::LoadClass( 'calendar' ); + G::LoadClass('calendar'); $calendar = new Calendar(); - $calendarObj = $calendar->getCalendarList( true, true ); - $oData[] = array ('CALENDAR_UID' => '','CALENDAR_NAME' => '- None -' - ); + $calendarObj = $calendar->getCalendarList(true, true); + $oData[] = array('CALENDAR_UID' => '', 'CALENDAR_NAME' => '- None -'); foreach ($calendarObj['array'] as $rowid => $row) { - if ($rowid > 0) - $oData[] = array ('CALENDAR_UID' => $row['CALENDAR_UID'],'CALENDAR_NAME' => $row['CALENDAR_NAME'] - ); + if ($rowid > 0) { + $oData[] = array('CALENDAR_UID' => $row['CALENDAR_UID'], 'CALENDAR_NAME' => $row['CALENDAR_NAME']); + } } - print (G::json_encode( $oData )) ; + print (G::json_encode($oData)); break; case 'rolesList': require_once PATH_RBAC . "model/Roles.php"; $roles = new Roles(); $rolesData = $roles->getAllRoles(); foreach ($rolesData as $rowid => $row) { - $oData[] = array ('ROL_UID' => $row['ROL_CODE'],'ROL_CODE' => $row['ROL_CODE'] - ); + $oData[] = array('ROL_UID' => $row['ROL_CODE'], 'ROL_CODE' => $row['ROL_CODE']); } - print (G::json_encode( $oData )) ; + print (G::json_encode($oData)); break; case 'saveUser': try { - $form = $_POST; - if (isset( $_POST['USR_UID'] )) { + if (isset($_POST['USR_UID'])) { $form['USR_UID'] = $_POST['USR_UID']; } else { $form['USR_UID'] = ''; } - if (! isset( $form['USR_NEW_PASS'] )) { + if (!isset($form['USR_NEW_PASS'])) { $form['USR_NEW_PASS'] = ''; } if ($form['USR_NEW_PASS'] != '') { - $form['USR_PASSWORD'] = md5( $form['USR_NEW_PASS'] ); + $form['USR_PASSWORD'] = md5($form['USR_NEW_PASS']); } - if (! isset( $form['USR_CITY'] )) { + if (!isset($form['USR_CITY'])) { $form['USR_CITY'] = ''; } - if (! isset( $form['USR_LOCATION'] )) { + if (!isset($form['USR_LOCATION'])) { $form['USR_LOCATION'] = ''; } - if (! isset( $form['USR_AUTH_USER_DN'] )) { + if (!isset($form['USR_AUTH_USER_DN'])) { $form['USR_AUTH_USER_DN'] = ''; } @@ -150,17 +140,17 @@ switch ($_POST['action']) { $aData['USR_LASTNAME'] = $form['USR_LASTNAME']; $aData['USR_EMAIL'] = $form['USR_EMAIL']; $aData['USR_DUE_DATE'] = $form['USR_DUE_DATE']; - $aData['USR_CREATE_DATE'] = date( 'Y-m-d H:i:s' ); - $aData['USR_UPDATE_DATE'] = date( 'Y-m-d H:i:s' ); - $aData['USR_BIRTHDAY'] = date( 'Y-m-d' ); + $aData['USR_CREATE_DATE'] = date('Y-m-d H:i:s'); + $aData['USR_UPDATE_DATE'] = date('Y-m-d H:i:s'); + $aData['USR_BIRTHDAY'] = date('Y-m-d'); $aData['USR_AUTH_USER_DN'] = $form['USR_AUTH_USER_DN']; //fixing bug in inactive user when the admin create a new user. $statusWF = $form['USR_STATUS']; $aData['USR_STATUS'] = $form['USR_STATUS'] == 'ACTIVE' ? 1 : 0; - $sUserUID = $RBAC->createUser( $aData, $form['USR_ROLE'] ); + $sUserUID = $RBAC->createUser($aData, $form['USR_ROLE']); $aData['USR_STATUS'] = $statusWF; $aData['USR_UID'] = $sUserUID; - $aData['USR_PASSWORD'] = md5( $sUserUID ); //fake :p + $aData['USR_PASSWORD'] = md5($sUserUID); //fake :p $aData['USR_COUNTRY'] = $form['USR_COUNTRY']; $aData['USR_CITY'] = $form['USR_CITY']; $aData['USR_LOCATION'] = $form['USR_LOCATION']; @@ -174,136 +164,133 @@ switch ($_POST['action']) { require_once 'classes/model/Users.php'; $oUser = new Users(); - $oUser->create( $aData ); + $oUser->create($aData); if ($_FILES['USR_PHOTO']['error'] != 1) { //print (PATH_IMAGES_ENVIRONMENT_USERS); if ($_FILES['USR_PHOTO']['tmp_name'] != '') { - G::uploadFile( $_FILES['USR_PHOTO']['tmp_name'], PATH_IMAGES_ENVIRONMENT_USERS, $sUserUID . '.gif' ); + G::uploadFile($_FILES['USR_PHOTO']['tmp_name'], PATH_IMAGES_ENVIRONMENT_USERS, $sUserUID . '.gif'); } } else { $result->success = false; $result->fileError = true; - print (G::json_encode( $result )) ; + print (G::json_encode($result)); die(); } /* - if ($_FILES['USR_RESUME']['error'] != 1) { - if ($_FILES['USR_RESUME']['tmp_name'] != '') { - G::uploadFile($_FILES['USR_RESUME']['tmp_name'], PATH_IMAGES_ENVIRONMENT_FILES . $sUserUID . '/', $_FILES['USR_RESUME']['name']); - } - } - else { - $result->success = false; - $result->fileError = true; - print(G::json_encode($result)); - die; - } -*/ + if ($_FILES['USR_RESUME']['error'] != 1) { + if ($_FILES['USR_RESUME']['tmp_name'] != '') { + G::uploadFile($_FILES['USR_RESUME']['tmp_name'], PATH_IMAGES_ENVIRONMENT_FILES . $sUserUID . '/', $_FILES['USR_RESUME']['name']); + } + } + else { + $result->success = false; + $result->fileError = true; + print(G::json_encode($result)); + die; + } + */ } else { $aData['USR_UID'] = $form['USR_UID']; $aData['USR_USERNAME'] = $form['USR_USERNAME']; - if (isset( $form['USR_PASSWORD'] )) { + if (isset($form['USR_PASSWORD'])) { if ($form['USR_PASSWORD'] != '') { $aData['USR_PASSWORD'] = $form['USR_PASSWORD']; require_once 'classes/model/UsersProperties.php'; $oUserProperty = new UsersProperties(); - $aUserProperty = $oUserProperty->loadOrCreateIfNotExists( $form['USR_UID'], array ('USR_PASSWORD_HISTORY' => serialize( array (md5( $form['USR_PASSWORD'] ) - ) ) - ) ); + $aUserProperty = $oUserProperty->loadOrCreateIfNotExists($form['USR_UID'], array('USR_PASSWORD_HISTORY' => serialize(array(md5($form['USR_PASSWORD']))))); $memKey = 'rbacSession' . session_id(); - $memcache = & PMmemcached::getSingleton( defined( 'SYS_SYS' ) ? SYS_SYS : '' ); - if (($RBAC->aUserInfo = $memcache->get( $memKey )) === false) { - $RBAC->loadUserRolePermission( $RBAC->sSystem, $_SESSION['USER_LOGGED'] ); - $memcache->set( $memKey, $RBAC->aUserInfo, PMmemcached::EIGHT_HOURS ); + $memcache = & PMmemcached::getSingleton(defined('SYS_SYS') ? SYS_SYS : '' ); + if (($RBAC->aUserInfo = $memcache->get($memKey)) === false) { + $RBAC->loadUserRolePermission($RBAC->sSystem, $_SESSION['USER_LOGGED']); + $memcache->set($memKey, $RBAC->aUserInfo, PMmemcached::EIGHT_HOURS); } if ($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE'] == 'PROCESSMAKER_ADMIN') { - $aUserProperty['USR_LAST_UPDATE_DATE'] = date( 'Y-m-d H:i:s' ); + $aUserProperty['USR_LAST_UPDATE_DATE'] = date('Y-m-d H:i:s'); $aUserProperty['USR_LOGGED_NEXT_TIME'] = 1; - $oUserProperty->update( $aUserProperty ); + $oUserProperty->update($aUserProperty); } - $aErrors = $oUserProperty->validatePassword( $form['USR_NEW_PASS'], $aUserProperty['USR_LAST_UPDATE_DATE'], 0 ); + $aErrors = $oUserProperty->validatePassword($form['USR_NEW_PASS'], $aUserProperty['USR_LAST_UPDATE_DATE'], 0); - if (count( $aErrors ) > 0) { - $sDescription = G::LoadTranslation( 'ID_POLICY_ALERT' ) . ':,'; + if (count($aErrors) > 0) { + $sDescription = G::LoadTranslation('ID_POLICY_ALERT') . ':,'; foreach ($aErrors as $sError) { switch ($sError) { case 'ID_PPP_MINIMUN_LENGTH': - $sDescription .= ' - ' . G::LoadTranslation( $sError ) . ': ' . PPP_MINIMUN_LENGTH . ','; + $sDescription .= ' - ' . G::LoadTranslation($sError) . ': ' . PPP_MINIMUN_LENGTH . ','; break; case 'ID_PPP_MAXIMUN_LENGTH': - $sDescription .= ' - ' . G::LoadTranslation( $sError ) . ': ' . PPP_MAXIMUN_LENGTH . ','; + $sDescription .= ' - ' . G::LoadTranslation($sError) . ': ' . PPP_MAXIMUN_LENGTH . ','; break; case 'ID_PPP_EXPIRATION_IN': - $sDescription .= ' - ' . G::LoadTranslation( $sError ) . ' ' . PPP_EXPIRATION_IN . ' ' . G::LoadTranslation( 'ID_DAYS' ) . ','; + $sDescription .= ' - ' . G::LoadTranslation($sError) . ' ' . PPP_EXPIRATION_IN . ' ' . G::LoadTranslation('ID_DAYS') . ','; break; default: - $sDescription .= ' - ' . G::LoadTranslation( $sError ) . ','; + $sDescription .= ' - ' . G::LoadTranslation($sError) . ','; break; } } - $sDescription .= '' . G::LoadTranslation( 'ID_PLEASE_CHANGE_PASSWORD_POLICY' ); + $sDescription .= '' . G::LoadTranslation('ID_PLEASE_CHANGE_PASSWORD_POLICY'); $result->success = false; $result->msg = $sDescription; - print (G::json_encode( $result )) ; + print (G::json_encode($result)); die(); - } - $aHistory = unserialize( $aUserProperty['USR_PASSWORD_HISTORY'] ); - if (! is_array( $aHistory )) { - $aHistory = array (); + $aHistory = unserialize($aUserProperty['USR_PASSWORD_HISTORY']); + if (!is_array($aHistory)) { + $aHistory = array(); } - if (! defined( 'PPP_PASSWORD_HISTORY' )) { - define( 'PPP_PASSWORD_HISTORY', 0 ); + if (!defined('PPP_PASSWORD_HISTORY')) { + define('PPP_PASSWORD_HISTORY', 0); } if (PPP_PASSWORD_HISTORY > 0) { //it's looking a password igual into aHistory array that was send for post in md5 way $c = 0; $sw = 1; - while (count( $aHistory ) >= 1 && count( $aHistory ) > $c && $sw) { - if (strcmp( trim( $aHistory[$c] ), trim( $form['USR_PASSWORD'] ) ) == 0) { + while (count($aHistory) >= 1 && count($aHistory) > $c && $sw) { + if (strcmp(trim($aHistory[$c]), trim($form['USR_PASSWORD'])) == 0) { $sw = 0; } - $c ++; + $c++; } if ($sw == 0) { - $sDescription = G::LoadTranslation( 'ID_POLICY_ALERT' ) . ':

'; - $sDescription .= ' - ' . G::LoadTranslation( 'PASSWORD_HISTORY' ) . ': ' . PPP_PASSWORD_HISTORY . '
'; - $sDescription .= '
' . G::LoadTranslation( 'ID_PLEASE_CHANGE_PASSWORD_POLICY' ) . ''; + $sDescription = G::LoadTranslation('ID_POLICY_ALERT') . ':

'; + $sDescription .= ' - ' . G::LoadTranslation('PASSWORD_HISTORY') . ': ' . PPP_PASSWORD_HISTORY . '
'; + $sDescription .= '
' . G::LoadTranslation('ID_PLEASE_CHANGE_PASSWORD_POLICY') . ''; $result->success = false; $result->msg = $sDescription; - print (G::json_encode( $result )) ; + print (G::json_encode($result)); die(); } - if (count( $aHistory ) >= PPP_PASSWORD_HISTORY) { - $sLastPassw = array_shift( $aHistory ); + if (count($aHistory) >= PPP_PASSWORD_HISTORY) { + $sLastPassw = array_shift($aHistory); } $aHistory[] = $form['USR_PASSWORD']; } - $aUserProperty['USR_LAST_UPDATE_DATE'] = date( 'Y-m-d H:i:s' ); + $aUserProperty['USR_LAST_UPDATE_DATE'] = date('Y-m-d H:i:s'); $aUserProperty['USR_LOGGED_NEXT_TIME'] = 1; - $aUserProperty['USR_PASSWORD_HISTORY'] = serialize( $aHistory ); - $oUserProperty->update( $aUserProperty ); + $aUserProperty['USR_PASSWORD_HISTORY'] = serialize($aHistory); + $oUserProperty->update($aUserProperty); } } $aData['USR_FIRSTNAME'] = $form['USR_FIRSTNAME']; $aData['USR_LASTNAME'] = $form['USR_LASTNAME']; $aData['USR_EMAIL'] = $form['USR_EMAIL']; $aData['USR_DUE_DATE'] = $form['USR_DUE_DATE']; - $aData['USR_UPDATE_DATE'] = date( 'Y-m-d H:i:s' ); - if (isset( $form['USR_STATUS'] )) { + $aData['USR_UPDATE_DATE'] = date('Y-m-d H:i:s'); + if (isset($form['USR_STATUS'])) { $aData['USR_STATUS'] = $form['USR_STATUS']; } - if (isset( $form['USR_ROLE'] )) { - $RBAC->updateUser( $aData, $form['USR_ROLE'] ); + if (isset($form['USR_ROLE'])) { + $RBAC->updateUser($aData, $form['USR_ROLE']); } else { - $RBAC->updateUser( $aData ); + $RBAC->updateUser($aData); } $aData['USR_COUNTRY'] = $form['USR_COUNTRY']; $aData['USR_CITY'] = $form['USR_CITY']; @@ -313,138 +300,134 @@ switch ($_POST['action']) { $aData['USR_ZIP_CODE'] = $form['USR_ZIP_CODE']; $aData['USR_POSITION'] = $form['USR_POSITION']; /* - if ($form['USR_RESUME'] != '') { - $aData['USR_RESUME'] = $form['USR_RESUME']; - } -*/ - if (isset( $form['USR_ROLE'] )) { + if ($form['USR_RESUME'] != '') { + $aData['USR_RESUME'] = $form['USR_RESUME']; + } + */ + if (isset($form['USR_ROLE'])) { $aData['USR_ROLE'] = $form['USR_ROLE']; } - if (isset( $form['USR_REPLACED_BY'] )) { + if (isset($form['USR_REPLACED_BY'])) { $aData['USR_REPLACED_BY'] = $form['USR_REPLACED_BY']; } - if (isset( $form['USR_AUTH_USER_DN'] )) { + if (isset($form['USR_AUTH_USER_DN'])) { $aData['USR_AUTH_USER_DN'] = $form['USR_AUTH_USER_DN']; } require_once 'classes/model/Users.php'; $oUser = new Users(); - $oUser->update( $aData ); + $oUser->update($aData); if ($_FILES['USR_PHOTO']['error'] != 1) { if ($_FILES['USR_PHOTO']['tmp_name'] != '') { - $aAux = explode( '.', $_FILES['USR_PHOTO']['name'] ); - G::uploadFile( $_FILES['USR_PHOTO']['tmp_name'], PATH_IMAGES_ENVIRONMENT_USERS, $aData['USR_UID'] . '.' . $aAux[1] ); - G::resizeImage( PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.' . $aAux[1], 96, 96, PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.gif' ); + $aAux = explode('.', $_FILES['USR_PHOTO']['name']); + G::uploadFile($_FILES['USR_PHOTO']['tmp_name'], PATH_IMAGES_ENVIRONMENT_USERS, $aData['USR_UID'] . '.' . $aAux[1]); + G::resizeImage(PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.' . $aAux[1], 96, 96, PATH_IMAGES_ENVIRONMENT_USERS . $aData['USR_UID'] . '.gif'); } } else { $result->success = false; $result->fileError = true; - print (G::json_encode( $result )) ; + print (G::json_encode($result)); die(); } /* - if ($_FILES['USR_RESUME']['error'] != 1) { - if ($_FILES['USR_RESUME']['tmp_name'] != '') { - G::uploadFile($_FILES['USR_RESUME']['tmp_name'], PATH_IMAGES_ENVIRONMENT_FILES . $aData['USR_UID'] . '/', $_FILES['USR_RESUME']['name']); - } - } - else { - $result->success = false; - $result->fileError = true; - print(G::json_encode($result)); - die; - } -*/ - /* Saving preferences */ - $def_lang = $form['PREF_DEFAULT_LANG']; + if ($_FILES['USR_RESUME']['error'] != 1) { + if ($_FILES['USR_RESUME']['tmp_name'] != '') { + G::uploadFile($_FILES['USR_RESUME']['tmp_name'], PATH_IMAGES_ENVIRONMENT_FILES . $aData['USR_UID'] . '/', $_FILES['USR_RESUME']['name']); + } + } + else { + $result->success = false; + $result->fileError = true; + print(G::json_encode($result)); + die; + } + */ + /* Saving preferences */ + $def_lang = $form['PREF_DEFAULT_LANG']; $def_menu = $form['PREF_DEFAULT_MENUSELECTED']; - $def_cases_menu = isset( $form['PREF_DEFAULT_CASES_MENUSELECTED'] ) ? $form['PREF_DEFAULT_CASES_MENUSELECTED'] : ''; + $def_cases_menu = isset($form['PREF_DEFAULT_CASES_MENUSELECTED']) ? $form['PREF_DEFAULT_CASES_MENUSELECTED'] : ''; - G::loadClass( 'configuration' ); + G::loadClass('configuration'); $oConf = new Configurations(); - $aConf = Array ('DEFAULT_LANG' => $def_lang,'DEFAULT_MENU' => $def_menu,'DEFAULT_CASES_MENU' => $def_cases_menu - ); + $aConf = Array('DEFAULT_LANG' => $def_lang, 'DEFAULT_MENU' => $def_menu, 'DEFAULT_CASES_MENU' => $def_cases_menu); - /*UPDATING SESSION VARIABLES*/ - $aUser = $RBAC->userObj->load( $_SESSION['USER_LOGGED'] ); + /* UPDATING SESSION VARIABLES */ + $aUser = $RBAC->userObj->load($_SESSION['USER_LOGGED']); //$_SESSION['USR_FULLNAME'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME']; $oConf->aConfig = $aConf; - $oConf->saveConfig( 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'] ); - + $oConf->saveConfig('USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED']); } if ($_SESSION['USER_LOGGED'] == $form['USR_UID']) { /* UPDATING SESSION VARIABLES */ - $aUser = $RBAC->userObj->load( $_SESSION['USER_LOGGED'] ); + $aUser = $RBAC->userObj->load($_SESSION['USER_LOGGED']); $_SESSION['USR_FULLNAME'] = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME']; } //Save Calendar assigment - if ((isset( $form['USR_CALENDAR'] ))) { + if ((isset($form['USR_CALENDAR']))) { //Save Calendar ID for this user - G::LoadClass( "calendar" ); + G::LoadClass("calendar"); $calendarObj = new Calendar(); - $calendarObj->assignCalendarTo( $aData['USR_UID'], $form['USR_CALENDAR'], 'USER' ); + $calendarObj->assignCalendarTo($aData['USR_UID'], $form['USR_CALENDAR'], 'USER'); } $result->success = true; - print (G::json_encode( $result )) ; + print (G::json_encode($result)); } catch (Exception $e) { $result->success = false; $result->error = $e->getMessage(); - print (G::json_encode( $result )) ; + print (G::json_encode($result)); } break; - case 'userData': require_once 'classes/model/Users.php'; $_SESSION['CURRENT_USER'] = $_POST['USR_UID']; $oUser = new Users(); - $aFields = $oUser->loadDetailed( $_POST['USR_UID'] ); + $aFields = $oUser->loadDetailed($_POST['USR_UID']); //Load Calendar options and falue for this user - G::LoadClass( 'calendar' ); + G::LoadClass('calendar'); $calendar = new Calendar(); - $calendarInfo = $calendar->getCalendarFor( $_POST['USR_UID'], $_POST['USR_UID'], $_POST['USR_UID'] ); + $calendarInfo = $calendar->getCalendarFor($_POST['USR_UID'], $_POST['USR_UID'], $_POST['USR_UID']); //If the function returns a DEFAULT calendar it means that this object doesn't have assigned any calendar $aFields['USR_CALENDAR'] = $calendarInfo['CALENDAR_APPLIED'] != 'DEFAULT' ? $calendarInfo['CALENDAR_UID'] : ""; #verifying if it has any preferences on the configurations table - G::loadClass( 'configuration' ); + G::loadClass('configuration'); $oConf = new Configurations(); - $oConf->loadConfig( $x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], '' ); + $oConf->loadConfig($x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], ''); $aFields['PREF_DEFAULT_MENUSELECTED'] = ''; $aFields['PREF_DEFAULT_CASES_MENUSELECTED'] = ''; - if (sizeof( $oConf->Fields ) > 0) { #this user has a configuration record + if (sizeof($oConf->Fields) > 0) { + // this user has a configuration record $aFields['PREF_DEFAULT_LANG'] = $oConf->aConfig['DEFAULT_LANG']; - $aFields['PREF_DEFAULT_MENUSELECTED'] = isset( $oConf->aConfig['DEFAULT_MENU'] ) ? $oConf->aConfig['DEFAULT_MENU'] : ''; - $aFields['PREF_DEFAULT_CASES_MENUSELECTED'] = isset( $oConf->aConfig['DEFAULT_CASES_MENU'] ) ? $oConf->aConfig['DEFAULT_CASES_MENU'] : ''; + $aFields['PREF_DEFAULT_MENUSELECTED'] = isset($oConf->aConfig['DEFAULT_MENU']) ? $oConf->aConfig['DEFAULT_MENU'] : ''; + $aFields['PREF_DEFAULT_CASES_MENUSELECTED'] = isset($oConf->aConfig['DEFAULT_CASES_MENU']) ? $oConf->aConfig['DEFAULT_CASES_MENU'] : ''; } else { switch ($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE']) { case 'PROCESSMAKER_ADMIN': $aFields['PREF_DEFAULT_MENUSELECTED'] = 'PM_SETUP'; break; - case 'PROCESSMAKER_OPERATOR': $aFields['PREF_DEFAULT_MENUSELECTED'] = 'PM_CASES'; break; - } $aFields['PREF_DEFAULT_LANG'] = SYS_LANG; } if ($aFields['USR_REPLACED_BY'] != '') { $user = new Users(); - $u = $user->load( $aFields['USR_REPLACED_BY'] ); + $u = $user->load($aFields['USR_REPLACED_BY']); if ($u['USR_STATUS'] == 'CLOSED') { $replaced_by = ''; $aFields['USR_REPLACED_BY'] = ''; } else { $c = new Configurations(); - $replaced_by = $c->usersNameFormat( $u['USR_USERNAME'], $u['USR_FIRSTNAME'], $u['USR_LASTNAME'] ); + $replaced_by = $c->usersNameFormat($u['USR_USERNAME'], $u['USR_FIRSTNAME'], $u['USR_LASTNAME']); } } else { $replaced_by = ''; @@ -460,16 +443,16 @@ switch ($_POST['action']) { switch ($permission['PER_CODE']) { case 'PM_USERS': case 'PM_SETUP': - $menuSelected = strtoupper( G::LoadTranslation( 'ID_SETUP' ) ); + $menuSelected = strtoupper(G::LoadTranslation('ID_SETUP')); break; case 'PM_CASES': - $menuSelected = strtoupper( G::LoadTranslation( 'ID_CASES' ) ); + $menuSelected = strtoupper(G::LoadTranslation('ID_CASES')); break; case 'PM_FACTORY': - $menuSelected = strtoupper( G::LoadTranslation( 'ID_APPLICATIONS' ) ); + $menuSelected = strtoupper(G::LoadTranslation('ID_APPLICATIONS')); break; case 'PM_DASHBOARD': - $menuSelected = strtoupper( G::LoadTranslation( 'ID_DASHBOARD' ) ); + $menuSelected = strtoupper(G::LoadTranslation('ID_DASHBOARD')); break; } } @@ -479,14 +462,15 @@ switch ($_POST['action']) { $aFields['MENUSELECTED_NAME'] = $menuSelected; $oMenu = new Menu(); - $oMenu->load( 'cases' ); + $oMenu->load('cases'); $casesMenuSelected = ''; if ($aFields['PREF_DEFAULT_CASES_MENUSELECTED'] != '') { foreach ($oMenu->Id as $i => $item) { - if ($aFields['PREF_DEFAULT_CASES_MENUSELECTED'] == $item) + if ($aFields['PREF_DEFAULT_CASES_MENUSELECTED'] == $item) { $casesMenuSelected = $oMenu->Labels[$i]; + } } } @@ -495,139 +479,134 @@ switch ($_POST['action']) { $result->success = true; $result->user = $aFields; - print (G::json_encode( $result )) ; + print (G::json_encode($result)); break; - case 'defaultMainMenuOptionList': foreach ($RBAC->aUserInfo['PROCESSMAKER']['PERMISSIONS'] as $permission) { switch ($permission['PER_CODE']) { case 'PM_USERS': case 'PM_SETUP': - $rows[] = Array ('id' => 'PM_SETUP','name' => strtoupper( G::LoadTranslation( 'ID_SETUP' ) ) + $rows[] = Array('id' => 'PM_SETUP', 'name' => strtoupper(G::LoadTranslation('ID_SETUP')) ); break; case 'PM_CASES': - $rows[] = Array ('id' => 'PM_CASES','name' => strtoupper( G::LoadTranslation( 'ID_CASES' ) ) + $rows[] = Array('id' => 'PM_CASES', 'name' => strtoupper(G::LoadTranslation('ID_CASES')) ); break; case 'PM_FACTORY': - $rows[] = Array ('id' => 'PM_FACTORY','name' => strtoupper( G::LoadTranslation( 'ID_APPLICATIONS' ) ) + $rows[] = Array('id' => 'PM_FACTORY', 'name' => strtoupper(G::LoadTranslation('ID_APPLICATIONS')) ); break; case 'PM_DASHBOARD': - $rows[] = Array ('id' => 'PM_DASHBOARD','name' => strtoupper( G::LoadTranslation( 'ID_DASHBOARD' ) ) + $rows[] = Array('id' => 'PM_DASHBOARD', 'name' => strtoupper(G::LoadTranslation('ID_DASHBOARD')) ); break; } } - print (G::json_encode( $rows )) ; + print (G::json_encode($rows)); break; case 'defaultCasesMenuOptionList': $oMenu = new Menu(); - $oMenu->load( 'cases' ); + $oMenu->load('cases'); foreach ($oMenu->Id as $i => $item) { if ($oMenu->Types[$i] != 'blockHeader') { - $rowsCasesMenu[] = Array ('id' => $item,'name' => $oMenu->Labels[$i] - ); + $rowsCasesMenu[] = Array('id' => $item, 'name' => $oMenu->Labels[$i]); } } - print (G::json_encode( $rowsCasesMenu )) ; + print (G::json_encode($rowsCasesMenu)); break; case 'testPassword': require_once 'classes/model/UsersProperties.php'; $oUserProperty = new UsersProperties(); - $aFields = array (); + $aFields = array(); $color = ''; $img = ''; - $dateNow = date( 'Y-m-d H:i:s' ); - $aErrors = $oUserProperty->validatePassword( $_POST['PASSWORD_TEXT'], $dateNow, $dateNow ); + $dateNow = date('Y-m-d H:i:s'); + $aErrors = $oUserProperty->validatePassword($_POST['PASSWORD_TEXT'], $dateNow, $dateNow); - if (! empty( $aErrors )) { + if (!empty($aErrors)) { $img = '/images/delete.png'; $color = 'red'; - if (! defined( 'NO_DISPLAY_USERNAME' )) { - define( 'NO_DISPLAY_USERNAME', 1 ); + if (!defined('NO_DISPLAY_USERNAME')) { + define('NO_DISPLAY_USERNAME', 1); } - $aFields = array (); - $aFields['DESCRIPTION'] = G::LoadTranslation( 'ID_POLICY_ALERT' ) . ':
'; + $aFields = array(); + $aFields['DESCRIPTION'] = G::LoadTranslation('ID_POLICY_ALERT') . ':
'; foreach ($aErrors as $sError) { switch ($sError) { case 'ID_PPP_MINIMUM_LENGTH': - $aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation( $sError ) . ': ' . PPP_MINIMUM_LENGTH . '
'; - $aFields[substr( $sError, 3 )] = PPP_MINIMUM_LENGTH; + $aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError) . ': ' . PPP_MINIMUM_LENGTH . '
'; + $aFields[substr($sError, 3)] = PPP_MINIMUM_LENGTH; break; case 'ID_PPP_MAXIMUM_LENGTH': - $aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation( $sError ) . ': ' . PPP_MAXIMUM_LENGTH . '
'; - $aFields[substr( $sError, 3 )] = PPP_MAXIMUM_LENGTH; + $aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError) . ': ' . PPP_MAXIMUM_LENGTH . '
'; + $aFields[substr($sError, 3)] = PPP_MAXIMUM_LENGTH; break; case 'ID_PPP_EXPIRATION_IN': - $aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation( $sError ) . ' ' . PPP_EXPIRATION_IN . ' ' . G::LoadTranslation( 'ID_DAYS' ) . '
'; - $aFields[substr( $sError, 3 )] = PPP_EXPIRATION_IN; + $aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError) . ' ' . PPP_EXPIRATION_IN . ' ' . G::LoadTranslation('ID_DAYS') . '
'; + $aFields[substr($sError, 3)] = PPP_EXPIRATION_IN; break; default: - $aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation( $sError ) . '
'; - $aFields[substr( $sError, 3 )] = 1; + $aFields['DESCRIPTION'] .= ' - ' . G::LoadTranslation($sError) . '
'; + $aFields[substr($sError, 3)] = 1; break; } } - $aFields['DESCRIPTION'] .= G::LoadTranslation( 'ID_PLEASE_CHANGE_PASSWORD_POLICY' ) . ''; + $aFields['DESCRIPTION'] .= G::LoadTranslation('ID_PLEASE_CHANGE_PASSWORD_POLICY') . ''; $aFields['STATUS'] = false; } else { $color = 'green'; $img = '/images/dialog-ok-apply.png'; - $aFields['DESCRIPTION'] = G::LoadTranslation( 'ID_PASSWORD_COMPLIES_POLICIES' ) . ''; + $aFields['DESCRIPTION'] = G::LoadTranslation('ID_PASSWORD_COMPLIES_POLICIES') . ''; $aFields['STATUS'] = true; } $span = ''; $gif = ''; $aFields['DESCRIPTION'] = $span . $gif . $aFields['DESCRIPTION']; - print (G::json_encode( $aFields )) ; + print (G::json_encode($aFields)); break; case 'testUsername': require_once 'classes/model/Users.php'; - $_POST['NEW_USERNAME'] = trim( $_POST['NEW_USERNAME'] ); - $USR_UID = isset( $_POST['USR_UID'] ) ? $_POST['USR_UID'] : ''; + $_POST['NEW_USERNAME'] = trim($_POST['NEW_USERNAME']); + $USR_UID = isset($_POST['USR_UID']) ? $_POST['USR_UID'] : ''; - $response = array ("success" => true - ); + $response = array("success" => true); $oCriteria = new Criteria(); - $oCriteria->addSelectColumn( UsersPeer::USR_USERNAME ); + $oCriteria->addSelectColumn(UsersPeer::USR_USERNAME); - $oCriteria->add( UsersPeer::USR_USERNAME, $_POST['NEW_USERNAME'] ); + $oCriteria->add(UsersPeer::USR_USERNAME, $_POST['NEW_USERNAME']); if ($USR_UID != '') { - $oCriteria->add( UsersPeer::USR_UID, array ($_POST['USR_UID'] - ), Criteria::NOT_IN ); + $oCriteria->add(UsersPeer::USR_UID, array($_POST['USR_UID']), Criteria::NOT_IN); } - $oDataset = UsersPeer::doSelectRS( $oCriteria ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset = UsersPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aRow = $oDataset->getRow(); - if (is_array( $aRow ) || $_POST['NEW_USERNAME'] == '') { + if (is_array($aRow) || $_POST['NEW_USERNAME'] == '') { $color = 'red'; $img = '/images/delete.png'; $dataVar['USER_ID'] = $_POST['NEW_USERNAME']; - $text = G::LoadTranslation( 'ID_USERNAME_ALREADY_EXISTS', $dataVar ); - $text = ($_POST['NEW_USERNAME'] == '') ? G::LoadTranslation( 'ID_MSG_ERROR_USR_USERNAME' ) : $text; + $text = G::LoadTranslation('ID_USERNAME_ALREADY_EXISTS', $dataVar); + $text = ($_POST['NEW_USERNAME'] == '') ? G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME') : $text; $response['exists'] = true; } else { $color = 'green'; $img = '/images/dialog-ok-apply.png'; - $text = G::LoadTranslation( 'ID_USERNAME_CORRECT' ); + $text = G::LoadTranslation('ID_USERNAME_CORRECT'); $response['exists'] = false; } $span = ''; $gif = ''; $response['descriptionText'] = $span . $gif . $text . ''; - echo G::json_encode( $response ); + echo G::json_encode($response); break; - } - + \ No newline at end of file diff --git a/workflow/engine/methods/users/users_Ajax.php b/workflow/engine/methods/users/users_Ajax.php index aeb2ccadd..0695d5bfb 100755 --- a/workflow/engine/methods/users/users_Ajax.php +++ b/workflow/engine/methods/users/users_Ajax.php @@ -1,4 +1,5 @@ userCanAccess( 'PM_LOGIN' )) { + switch ($RBAC->userCanAccess('PM_LOGIN')) { case - 2: - G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' ); - G::header( 'location: ../login/login' ); + G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); + G::header('location: ../login/login'); die(); break; case - 1: - G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); - G::header( 'location: ../login/login' ); + G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); + G::header('location: ../login/login'); die(); break; } - G::LoadInclude( 'ajax' ); - if (isset( $_POST['form'] )) { + G::LoadInclude('ajax'); + if (isset($_POST['form'])) { $_POST = $_POST['form']; } - if (isset( $_REQUEST['function'] )) { + if (isset($_REQUEST['function'])) { //$value= $_POST['function']; - $value = get_ajax_value( 'function' ); + $value = get_ajax_value('function'); } else { //$value= $_POST['functions']; - $value = get_ajax_value( 'functions' ); + $value = get_ajax_value('functions'); } switch ($value) { case 'verifyUsername': //print_r($_POST); die; - $_POST['sOriginalUsername'] = get_ajax_value( 'sOriginalUsername' ); - $_POST['sUsername'] = get_ajax_value( 'sUsername' ); + $_POST['sOriginalUsername'] = get_ajax_value('sOriginalUsername'); + $_POST['sUsername'] = get_ajax_value('sUsername'); if ($_POST['sOriginalUsername'] == $_POST['sUsername']) { echo '0'; } else { require_once 'classes/model/Users.php'; - G::LoadClass( 'Users' ); + G::LoadClass('Users'); $oUser = new Users(); - $oCriteria = $oUser->loadByUsername( $_POST['sUsername'] ); - $oDataset = UsersPeer::doSelectRS( $oCriteria ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oCriteria = $oUser->loadByUsername($_POST['sUsername']); + $oDataset = UsersPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aRow = $oDataset->getRow(); //print_r($aRow); die; //if (!$aRow) - if (! is_array( $aRow )) { + if (!is_array($aRow)) { echo '0'; } else { echo '1'; @@ -72,34 +73,34 @@ try { } break; case 'availableUsers': - G::LoadClass( 'processMap' ); + G::LoadClass('processMap'); $oProcessMap = new ProcessMap(); global $G_PUBLISH; $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'users/users_AvailableUsers', $oProcessMap->getAvailableUsersCriteria( $_GET['sTask'], $_GET['iType'] ) ); - G::RenderPage( 'publish', 'raw' ); + $G_PUBLISH->AddContent('propeltable', 'paged-table', 'users/users_AvailableUsers', $oProcessMap->getAvailableUsersCriteria($_GET['sTask'], $_GET['iType'])); + G::RenderPage('publish', 'raw'); break; case 'assign': - G::LoadClass( 'tasks' ); + G::LoadClass('tasks'); $oTasks = new Tasks(); switch ((int) $_POST['TU_RELATION']) { case 1: - echo $oTasks->assignUser( $_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE'] ); + echo $oTasks->assignUser($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']); break; case 2: - echo $oTasks->assignGroup( $_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE'] ); + echo $oTasks->assignGroup($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']); break; } break; case 'ofToAssign': - G::LoadClass( 'tasks' ); + G::LoadClass('tasks'); $oTasks = new Tasks(); switch ((int) $_POST['TU_RELATION']) { case 1: - echo $oTasks->ofToAssignUser( $_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE'] ); + echo $oTasks->ofToAssignUser($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']); break; case 2: - echo $oTasks->ofToAssignGroup( $_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE'] ); + echo $oTasks->ofToAssignGroup($_POST['TAS_UID'], $_POST['USR_UID'], $_POST['TU_TYPE']); break; } break; @@ -107,36 +108,36 @@ try { $_SESSION['iType'] = $_POST['TU_TYPE']; break; case 'deleteGroup': - G::LoadClass( 'groups' ); + G::LoadClass('groups'); $oGroup = new Groups(); - $oGroup->removeUserOfGroup( $_POST['GRP_UID'], $_POST['USR_UID'] ); + $oGroup->removeUserOfGroup($_POST['GRP_UID'], $_POST['USR_UID']); $_GET['sUserUID'] = $_POST['USR_UID']; $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent( 'view', 'users/users_Tree' ); - G::RenderPage( 'publish', 'raw' ); + $G_PUBLISH->AddContent('view', 'users/users_Tree'); + G::RenderPage('publish', 'raw'); break; case 'showUserGroupInterface': $_GET['sUserUID'] = $_POST['sUserUID']; $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent( 'view', 'users/users_AssignGroup' ); - G::RenderPage( 'publish', 'raw' ); + $G_PUBLISH->AddContent('view', 'users/users_AssignGroup'); + G::RenderPage('publish', 'raw'); break; case 'showUserGroups': $_GET['sUserUID'] = $_POST['sUserUID']; $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent( 'view', 'users/users_Tree' ); - G::RenderPage( 'publish', 'raw' ); + $G_PUBLISH->AddContent('view', 'users/users_Tree'); + G::RenderPage('publish', 'raw'); break; case 'assignUserToGroup': - G::LoadClass( 'groups' ); + G::LoadClass('groups'); $oGroup = new Groups(); - $oGroup->addUserToGroup( $_POST['GRP_UID'], $_POST['USR_UID'] ); - echo '

' . G::LoadTranslation( 'ID_MSG_ASSIGN_DONE' ) . '

'; + $oGroup->addUserToGroup($_POST['GRP_UID'], $_POST['USR_UID']); + echo '

' . G::LoadTranslation('ID_MSG_ASSIGN_DONE') . '

'; break; case 'usersGroup': - G::LoadClass( 'groups' ); + G::LoadClass('groups'); $oGroup = new Groups(); - $aGroup = $oGroup->getUsersOfGroup( $_POST['GRP_UID'] ); + $aGroup = $oGroup->getUsersOfGroup($_POST['GRP_UID']); foreach ($aGroup as $iIndex => $aValues) { echo $aValues['USR_FIRSTNAME'] . ' ' . $aValues['USR_LASTNAME'] . '
'; } @@ -144,9 +145,9 @@ try { //This case is used to check if any of the user group has as role 'PROCESSMAKER_ADMIN', case 'usersAdminGroupExtJS': - G::LoadClass( 'groups' ); + G::LoadClass('groups'); $oGroup = new Groups(); - $aGroup = $oGroup->getUsersOfGroup( $_POST['GRP_UID'] ); + $aGroup = $oGroup->getUsersOfGroup($_POST['GRP_UID']); $responseUser = 'false'; $usersAdmin = ''; foreach ($aGroup as $iIndex => $aValues) { @@ -155,28 +156,28 @@ try { $usersAdmin .= $aValues['USR_FIRSTNAME'] . ' ' . $aValues['USR_LASTNAME'] . ', '; } } - $usersAdmin = substr( $usersAdmin, 0, - 2 ); + $usersAdmin = substr($usersAdmin, 0, - 2); $result = new stdClass(); $result->reponse = $responseUser; $result->users = $usersAdmin; - echo G::json_encode( $result ); + echo G::json_encode($result); break; case 'canDeleteUser': - G::LoadClass( 'case' ); + G::LoadClass('case'); $oProcessMap = new Cases(); $USR_UID = $_POST['uUID']; $total = 0; $history = 0; - $c = $oProcessMap->getCriteriaUsersCases( 'TO_DO', $USR_UID ); - $total += ApplicationPeer::doCount( $c ); - $c = $oProcessMap->getCriteriaUsersCases( 'DRAFT', $USR_UID ); - $total += ApplicationPeer::doCount( $c ); - $c = $oProcessMap->getCriteriaUsersCases( 'COMPLETED', $USR_UID ); - $history += ApplicationPeer::doCount( $c ); - $c = $oProcessMap->getCriteriaUsersCases( 'CANCELLED', $USR_UID ); - $history += ApplicationPeer::doCount( $c ); + $c = $oProcessMap->getCriteriaUsersCases('TO_DO', $USR_UID); + $total += ApplicationPeer::doCount($c); + $c = $oProcessMap->getCriteriaUsersCases('DRAFT', $USR_UID); + $total += ApplicationPeer::doCount($c); + $c = $oProcessMap->getCriteriaUsersCases('COMPLETED', $USR_UID); + $history += ApplicationPeer::doCount($c); + $c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $USR_UID); + $history += ApplicationPeer::doCount($c); $response = '{success: true, candelete: '; $response .= ($total > 0) ? 'false' : 'true'; $response .= ', hashistory: '; @@ -186,97 +187,97 @@ try { break; case 'deleteUser': $UID = $_POST['USR_UID']; - G::LoadClass( 'tasks' ); + G::LoadClass('tasks'); $oTasks = new Tasks(); - $oTasks->ofToAssignUserOfAllTasks( $UID ); - G::LoadClass( 'groups' ); + $oTasks->ofToAssignUserOfAllTasks($UID); + G::LoadClass('groups'); $oGroups = new Groups(); - $oGroups->removeUserOfAllGroups( $UID ); - $RBAC->changeUserStatus( $UID, 'CLOSED' ); + $oGroups->removeUserOfAllGroups($UID); + $RBAC->changeUserStatus($UID, 'CLOSED'); $_GET['USR_USERNAME'] = ''; - $RBAC->updateUser( array ('USR_UID' => $UID,'USR_USERNAME' => $_GET['USR_USERNAME'] - ), '' ); + $RBAC->updateUser(array('USR_UID' => $UID, 'USR_USERNAME' => $_GET['USR_USERNAME'] + ), ''); require_once 'classes/model/Users.php'; $oUser = new Users(); - $aFields = $oUser->load( $UID ); + $aFields = $oUser->load($UID); $aFields['USR_STATUS'] = 'CLOSED'; $aFields['USR_USERNAME'] = ''; - $oUser->update( $aFields ); + $oUser->update($aFields); break; case 'changeUserStatus': $response = new stdclass(); - if (isset( $_REQUEST['USR_UID'] ) && isset( $_REQUEST['NEW_USR_STATUS'] )) { - $RBAC->changeUserStatus( $_REQUEST['USR_UID'], ($_REQUEST['NEW_USR_STATUS'] == 'ACTIVE' ? 1 : 0) ); + if (isset($_REQUEST['USR_UID']) && isset($_REQUEST['NEW_USR_STATUS'])) { + $RBAC->changeUserStatus($_REQUEST['USR_UID'], ($_REQUEST['NEW_USR_STATUS'] == 'ACTIVE' ? 1 : 0)); require_once 'classes/model/Users.php'; $userInstance = new Users(); - $userData = $userInstance->load( $_REQUEST['USR_UID'] ); + $userData = $userInstance->load($_REQUEST['USR_UID']); $userData['USR_STATUS'] = $_REQUEST['NEW_USR_STATUS']; - $userInstance->update( $userData ); + $userInstance->update($userData); $response->status = 'OK'; } else { $response->status = 'ERROR'; $response->message = 'USR_UID and NEW_USR_STATUS parameters are required.'; } - die( G::json_encode( $response ) ); + die(G::json_encode($response)); break; case 'availableGroups': - G::LoadClass( 'groups' ); - $filter = (isset( $_POST['textFilter'] )) ? $_POST['textFilter'] : ''; + G::LoadClass('groups'); + $filter = (isset($_POST['textFilter'])) ? $_POST['textFilter'] : ''; $groups = new Groups(); - $criteria = $groups->getAvailableGroupsCriteria( $_REQUEST['uUID'], $filter ); - $objects = GroupwfPeer::doSelectRS( $criteria ); - $objects->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $arr = Array (); + $criteria = $groups->getAvailableGroupsCriteria($_REQUEST['uUID'], $filter); + $objects = GroupwfPeer::doSelectRS($criteria); + $objects->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $arr = Array(); while ($objects->next()) { $arr[] = $objects->getRow(); } - echo '{groups: ' . G::json_encode( $arr ) . '}'; + echo '{groups: ' . G::json_encode($arr) . '}'; break; case 'assignedGroups': - G::LoadClass( 'groups' ); - $filter = (isset( $_POST['textFilter'] )) ? $_POST['textFilter'] : ''; + G::LoadClass('groups'); + $filter = (isset($_POST['textFilter'])) ? $_POST['textFilter'] : ''; $groups = new Groups(); - $criteria = $groups->getAssignedGroupsCriteria( $_REQUEST['uUID'], $filter ); - $objects = GroupwfPeer::doSelectRS( $criteria ); - $objects->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $arr = Array (); + $criteria = $groups->getAssignedGroupsCriteria($_REQUEST['uUID'], $filter); + $objects = GroupwfPeer::doSelectRS($criteria); + $objects->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $arr = Array(); while ($objects->next()) { $arr[] = $objects->getRow(); } - echo '{groups: ' . G::json_encode( $arr ) . '}'; + echo '{groups: ' . G::json_encode($arr) . '}'; break; case 'assignGroupsToUserMultiple': $USR_UID = $_POST['USR_UID']; - $gUIDs = explode( ',', $_POST['GRP_UID'] ); - G::LoadClass( 'groups' ); + $gUIDs = explode(',', $_POST['GRP_UID']); + G::LoadClass('groups'); $oGroup = new Groups(); foreach ($gUIDs as $GRP_UID) { - $oGroup->addUserToGroup( $GRP_UID, $USR_UID ); + $oGroup->addUserToGroup($GRP_UID, $USR_UID); } break; case 'deleteGroupsToUserMultiple': $USR_UID = $_POST['USR_UID']; - $gUIDs = explode( ',', $_POST['GRP_UID'] ); - G::LoadClass( 'groups' ); + $gUIDs = explode(',', $_POST['GRP_UID']); + G::LoadClass('groups'); $oGroup = new Groups(); foreach ($gUIDs as $GRP_UID) { - $oGroup->removeUserOfGroup( $GRP_UID, $USR_UID ); + $oGroup->removeUserOfGroup($GRP_UID, $USR_UID); } break; case 'authSources': $criteria = $RBAC->getAllAuthSources(); - $objects = AuthenticationSourcePeer::doSelectRS( $criteria ); - $objects->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $arr = Array (); - if (isset( $_REQUEST['cmb'] )) { + $objects = AuthenticationSourcePeer::doSelectRS($criteria); + $objects->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $arr = Array(); + if (isset($_REQUEST['cmb'])) { if ($_REQUEST['cmb'] == 'yes') { - $started = Array (); + $started = Array(); $started['AUTH_SOURCE_UID'] = ''; - $started['AUTH_SOURCE_SHOW'] = G::LoadTranslation( 'ID_ALL' ); + $started['AUTH_SOURCE_SHOW'] = G::LoadTranslation('ID_ALL'); $arr[] = $started; } } - $started = Array (); + $started = Array(); $started['AUTH_SOURCE_UID'] = '00000000000000000000000000000000'; //$started['AUTH_SOURCE_NAME'] = 'ProcessMaker'; //$started['AUTH_SOURCE_TYPE'] = 'MYSQL'; @@ -284,39 +285,39 @@ try { $arr[] = $started; while ($objects->next()) { $row = $objects->getRow(); - $aux = Array (); + $aux = Array(); $aux['AUTH_SOURCE_UID'] = $row['AUTH_SOURCE_UID']; //$aux['AUTH_SOURCE_NAME'] = $row['AUTH_SOURCE_NAME']; //$aux['AUTH_SOURCE_TYPE'] = $row['AUTH_SOURCE_TYPE']; $aux['AUTH_SOURCE_SHOW'] = $row['AUTH_SOURCE_NAME'] . ' (' . $row['AUTH_SOURCE_PROVIDER'] . ')'; $arr[] = $aux; } - echo '{sources: ' . G::json_encode( $arr ) . '}'; + echo '{sources: ' . G::json_encode($arr) . '}'; break; case 'loadAuthSourceByUID': require_once 'classes/model/Users.php'; - $oCriteria = $RBAC->load( $_POST['uUID'] ); + $oCriteria = $RBAC->load($_POST['uUID']); $UID_AUTH = $oCriteria['UID_AUTH_SOURCE']; if (($UID_AUTH != '00000000000000000000000000000000') && ($UID_AUTH != '')) { - $aux = $RBAC->getAuthSource( $UID_AUTH ); - $arr = Array (); + $aux = $RBAC->getAuthSource($UID_AUTH); + $arr = Array(); $arr['AUTH_SOURCE_NAME'] = $aux['AUTH_SOURCE_NAME'] . ' (' . $aux['AUTH_SOURCE_PROVIDER'] . ')'; $arr['AUTH_SOURCE_PROVIDER'] = $aux['AUTH_SOURCE_PROVIDER']; $aFields = $arr; } else { - $arr = Array (); + $arr = Array(); $arr['AUTH_SOURCE_NAME'] = 'ProcessMaker (MYSQL)'; $arr['AUTH_SOURCE_PROVIDER'] = 'MYSQL'; $aFields = $arr; } - $res = Array (); + $res = Array(); $res['data'] = $oCriteria; $res['auth'] = $aFields; - echo G::json_encode( $res ); + echo G::json_encode($res); break; case 'updateAuthServices': - $aData = $RBAC->load( $_POST['usr_uid'] ); - unset( $aData['USR_ROLE'] ); + $aData = $RBAC->load($_POST['usr_uid']); + unset($aData['USR_ROLE']); $auth_uid = $_POST['auth_source']; $auth_uid2 = $_POST['auth_source_uid']; if ($auth_uid == $auth_uid2) { @@ -326,17 +327,17 @@ try { $aData['USR_AUTH_TYPE'] = 'MYSQL'; $aData['UID_AUTH_SOURCE'] = ''; } else { - $aFields = $RBAC->getAuthSource( $auth_uid ); + $aFields = $RBAC->getAuthSource($auth_uid); $aData['USR_AUTH_TYPE'] = $aFields['AUTH_SOURCE_PROVIDER']; $aData['UID_AUTH_SOURCE'] = $auth_uid; } - if (isset( $_POST['auth_dn'] )) { + if (isset($_POST['auth_dn'])) { $auth_dn = $_POST['auth_dn']; } else { $auth_dn = ""; } $aData['USR_AUTH_USER_DN'] = $auth_dn; - $RBAC->updateUser( $aData ); + $RBAC->updateUser($aData); echo '{success: true}'; break; case 'usersList': @@ -345,58 +346,58 @@ try { require_once 'classes/model/Department.php'; require_once 'classes/model/AppCacheView.php'; global $RBAC; - G::LoadClass( 'configuration' ); + G::LoadClass('configuration'); $co = new Configurations(); - $config = $co->getConfiguration( 'usersList', 'pageSize', '', $_SESSION['USER_LOGGED'] ); - $limit_size = isset( $config['pageSize'] ) ? $config['pageSize'] : 20; - $start = isset( $_REQUEST['start'] ) ? $_REQUEST['start'] : 0; - $limit = isset( $_REQUEST['limit'] ) ? $_REQUEST['limit'] : $limit_size; - $filter = isset( $_REQUEST['textFilter'] ) ? $_REQUEST['textFilter'] : ''; - $auths = isset( $_REQUEST['auths'] ) ? $_REQUEST['auths'] : ''; - $sort = isset( $_REQUEST['sort'] ) ? $_REQUEST['sort'] : ''; - $dir = isset( $_REQUEST['dir'] ) ? $_REQUEST['dir'] : 'ASC'; - $aUsers = Array (); + $config = $co->getConfiguration('usersList', 'pageSize', '', $_SESSION['USER_LOGGED']); + $limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20; + $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0; + $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size; + $filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : ''; + $auths = isset($_REQUEST['auths']) ? $_REQUEST['auths'] : ''; + $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : ''; + $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : 'ASC'; + $aUsers = Array(); if ($auths != '') { - $aUsers = $RBAC->getListUsersByAuthSource( $auths ); + $aUsers = $RBAC->getListUsersByAuthSource($auths); } - $oCriteria = new Criteria( 'workflow' ); - $oCriteria->addSelectColumn( 'COUNT(*) AS CNT' ); + $oCriteria = new Criteria('workflow'); + $oCriteria->addSelectColumn('COUNT(*) AS CNT'); if ($filter != '') { - $cc = $oCriteria->getNewCriterion( UsersPeer::USR_USERNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_LASTNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_EMAIL, '%' . $filter . '%', Criteria::LIKE ) ) ) ); - $oCriteria->add( $cc ); + $cc = $oCriteria->getNewCriterion(UsersPeer::USR_USERNAME, '%' . $filter . '%', Criteria::LIKE)->addOr($oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', Criteria::LIKE)->addOr($oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME, '%' . $filter . '%', Criteria::LIKE)->addOr($oCriteria->getNewCriterion(UsersPeer::USR_EMAIL, '%' . $filter . '%', Criteria::LIKE)))); + $oCriteria->add($cc); } - $oCriteria->add( UsersPeer::USR_STATUS, array ('CLOSED' - ), Criteria::NOT_IN ); + $oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED' + ), Criteria::NOT_IN); if ($auths != '') { - $totalRows = sizeof( $aUsers ); + $totalRows = sizeof($aUsers); } else { - $oDataset = UsersPeer::DoSelectRs( $oCriteria ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset = UsersPeer::DoSelectRs($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $row = $oDataset->getRow(); $totalRows = $row['CNT']; } $oCriteria->clearSelectColumns(); - $oCriteria->addSelectColumn( UsersPeer::USR_UID ); - $oCriteria->addSelectColumn( UsersPeer::USR_USERNAME ); - $oCriteria->addSelectColumn( UsersPeer::USR_FIRSTNAME ); - $oCriteria->addSelectColumn( UsersPeer::USR_LASTNAME ); - $oCriteria->addSelectColumn( UsersPeer::USR_EMAIL ); - $oCriteria->addSelectColumn( UsersPeer::USR_ROLE ); - $oCriteria->addSelectColumn( UsersPeer::USR_DUE_DATE ); - $oCriteria->addSelectColumn( UsersPeer::USR_STATUS ); - $oCriteria->addSelectColumn( UsersPeer::USR_UX ); - $oCriteria->addSelectColumn( UsersPeer::DEP_UID ); - $oCriteria->addAsColumn( 'LAST_LOGIN', 0 ); - $oCriteria->addAsColumn( 'DEP_TITLE', 0 ); - $oCriteria->addAsColumn( 'TOTAL_CASES', 0 ); - $oCriteria->addAsColumn( 'DUE_DATE_OK', 1 ); + $oCriteria->addSelectColumn(UsersPeer::USR_UID); + $oCriteria->addSelectColumn(UsersPeer::USR_USERNAME); + $oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); + $oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME); + $oCriteria->addSelectColumn(UsersPeer::USR_EMAIL); + $oCriteria->addSelectColumn(UsersPeer::USR_ROLE); + $oCriteria->addSelectColumn(UsersPeer::USR_DUE_DATE); + $oCriteria->addSelectColumn(UsersPeer::USR_STATUS); + $oCriteria->addSelectColumn(UsersPeer::USR_UX); + $oCriteria->addSelectColumn(UsersPeer::DEP_UID); + $oCriteria->addAsColumn('LAST_LOGIN', 0); + $oCriteria->addAsColumn('DEP_TITLE', 0); + $oCriteria->addAsColumn('TOTAL_CASES', 0); + $oCriteria->addAsColumn('DUE_DATE_OK', 1); $sep = "'"; - $oCriteria->add( UsersPeer::USR_STATUS, array ('CLOSED' - ), Criteria::NOT_IN ); + $oCriteria->add(UsersPeer::USR_STATUS, array('CLOSED' + ), Criteria::NOT_IN); if ($filter != '') { - $cc = $oCriteria->getNewCriterion( UsersPeer::USR_USERNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_LASTNAME, '%' . $filter . '%', Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_EMAIL, '%' . $filter . '%', Criteria::LIKE ) ) ) ); - $oCriteria->add( $cc ); + $cc = $oCriteria->getNewCriterion(UsersPeer::USR_USERNAME, '%' . $filter . '%', Criteria::LIKE)->addOr($oCriteria->getNewCriterion(UsersPeer::USR_FIRSTNAME, '%' . $filter . '%', Criteria::LIKE)->addOr($oCriteria->getNewCriterion(UsersPeer::USR_LASTNAME, '%' . $filter . '%', Criteria::LIKE)->addOr($oCriteria->getNewCriterion(UsersPeer::USR_EMAIL, '%' . $filter . '%', Criteria::LIKE)))); + $oCriteria->add($cc); } // $sw_add = false; // for ($i=0; $i < sizeof($aUsers); $i++){ @@ -409,22 +410,22 @@ try { // } // } // if ($sw_add) $oCriteria->add($uList); - if (sizeof( $aUsers ) > 0) { - $oCriteria->add( UsersPeer::USR_UID, $aUsers, Criteria::IN ); - } else if ($totalRows == 0 && $auths != '') { - $oCriteria->add( UsersPeer::USR_UID, '', Criteria::IN ); + if (sizeof($aUsers) > 0) { + $oCriteria->add(UsersPeer::USR_UID, $aUsers, Criteria::IN); + } elseif ($totalRows == 0 && $auths != '') { + $oCriteria->add(UsersPeer::USR_UID, '', Criteria::IN); } if ($sort != '') { if ($dir == 'ASC') { - $oCriteria->addAscendingOrderByColumn( $sort ); + $oCriteria->addAscendingOrderByColumn($sort); } else { - $oCriteria->addDescendingOrderByColumn( $sort ); + $oCriteria->addDescendingOrderByColumn($sort); } } - $oCriteria->setOffset( $start ); - $oCriteria->setLimit( $limit ); - $oDataset = UsersPeer::DoSelectRs( $oCriteria ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oCriteria->setOffset($start); + $oCriteria->setLimit($limit); + $oDataset = UsersPeer::DoSelectRs($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $Login = new LoginLog(); $aLogin = $Login->getLastLoginAllUsers(); @@ -437,41 +438,41 @@ try { require_once PATH_CONTROLLERS . 'adminProxy.php'; $uxList = adminProxy::getUxTypesList(); - $rows = Array (); + $rows = Array(); while ($oDataset->next()) { $row = $oDataset->getRow(); - $row['DUE_DATE_OK'] = (date( 'Y-m-d' ) > date( 'Y-m-d', strtotime( $row['USR_DUE_DATE'] ) )) ? 0 : 1; - $row['LAST_LOGIN'] = isset( $aLogin[$row['USR_UID']] ) ? $aLogin[$row['USR_UID']] : ''; - $row['TOTAL_CASES'] = isset( $aCases[$row['USR_UID']] ) ? $aCases[$row['USR_UID']] : 0; - $row['DEP_TITLE'] = isset( $aDepart[$row['USR_UID']] ) ? $aDepart[$row['USR_UID']] : ''; - $row['USR_UX'] = isset( $uxList[$row['USR_UX']] ) ? $uxList[$row['USR_UX']] : $uxList['NORMAL']; - $row['USR_AUTH_SOURCE'] = isset( $aAuthSources[$row['USR_UID']] ) ? $aAuthSources[$row['USR_UID']] : 'ProcessMaker (MYSQL)'; + $row['DUE_DATE_OK'] = (date('Y-m-d') > date('Y-m-d', strtotime($row['USR_DUE_DATE']))) ? 0 : 1; + $row['LAST_LOGIN'] = isset($aLogin[$row['USR_UID']]) ? $aLogin[$row['USR_UID']] : ''; + $row['TOTAL_CASES'] = isset($aCases[$row['USR_UID']]) ? $aCases[$row['USR_UID']] : 0; + $row['DEP_TITLE'] = isset($aDepart[$row['USR_UID']]) ? $aDepart[$row['USR_UID']] : ''; + $row['USR_UX'] = isset($uxList[$row['USR_UX']]) ? $uxList[$row['USR_UX']] : $uxList['NORMAL']; + $row['USR_AUTH_SOURCE'] = isset($aAuthSources[$row['USR_UID']]) ? $aAuthSources[$row['USR_UID']] : 'ProcessMaker (MYSQL)'; $rows[] = $row; } - echo '{users: ' . G::json_encode( $rows ) . ', total_users: ' . $totalRows . '}'; + echo '{users: ' . G::json_encode($rows) . ', total_users: ' . $totalRows . '}'; break; case 'updatePageSize': - G::LoadClass( 'configuration' ); + G::LoadClass('configuration'); $c = new Configurations(); $arr['pageSize'] = $_REQUEST['size']; - $arr['dateSave'] = date( 'Y-m-d H:i:s' ); - $config = Array (); + $arr['dateSave'] = date('Y-m-d H:i:s'); + $config = Array(); $config[] = $arr; $c->aConfig = $config; - $c->saveConfig( 'usersList', 'pageSize', '', $_SESSION['USER_LOGGED'] ); + $c->saveConfig('usersList', 'pageSize', '', $_SESSION['USER_LOGGED']); echo '{success: true}'; break; case 'summaryUserData': require_once 'classes/model/Users.php'; require_once 'classes/model/Department.php'; require_once 'classes/model/AppCacheView.php'; - G::LoadClass( 'configuration' ); + G::LoadClass('configuration'); $oUser = new Users(); - $data = $oUser->loadDetailed( $_REQUEST['USR_UID'] ); - $data['USR_STATUS'] = G::LoadTranslation( 'ID_' . $data['USR_STATUS'] ); + $data = $oUser->loadDetailed($_REQUEST['USR_UID']); + $data['USR_STATUS'] = G::LoadTranslation('ID_' . $data['USR_STATUS']); $oAppCache = new AppCacheView(); - $aTypes = Array (); + $aTypes = Array(); $aTypes['to_do'] = 'CASES_INBOX'; $aTypes['draft'] = 'CASES_DRAFT'; $aTypes['cancelled'] = 'CASES_CANCELLED'; @@ -479,29 +480,29 @@ try { $aTypes['paused'] = 'CASES_PAUSED'; $aTypes['completed'] = 'CASES_COMPLETED'; $aTypes['selfservice'] = 'CASES_SELFSERVICE'; - $aCount = $oAppCache->getAllCounters( array_keys( $aTypes ), $_REQUEST['USR_UID'] ); + $aCount = $oAppCache->getAllCounters(array_keys($aTypes), $_REQUEST['USR_UID']); $dep = new Department(); - if ($dep->existsDepartment( $data['DEP_UID'] )) { - $dep->Load( $data['DEP_UID'] ); + if ($dep->existsDepartment($data['DEP_UID'])) { + $dep->Load($data['DEP_UID']); $dep_name = $dep->getDepTitle(); } else { $dep_name = ''; } if ($data['USR_REPLACED_BY'] != '') { $user = new Users(); - $u = $user->load( $data['USR_REPLACED_BY'] ); + $u = $user->load($data['USR_REPLACED_BY']); $c = new Configurations(); - $replaced_by = $c->usersNameFormat( $u['USR_USERNAME'], $u['USR_FIRSTNAME'], $u['USR_LASTNAME'] ); + $replaced_by = $c->usersNameFormat($u['USR_USERNAME'], $u['USR_FIRSTNAME'], $u['USR_LASTNAME']); } else { $replaced_by = ''; } - $misc = Array (); + $misc = Array(); $misc['DEP_TITLE'] = $dep_name; $misc['REPLACED_NAME'] = $replaced_by; - echo '{success: true, userdata: ' . G::json_encode( $data ) . ', cases: ' . G::json_encode( $aCount ) . ', misc: ' . G::json_encode( $misc ) . '}'; + echo '{success: true, userdata: ' . G::json_encode($data) . ', cases: ' . G::json_encode($aCount) . ', misc: ' . G::json_encode($misc) . '}'; break; } } catch (Exception $oException) { - die( $oException->getMessage() ); + die($oException->getMessage()); }