Exemple #1
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();
 }
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;
}
 */
require_once 'classes/model/Process.php';
$start = isset($_POST['start']) ? $_POST['start'] : 0;
$limit = isset($_POST['limit']) ? $_POST['limit'] : '';
$dir = isset($_POST['dir']) ? $_POST['dir'] : 'ASC';
$sort = isset($_POST['sort']) ? $_POST['sort'] : '';
$oProcess = new Process();
$oProcess->dir = $dir;
$oProcess->sort = $sort;
//$memcache = & PMmemcached::getSingleton( SYS_SYS );
$memkey = 'no memcache';
$memcacheUsed = 'not used';
$totalCount = 0;
if (isset($_POST['category']) && $_POST['category'] !== '<reset>') {
    if (isset($_POST['processName'])) {
        $proData = $oProcess->getAllProcesses($start, $limit, $_POST['category'], $_POST['processName']);
    } else {
        $proData = $oProcess->getAllProcesses($start, $limit, $_POST['category']);
    }
} else {
    if (isset($_POST['processName'])) {
        $memkey = 'processList-' . $start . '-' . $limit . '-' . $_POST['processName'];
        $memcacheUsed = 'yes';
        $proData = $memcache->get($memkey);
        if ($proData === false) {
            $proData = $oProcess->getAllProcesses($start, $limit, null, $_POST['processName']);
            $memcache->set($memkey, $proData, PMmemcached::ONE_HOUR);
            $totalCount = count($proData);
            $proData = array_splice($proData, $start, $limit);
            $memcacheUsed = 'no';
        } else {
 */
require_once 'classes/model/Process.php';
$start = isset($_POST['start']) ? $_POST['start'] : 0;
$limit = isset($_POST['limit']) ? $_POST['limit'] : '';
$dir = isset($_POST['dir']) ? $_POST['dir'] : 'ASC';
$sort = isset($_POST['sort']) ? $_POST['sort'] : '';
$oProcess = new Process();
$oProcess->dir = $dir;
$oProcess->sort = $sort;
//$memcache = & PMmemcached::getSingleton( SYS_SYS );
$memkey = 'no memcache';
$memcacheUsed = 'not used';
$totalCount = 0;
if (isset($_POST['category']) && $_POST['category'] !== '<reset>') {
    if (isset($_POST['processName'])) {
        $proData = $oProcess->getAllProcesses($start, $limit, $_POST['category'], $_POST['processName'], true, false, $_SESSION["USER_LOGGED"]);
    } else {
        $proData = $oProcess->getAllProcesses($start, $limit, $_POST['category'], null, true, false, $_SESSION["USER_LOGGED"]);
    }
} else {
    if (isset($_POST['processName'])) {
        $memkey = 'processList-' . $start . '-' . $limit . '-' . $_POST['processName'];
        $memcacheUsed = 'yes';
        $proData = $memcache->get($memkey);
        if ($proData === false) {
            $proData = $oProcess->getAllProcesses($start, $limit, null, $_POST['processName'], true, false, $_SESSION["USER_LOGGED"]);
            $memcache->set($memkey, $proData, PMmemcached::ONE_HOUR);
            $totalCount = count($proData);
            $proData = array_splice($proData, $start, $limit);
            $memcacheUsed = 'no';
        } else {