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;
}
$sWS_PASS = trim($_REQUEST['PASSWORD']);
if (G::is_https()) {
    $http = 'https://';
} else {
    $http = 'http://';
}
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2';
@($client = new SoapClient($endpoint));
$user = $sWS_USER;
$pass = $sWS_PASS;
$params = array('userid' => $user, 'password' => $pass);
$result = $client->__SoapCall('login', array($params));
if ($result->status_code == 0) {
    if (!class_exists('Users')) {
        require "classes/model/UsersPeer.php";
    }
    $oCriteria = new Criteria('workflow');
    $oCriteria->addSelectColumn('USR_UID');
    $oCriteria->add(UsersPeer::USR_USERNAME, $sWS_USER);
    $resultSet = UsersPeer::doSelectRS($oCriteria);
    $resultSet->next();
    $user_id = $resultSet->getRow();
    $result->message = $user_id[0];
    G::LoadClass('case');
    $caseInstance = new Cases();
    if (!$caseInstance->canStartCase($result->message, $_REQUEST['PRO_UID'])) {
        $result->status_code = -1000;
        $result->message = G::LoadTranslation('ID_USER_CASES_NOT_START');
    }
}
die(G::json_encode($result));
Beispiel #3
0
 /**
  * getting default list
  *
  * @param string $httpData (opional)
  */
 public function index($httpData)
 {
     if ($this->userUxType == 'SINGLE') {
         $this->indexSingle($httpData);
         return;
     }
     require_once 'classes/model/UsersProperties.php';
     G::LoadClass('process');
     G::LoadClass('case');
     $userProperty = new UsersProperties();
     $process = new Process();
     $case = new Cases();
     G::loadClass('system');
     $sysConf = System::getSystemConfiguration(PATH_CONFIG . 'env.ini');
     //Get ProcessStatistics Info
     $start = 0;
     $limit = '';
     $proData = $process->getAllProcesses($start, $limit);
     $processList = $case->getStartCasesPerType($_SESSION['USER_LOGGED'], 'category');
     $switchLink = $userProperty->getUserLocation($_SESSION['USER_LOGGED']);
     if (!isset($_COOKIE['workspaceSkin'])) {
         if (substr($sysConf['default_skin'], 0, 2) == 'ux') {
             $_SESSION['_defaultUserLocation'] = $switchLink;
             $switchLink = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . $sysConf['default_skin'] . '/main';
         }
     }
     unset($processList[0]);
     //Get simplified options
     global $G_TMP_MENU;
     $mnu = new Menu();
     $mnu->load('simplified');
     $arrayMnuOption = array();
     $mnuNewCase = array();
     if (!empty($mnu->Options)) {
         foreach ($mnu->Options as $index => $value) {
             $option = array('id' => $mnu->Id[$index], 'url' => $mnu->Options[$index], 'label' => $mnu->Labels[$index], 'icon' => $mnu->Icons[$index], 'class' => $mnu->ElementClass[$index]);
             if ($mnu->Id[$index] != 'S_NEW_CASE') {
                 $arrayMnuOption[] = $option;
             } else {
                 $mnuNewCase = $option;
             }
         }
     }
     $this->setView($this->userUxBaseTemplate . PATH_SEP . 'index');
     $this->setVar('usrUid', $this->userID);
     $this->setVar('userName', $this->userName);
     $this->setVar('processList', $processList);
     $this->setVar('canStartCase', $case->canStartCase($_SESSION['USER_LOGGED']));
     $this->setVar('userUxType', $this->userUxType);
     $this->setVar('clientBrowser', $this->clientBrowser['name']);
     $this->setVar('switchLink', $switchLink);
     $this->setVar('arrayMnuOption', $arrayMnuOption);
     $this->setVar('mnuNewCase', $mnuNewCase);
     $this->render();
 }
Beispiel #4
0
        G::header('location: ../login/login');
        die;
        break;
}
/* Includes */
G::LoadClass('case');
/* GET , POST & $_SESSION Vars */
/* Menues */
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'cases';
$G_ID_MENU_SELECTED = 'CASES';
$G_ID_SUB_MENU_SELECTED = 'CASES_DRAFT';
/* Prepare page before to show */
$aFields = array();
$oCase = new Cases();
$bCanStart = $oCase->canStartCase($_SESSION['USER_LOGGED']);
if ($bCanStart) {
    $aFields['LANG'] = SYS_LANG;
    $aFields['USER'] = $_SESSION['USER_LOGGED'];
    $sXmlForm = 'cases/cases_New.xml';
    //$_DBArray['NewCase'] = $oCase->getStartCases( $_SESSION['USER_LOGGED'] );
    $_DBArray['NewCase'] = $oCase->getStartCasesPerType($_SESSION['USER_LOGGED'], $_GET['change']);
} else {
    $sXmlForm = 'cases/cases_CannotInitiateCase.xml';
}
if (isset($_SESSION['G_MESSAGE']) && strlen($_SESSION['G_MESSAGE']) > 0) {
    $aMessage = array();
    $aMessage['MESSAGE'] = $_SESSION['G_MESSAGE'];
    //$_SESSION['G_MESSAGE_TYPE'];
    unset($_SESSION['G_MESSAGE']);
    unset($_SESSION['G_MESSAGE_TYPE']);