function getProcessList() { G::LoadClass('case'); G::LoadClass('process'); G::LoadClass('calendar'); $calendar = new Calendar(); $oProcess = new Process(); $oCase = new Cases(); //Get ProcessStatistics Info $start = 0; $limit = ''; $proData = $oProcess->getAllProcesses($start, $limit, null, null, false, true); $bCanStart = $oCase->canStartCase($_SESSION['USER_LOGGED']); if ($bCanStart) { $processListInitial = $oCase->getStartCasesPerType($_SESSION['USER_LOGGED'], 'category'); $processList = array(); foreach ($processListInitial as $key => $procInfo) { if (isset($procInfo['pro_uid'])) { if (trim($procInfo['cat']) == "") { $procInfo['cat'] = "_OTHER_"; } $processList[$procInfo['catname']][$procInfo['value']] = $procInfo; } } ksort($processList); foreach ($processList as $key => $processInfo) { ksort($processList[$key]); } if (!isset($_REQUEST['node'])) { $node = 'root'; } else { $node = $_REQUEST['node']; } foreach ($proData as $key => $proInfo) { $proData[$proInfo['PRO_UID']] = $proInfo; } $processListTree = array(); if (1) { foreach ($processList as $key => $processInfo) { $tempTree['text'] = $key; $tempTree['id'] = G::encryptOld($key); $tempTree['cls'] = 'folder'; $tempTree['draggable'] = true; $tempTree['optionType'] = "category"; //$tempTree['allowDrop']=false; $tempTree['singleClickExpand'] = true; if ($key != "No Category") { $tempTree['expanded'] = true; } else { //$tempTree ['expanded'] = false; $tempTree['expanded'] = true; } $tempTreeChildren = array(); foreach ($processList[$key] as $keyChild => $processInfoChild) { //print_r($processInfo); $tempTreeChild['text'] = htmlentities($keyChild, ENT_QUOTES, 'UTF-8'); //ellipsis ( $keyChild, 50 ); //$tempTree['text']=$key; $tempTreeChild['id'] = G::encryptOld($keyChild); $tempTreeChild['draggable'] = true; $tempTreeChild['leaf'] = true; $tempTreeChild['icon'] = '/images/icon.trigger.png'; $tempTreeChild['allowChildren'] = false; $tempTreeChild['optionType'] = "startProcess"; $tempTreeChild['pro_uid'] = $processInfoChild['pro_uid']; $tempTreeChild['tas_uid'] = $processInfoChild['uid']; $processInfoChild['myInbox'] = 0; $processInfoChild['totalInbox'] = 0; if (isset($proData[$processInfoChild['pro_uid']])) { $tempTreeChild['otherAttributes'] = array_merge($processInfoChild, $proData[$processInfoChild['pro_uid']], $calendar->getCalendarFor($_SESSION['USER_LOGGED'], $processInfoChild['pro_uid'], $processInfoChild['uid'])); $tempTreeChild['otherAttributes']['PRO_TAS_TITLE'] = str_replace(")", "", str_replace("(", "", trim(str_replace($tempTreeChild['otherAttributes']['PRO_TITLE'], "", $tempTreeChild['otherAttributes']["value"])))); $tempTreeChild['qtip'] = $tempTreeChild['otherAttributes']['PRO_DESCRIPTION']; //$tempTree['cls']='file'; $tempTreeChildren[] = $tempTreeChild; } } $tempTree['children'] = $tempTreeChildren; $processListTree[] = $tempTree; } } else { foreach ($processList[$node] as $key => $processInfo) { //print_r($processInfo); $tempTree['text'] = $key; //ellipsis ( $key, 50 ); //$tempTree['text']=$key; $tempTree['id'] = $key; $tempTree['draggable'] = true; $tempTree['leaf'] = true; $tempTree['icon'] = '/images/icon.trigger.png'; $tempTree['allowChildren'] = false; $tempTree['optionType'] = "startProcess"; $tempTree['pro_uid'] = $processInfo['pro_uid']; $tempTree['tas_uid'] = $processInfo['uid']; $processInfo['myInbox'] = 0; $processInfo['totalInbox'] = 0; $tempTree['otherAttributes'] = array_merge($processInfo, $proData[$processInfo['pro_uid']], $calendar->getCalendarFor($processInfo['uid'], $processInfo['uid'], $processInfo['uid'])); $tempTree['otherAttributes']['PRO_TAS_TITLE'] = str_replace(")", "", str_replace("(", "", trim(str_replace($tempTree['otherAttributes']['PRO_TITLE'], "", $tempTree['otherAttributes']["value"])))); $tempTree['qtip'] = $tempTree['otherAttributes']['PRO_DESCRIPTION']; //$tempTree['cls']='file'; $processListTree[] = $tempTree; } } $processList = $processListTree; } else { $processList['success'] = 'failure'; $processList['message'] = G::LoadTranslation('ID_USER_PROCESS_NOT_START'); } print G::json_encode($processList); die; }
public function editProcessNew($sProcessUID) { try { $oProcess = new Process(); if (!is_null($oProcess)) { $calendar = new Calendar(); $calendarObj = $calendar->getCalendarList(true, true); global $_DBArray; $_DBArray['availableCalendars'] = $calendarObj['array']; $_SESSION['_DBArray'] = $_DBArray; $aFields = $oProcess->load($sProcessUID); $aFields['THETYPE'] = 'UPDATE'; $calendarInfo = $calendar->getCalendarFor($sProcessUID, $sProcessUID, $sProcessUID); //If the public function returns a DEFAULT calendar it means that this object doesn't have assigned any calendar $aFields['PRO_CALENDAR'] = $calendarInfo['CALENDAR_APPLIED'] != 'DEFAULT' ? $calendarInfo['CALENDAR_UID'] : ""; return $aFields; } else { throw new Exception('This row doesn\'t exist!'); } } catch (Exception $oError) { throw $oError; } }
print G::json_encode($result); } catch (Exception $e) { $result->success = false; $result->error = $e->getMessage(); 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']); //Load Calendar options and falue for this user G::LoadClass('calendar'); $calendar = new Calendar(); $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'); $oConf = new Configurations(); $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 $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'] : ''; } else { switch ($RBAC->aUserInfo['PROCESSMAKER']['ROLE']['ROL_CODE']) {
public function getAllInformation($userUid) { if (!isset($userUid) || $userUid == "") { throw new Exception("{$userUid} is empty."); } try { require_once "classes/model/IsoCountry.php"; require_once "classes/model/IsoLocation.php"; require_once "classes/model/IsoSubdivision.php"; require_once "classes/model/Language.php"; G::LoadClass("calendar"); $aFields = $this->load($userUid); $c = new Criteria("workflow"); $c->add(IsoCountryPeer::IC_UID, $aFields["USR_COUNTRY"]); $rs = IsoCountryPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $rowC = $rs->getRow(); $c->clearSelectColumns(); $c->add(IsoSubdivisionPeer::IC_UID, $aFields["USR_COUNTRY"]); $c->add(IsoSubdivisionPeer::IS_UID, $aFields["USR_CITY"]); $rs = IsoSubdivisionPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $rowS = $rs->getRow(); $c->clearSelectColumns(); $c->add(IsoLocationPeer::IC_UID, $aFields["USR_COUNTRY"]); $c->add(IsoLocationPeer::IL_UID, $aFields["USR_LOCATION"]); $rs = IsoLocationPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $rowL = $rs->getRow(); //Calendar $calendar = new Calendar(); $calendarInfo = $calendar->getCalendarFor($userUid, $userUid, $userUid); $aFields["USR_CALENDAR"] = $calendarInfo["CALENDAR_APPLIED"] != "DEFAULT" ? $calendarInfo["CALENDAR_UID"] : ""; //Photo $pathPhoto = PATH_IMAGES_ENVIRONMENT_USERS . $userUid . ".gif"; if (!file_exists($pathPhoto)) { $pathPhoto = PATH_HOME . "public_html" . PATH_SEP . "images" . PATH_SEP . "user.gif"; } //Data $arrayData = array(); $arrayData["username"] = $aFields["USR_USERNAME"]; $arrayData["firstname"] = $aFields["USR_FIRSTNAME"]; $arrayData["lastname"] = $aFields["USR_LASTNAME"]; $arrayData["mail"] = $aFields["USR_EMAIL"]; $arrayData["address"] = $aFields["USR_ADDRESS"]; $arrayData["zipcode"] = $aFields["USR_ZIP_CODE"]; $arrayData["country"] = $rowC["IC_NAME"]; $arrayData["state"] = $rowS["IS_NAME"]; $arrayData["location"] = $rowL["IL_NAME"]; $arrayData["phone"] = $aFields["USR_PHONE"]; $arrayData["fax"] = $aFields["USR_FAX"]; $arrayData["cellular"] = $aFields["USR_CELLULAR"]; $arrayData["birthday"] = $aFields["USR_BIRTHDAY"]; $arrayData["position"] = $aFields["USR_POSITION"]; $arrayData["replacedby"] = $aFields["USR_REPLACED_BY"]; $arrayData["duedate"] = $aFields["USR_DUE_DATE"]; $arrayData["calendar"] = $aFields["USR_CALENDAR"]; $arrayData["status"] = $aFields["USR_STATUS"]; $arrayData["department"] = $aFields["DEP_UID"]; $arrayData["reportsto"] = $aFields["USR_REPORTS_TO"]; $arrayData["userexperience"] = $aFields["USR_UX"]; $arrayData["photo"] = $pathPhoto; return $arrayData; } catch (Exception $e) { throw $e; } }