Beispiel #1
0
if ($actionAjax == "processListExtJs") {
    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
    $categoryUid = isset($_REQUEST['CATEGORY_UID']) ? $_REQUEST['CATEGORY_UID'] : null;
    $userUid = isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '' ? $_SESSION['USER_LOGGED'] : null;
    global $oAppCache;
    $oAppCache = new AppCacheView();
    $processes = array();
    $processes[] = array('', G::LoadTranslation('ID_ALL_PROCESS'));
    //get the list based in the action provided
    switch ($action) {
        case 'draft':
            $cProcess = $oAppCache->getDraftListCriteria($userUid);
            //fast enough
            break;
        case 'sent':
            $cProcess = $oAppCache->getSentListProcessCriteria($userUid);
            // fast enough
            break;
        case 'simple_search':
        case 'search':
            //in search action, the query to obtain all process is too slow, so we need to query directly to
            //process and content tables, and for that reason we need the current language in AppCacheView.
            G::loadClass('configuration');
            $oConf = new Configurations();
            $oConf->loadConfig($x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '');
            $appCacheViewEngine = $oConf->aConfig;
            $lang = isset($appCacheViewEngine['LANG']) ? $appCacheViewEngine['LANG'] : 'en';
            $cProcess = new Criteria('workflow');
            $cProcess->clearSelectColumns();
            $cProcess->addSelectColumn(ProcessPeer::PRO_UID);
            $cProcess->addSelectColumn(ContentPeer::CON_VALUE);
Beispiel #2
0
    /**
     * @param $action
     * @param $categoryUid
     * @param $userUid
     * @return array
     * @throws \PropelException
     */
    public function getProcessList ($action, $categoryUid, $userUid)
    {
        //$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : null;
        //$categoryUid = isset( $_REQUEST['CATEGORY_UID'] ) ? $_REQUEST['CATEGORY_UID'] : null;
        //$userUid = (isset( $_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null;

        // global $oAppCache;
        $oAppCache = new \AppCacheView();
        $processes = array ();
        $processes[] = array ('',G::LoadTranslation( 'ID_ALL_PROCESS' ));

        //get the list based in the action provided
        switch ($action) {
            case 'draft':
                $cProcess = $oAppCache->getDraftListCriteria( $userUid ); //fast enough
                break;
            case 'sent':
                $cProcess = $oAppCache->getSentListProcessCriteria( $userUid ); // fast enough
                break;
            case 'simple_search':
            case 'search':
                //in search action, the query to obtain all process is too slow, so we need to query directly to
                //process and content tables, and for that reason we need the current language in AppCacheView.
                G::loadClass( 'configuration' );
                $oConf = new \Configurations();
                $oConf->loadConfig( $x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '' );
                $appCacheViewEngine = $oConf->aConfig;
                $lang = isset( $appCacheViewEngine['LANG'] ) ? $appCacheViewEngine['LANG'] : 'en';

                $cProcess = new Criteria( 'workflow' );
                $cProcess->clearSelectColumns();
                $cProcess->addSelectColumn( \ProcessPeer::PRO_UID );
                $cProcess->addSelectColumn( \ContentPeer::CON_VALUE );
                if ($categoryUid) {
                    $cProcess->add( \ProcessPeer::PRO_CATEGORY, $categoryUid );
                }
                $del = DBAdapter::getStringDelimiter();
                $conds = array ();
                $conds[] = array (ProcessPeer::PRO_UID,ContentPeer::CON_ID);
                $conds[] = array (ContentPeer::CON_CATEGORY,$del . 'PRO_TITLE' . $del);
                $conds[] = array (ContentPeer::CON_LANG,$del . $lang . $del);
                $cProcess->addJoinMC( $conds, Criteria::LEFT_JOIN );
                $cProcess->add( ProcessPeer::PRO_STATUS, 'ACTIVE' );
                $cProcess->addAscendingOrderByColumn(ContentPeer::CON_VALUE);

                $oDataset = ProcessPeer::doSelectRS( $cProcess );
                $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
                $oDataset->next();

                while ($aRow = $oDataset->getRow()) {
                    $processes[] = array ($aRow['PRO_UID'],$aRow['CON_VALUE']
                    );
                    $oDataset->next();
                }
                return print G::json_encode( $processes );
                break;
            case 'unassigned':
                $cProcess = $oAppCache->getUnassignedListCriteria( $userUid );
                break;
            case 'paused':
                $cProcess = $oAppCache->getPausedListCriteria( $userUid );
                break;
            case 'to_revise':
                $cProcess = $oAppCache->getToReviseListCriteria( $userUid );
                break;
            case 'to_reassign':
                $cProcess = $oAppCache->getToReassignListCriteria($userUid);
                break;
            case 'gral':
                $cProcess = $oAppCache->getGeneralListCriteria();
                break;
            case 'todo':
            default:
                $cProcess = $oAppCache->getToDoListCriteria( $userUid ); //fast enough
                break;
        }
        //get the processes for this user in this action
        $cProcess->clearSelectColumns();
        $cProcess->addSelectColumn( \AppCacheViewPeer::PRO_UID );
        $cProcess->addSelectColumn( \AppCacheViewPeer::APP_PRO_TITLE );
        $cProcess->setDistinct( \AppCacheViewPeer::PRO_UID );
        if ($categoryUid) {
            require_once 'classes/model/Process.php';
            $cProcess->addAlias( 'CP', 'PROCESS' );
            $cProcess->add( 'CP.PRO_CATEGORY', $categoryUid, Criteria::EQUAL );
            $cProcess->addJoin( \AppCacheViewPeer::PRO_UID, 'CP.PRO_UID', Criteria::LEFT_JOIN );
            $cProcess->addAsColumn( 'CATEGORY_UID', 'CP.PRO_CATEGORY' );
        }

        $cProcess->addAscendingOrderByColumn(\AppCacheViewPeer::APP_PRO_TITLE);

        $oDataset = \AppCacheViewPeer::doSelectRS( $cProcess, \Propel::getDbConnection('workflow_ro') );
        $oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
        $oDataset->next();

        while ($aRow = $oDataset->getRow()) {
            $processes[] = array ($aRow['PRO_UID'],$aRow['APP_PRO_TITLE']
            );
            $oDataset->next();
        }
        return $processes;
    }