Example #1
0
 /**
  * Get all users of the Task
  *
  * @param string $taskUid
  * @param int    $taskUserType
  * @param bool   $keyCaseToLower
  *
  * return array
  *
  * @access public
  */
 public function getUsers($taskUid, $taskUserType, $keyCaseToLower = false)
 {
     try {
         //G::LoadClass("BasePeer");
         require_once PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.BasePeer.php";
         $arrayData = array();
         $keyCase = $keyCaseToLower ? CASE_LOWER : CASE_UPPER;
         //Criteria
         $processMap = new \ProcessMap();
         $criteria = $processMap->getTaskUsersCriteria($taskUid, $taskUserType);
         if ($criteria->getDbName() == "dbarray") {
             $rsCriteria = \ArrayBasePeer::doSelectRS($criteria);
         } else {
             $rsCriteria = \GulliverBasePeer::doSelectRS($criteria);
         }
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $arrayData[] = array_change_key_case($row, $keyCase);
         }
         return $arrayData;
     } catch (\Exception $e) {
         throw $e;
     }
 }
Example #2
0
     $r->totalCount = $totalCount;
     echo Bootstrap::json_encode($r);
     break;
 case 'generateDocumentGrid_Ajax':
     G::LoadClass('case');
     G::LoadClass("BasePeer");
     G::LoadClass('configuration');
     global $G_PUBLISH;
     $oCase = new Cases();
     $aProcesses = array();
     $G_PUBLISH = new Publisher();
     $c = $oCase->getAllGeneratedDocumentsCriteria($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['TASK'], $_SESSION['USER_LOGGED']);
     if ($c->getDbName() == 'dbarray') {
         $rs = ArrayBasePeer::doSelectRs($c);
     } else {
         $rs = GulliverBasePeer::doSelectRs($c);
     }
     $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $rs->next();
     $totalCount = 0;
     for ($j = 0; $j < $rs->getRecordCount(); $j++) {
         $result = $rs->getRow();
         $result["FILEDOCEXIST"] = $result["FILEDOC"];
         $result["FILEPDFEXIST"] = $result["FILEPDF"];
         $result["DELETE_FILE"] = isset($result['ID_DELETE']) && $result['ID_DELETE'] == 'Delete' ? true : false;
         $aProcesses[] = $result;
         $rs->next();
         $totalCount++;
     }
     //!dateFormat
     $conf = new Configurations();
Example #3
0
 /**
  * Method to do selects.
  *
  * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
  * @param      Connection $con
  * @return     array Array of selected Objects
  * @throws     PropelException Any exceptions caught during processing will be
  *     rethrown wrapped into a PropelException.
  */
 public static function doSelect(Criteria $criteria, $con = null)
 {
     return ApplicationPeer::populateObjects(GulliverBasePeer::doSelectRS($criteria, $con));
 }
Example #4
0
    /**

     * get all roles, to see all roles

     *

     * @param none

     * @return $result will return an object

     */

    public function roleList ()

    {

        try {

            $result = array ();



            $RBAC = & RBAC::getSingleton();

            $RBAC->initRBAC();

            $oCriteria = $RBAC->listAllRoles();

            $oDataset = GulliverBasePeer::doSelectRs( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();



            while ($aRow = $oDataset->getRow()) {

                $result[] = array ('guid' => $aRow['ROL_UID'],'name' => $aRow['ROL_CODE']

                );

                $oDataset->next();

            }



            return $result;

        } catch (Exception $e) {

            $result[] = array ('guid' => $e->getMessage(),'name' => $e->getMessage()

            );



            return $result;

        }

    }
    /**
     * Function renderTable
     *
     * @author David S. Callizaya S. <*****@*****.**>
     * @param eter $block : = 'content'(Prints contentBlock only)
     * @access public
     * @return string
     */
    public function renderTable($block = '', $fields = '')
    {
        //Render Title
        $thereisnotitle = true;
        foreach ($this->fields as $r => $rval) {
            if ($this->fields[$r]['Type'] === 'title') {
                $this->title = $this->fields[$r]['Label'];
                unset($this->fields[$r]);
                $thereisnotitle = false;
            }
        }
        if ($thereisnotitle) {
            $this->title = '';
        }
        $oHeadPublisher =& headPublisher::getSingleton();
        $oHeadPublisher->addInstanceModule('leimnud', 'panel');
        $time_start = microtime(true);
        $this->prepareQuery(true);
        $time_end = microtime(true);
        $time = $time_end - $time_start;
        // verify if there are templates folders registered, template and method folders are the same
        $folderTemplate = explode('/', $this->template);
        $oPluginRegistry =& PMPluginRegistry::getSingleton();
        if ($oPluginRegistry->isRegisteredFolder($folderTemplate[0])) {
            $templateFile = PATH_PLUGINS . $this->template . '.html';
        } else {
            $templateFile = PATH_TPL . $this->template . '.html';
            // Prepare the template
        }
        $this->tpl = new TemplatePower($templateFile);
        $this->tpl->prepare();
        if (is_array($fields)) {
            foreach ($fields as $key => $val) {
                $this->tpl->assignGlobal($key, $val);
                //Changed to Global by JHL on Dec 14,2009.. then thes fields are available for all Blocks
            }
        }
        /**
         * ******** HEAD BLOCK **************
         */
        if ($block === '' || $block === 'head') {
            $this->tpl->newBlock('headBlock');
            $this->tpl->assign('pagedTable_Id', $this->id);
            $this->tpl->assign('pagedTable_Name', $this->name);
            $this->tpl->assign('pagedTable_Height', $this->xmlForm->height);
            $this->tpl->assign("title", $this->title);
            if (file_exists($this->xmlForm->home . $this->filterForm . '.xml')) {
                $filterForm = new filterForm($this->filterForm, $this->xmlForm->home);
                if ($this->menu === '') {
                    $this->menu = 'gulliver/pagedTable_Options';
                }
            }
            if (file_exists($this->xmlForm->home . $this->menu . '.xml')) {
                $menu = new xmlMenu($this->menu, $this->xmlForm->home);
                $this->tpl->newBlock('headerBlock');
                $template = PATH_CORE . 'templates' . PATH_SEP . $menu->type . '.html';
                $menu->setValues($this->xmlForm->values);
                $menu->setValues(array('PAGED_TABLE_ID' => $this->id));
                if (isset($filterForm->name)) {
                    $menu->setValues(array('SEARCH_FILTER_FORM' => $filterForm->name));
                }
                $this->tpl->assign('content', $menu->render($template, $scriptCode));
                $oHeadPublisher->addScriptFile($menu->scriptURL);
                $oHeadPublisher->addScriptCode($scriptCode);
            }
            if (file_exists($this->xmlForm->home . $this->filterForm . '.xml')) {
                $this->tpl->newBlock('headerBlock');
                $this->filterForm_Id = $filterForm->id;
                $filterForm->type = 'filterform';
                $filterForm->ajaxServer = '../gulliver/defaultAjax';
                $template = PATH_CORE . 'templates/' . $filterForm->type . '.html';
                $filterForm->setValues($this->xmlForm->values);
                $filterForm->setValues(array('PAGED_TABLE_ID' => $this->id));
                $filterForm->setValues(array('PAGED_TABLE_FAST_SEARCH' => $this->fastSearch));
                $this->tpl->assign('content', $filterForm->render($template, $scriptCode));
                $oHeadPublisher->addScriptFile($filterForm->scriptURL);
                $oHeadPublisher->addScriptCode($scriptCode);
                if (isset($_SESSION)) {
                    $_SESSION[$filterForm->id] = $filterForm->values;
                }
            }
        }
        /**
         * ******** CONTENT BLOCK **************
         */
        if ($block === '' || $block === 'content') {
            $this->tpl->newBlock('contentBlock');
            $this->tpl->assign('gridWidth', '=[' . substr($this->gridWidth, 1) . ']');
            $this->tpl->assign('fieldNames', '=[' . substr($this->gridFields, 1) . ']');
            $this->tpl->assign('ajaxUri', '="' . addslashes($this->ajaxServer) . '"');
            $this->tpl->assign('currentUri', '="' . addslashes($this->ownerPage) . '"');
            $this->tpl->assign('currentOrder', '="' . addslashes($this->orderBy) . '"');
            $this->tpl->assign('currentPage', '=' . $this->currentPage);
            $this->tpl->assign('currentFilter', '="' . '"');
            $this->tpl->assign('totalRows', '=' . $this->totRows);
            $this->tpl->assign('rowsPerPage', '=' . $this->rowsPerPage);
            $this->tpl->assign('popupPage', '="' . addslashes($this->popupPage) . '"');
            $this->tpl->assign('popupWidth', '=' . $this->popupWidth);
            $this->tpl->assign('popupHeight', '=' . $this->popupHeight);
            $this->tpl->assign('pagedTable_Id', $this->id);
            $this->tpl->assign('pagedTable_Name', $this->name);
            $this->tpl->assign("pagedTable_JS", "{$this->id}.element=document.getElementById('pagedtable[{$this->id}]');");
            $this->renderTitle();
            //Render rows
            if ($this->criteria->getDbName() == 'dbarray') {
                $rs = ArrayBasePeer::doSelectRs($this->criteria);
            } else {
                $rs = GulliverBasePeer::doSelectRs($this->criteria);
            }
            $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            /*
                         print "<div class='pagedTableDefault'><table  class='default'>";
                         $rs->next();
                         $row = $rs->getRow();
                         while ( is_array ( $row ) ) {
                         print "<tr  class='Row1'>";
                         foreach ( $row as $k=>$v ) print "<td>$v</td>";
                         print "</tr>";
                         $rs->next();
                         $row = $rs->getRow();
                         }
                         print "</table></div>";  die;*/
            $gridRows = 0;
            $rs->next();
            //Initialize the array of breakFields for Master Detail View
            foreach ($this->masterdetail as $keyMasterDetail => $fieldMasterDetail) {
                $breakField[$fieldMasterDetail] = "novaluehere";
            }
            $breakFieldKeys = array_flip($this->masterdetail);
            for ($j = 0; $j < $rs->getRecordCount(); $j++) {
                $result = $rs->getRow();
                $rs->next();
                $gridRows++;
                $this->tpl->newBlock("row");
                $this->tpl->assign("class", "Row" . ($j % 2 + 1));
                $this->tdStyle = '';
                $this->tdClass = '';
                //Start Master Detail: This enable the MasterDEtail view. By JHL November 2008
                if (count($this->masterdetail) > 0) {
                    //TODO: Validate if there is a Field that doesn't exist
                    //TODO: Style
                    //TODO: Improve Collapse function....
                    foreach ($this->masterdetail as $keyMasterDetail => $fieldMasterDetail) {
                        if ($breakField[$fieldMasterDetail] != $result[$fieldMasterDetail]) {
                            $this->tpl->newBlock("rowMaster");
                            $this->tpl->newBlock("fieldMaster");
                            $this->tpl->assign("alignAttr", " colspan=" . count($this->fields) * 2);
                            $this->tpl->assign("value", $this->fields[$fieldMasterDetail]['Label'] == "" ? "" : $this->fields[$fieldMasterDetail]['Label'] . ": " . $this->xmlForm->fields[$fieldMasterDetail]->renderTable($result[$fieldMasterDetail], $this->xmlForm, true));
                            $breakField[$fieldMasterDetail] = $result[$fieldMasterDetail];
                            for ($i = $breakFieldKeys[$fieldMasterDetail] + 1; $i < count($breakField); $i++) {
                                $breakField[$this->masterdetail[$i]] = "novaluehere";
                            }
                            $rowName = array();
                            foreach ($breakField as $key => $value) {
                                if ($value != "novaluehere") {
                                    $rowName[$key] = $key . "_" . $value;
                                }
                            }
                            $this->tpl->assign("masterRowName", implode(",", $rowName));
                            $this->tpl->assign('pagedTable_Name', $this->name);
                            $many = "";
                            $this->tpl->assign("value1", str_pad($many, count($rowName) - 1, "-"));
                            $this->tpl->gotoblock("rowMaster");
                            $this->tpl->assign("masterRowName", "_MD_" . implode(",", $rowName));
                            $this->tpl->assign("masterRowClass", $keyMasterDetail == 0 ? "masterDetailMain" : "masterDetailOther");
                        }
                    }
                    $this->tpl->gotoblock("row");
                    if (!isset($rowName)) {
                        $rowName = array();
                    }
                    $this->tpl->assign("rowName", implode(",", $rowName));
                }
                //End Master Detail: This enable the MasterDEtail view
                //Merge $result with $xmlForm values (for default valuesSettings)
                if (is_array($this->xmlForm->values)) {
                    $result = array_merge($this->xmlForm->values, $result);
                }
                foreach ($this->fields as $r => $rval) {
                    if (strcasecmp($this->fields[$r]['Type'], 'cellMark') == 0) {
                        $result1 = $result;
                        $result1['row__'] = $j + 1;
                        $result1 = array_merge($this->xmlForm->values, $result1);
                        $this->xmlForm->setDefaultValues();
                        $this->xmlForm->setValues($result1);
                        $this->tdStyle = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdStyle($result1, $this->xmlForm);
                        $this->tdClass = $this->xmlForm->fields[$this->fields[$r]['Name']]->tdClass($result1, $this->xmlForm);
                    } elseif ($this->style[$r]['showInTable'] != '0') {
                        if ($this->style[$r]['showInTable'] != '0' && !in_array($this->fields[$r]['Name'], $this->masterdetail)) {
                            $this->renderField($j + 1, $r, $result);
                        }
                    }
                }
            }
            $this->tpl->assign('_ROOT.gridRows', '=' . $gridRows);
            //number of rows in the current page
            $this->tpl->newBlock('rowTag');
            $this->tpl->assign('rowId', 'insertAtLast');
            if ($this->currentPage > 1) {
                $firstUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=1';
                $firstAjax = $this->id . ".doGoToPage(1);return false;";
                $prevpage = $this->currentPage - 1;
                $prevUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $prevpage;
                $prevAjax = $this->id . ".doGoToPage(" . $prevpage . ");return false;";
                $first = "<a href=\"" . htmlentities($firstUrl, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $firstAjax . "\" class='firstPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
                $prev = "<a href=\"" . htmlentities($prevUrl, ENT_QUOTES, 'utf-8') . "\"  onclick=\"" . $prevAjax . "\" class='previousPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
            } else {
                $first = "<a class='noFirstPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
                $prev = "<a class='noPreviousPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
            }
            if ($this->currentPage < $this->totPages) {
                $lastUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $this->totPages;
                $lastAjax = $this->id . ".doGoToPage(" . $this->totPages . ");return false;";
                $nextpage = $this->currentPage + 1;
                $nextUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $nextpage;
                $nextAjax = $this->id . ".doGoToPage(" . $nextpage . ");return false;";
                $next = "<a href=\"" . htmlentities($nextUrl, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $nextAjax . "\" class='nextPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
                $last = "<a href=\"" . htmlentities($lastUrl, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $lastAjax . "\" class='lastPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
            } else {
                $next = "<a class='noNextPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
                $last = "<a class='noLastPage'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
            }
            $pagesEnum = '';
            for ($r = 1; $r <= $this->totPages; $r++) {
                if ($r >= $this->currentPage - 5 && $r <= $this->currentPage + 5) {
                    $pageAjax = $this->id . ".doGoToPage(" . $r . ");return false;";
                    if ($r != $this->currentPage) {
                        $pagesEnum .= "&nbsp;<a href=\"" . htmlentities($this->ownerPage . '?order=' . $this->orderBy . '&page=' . $r, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $pageAjax . "\">" . $r . "</a>";
                    } else {
                        $pagesEnum .= "&nbsp;<a>" . $r . "</a>";
                    }
                }
            }
            if ($this->totRows === 0) {
                $this->tpl->newBlock('norecords');
                $this->tpl->assign("columnCount", $this->colCount);
                $noRecordsFound = 'ID_NO_RECORDS_FOUND';
                if (G::LoadTranslation($noRecordsFound)) {
                    $noRecordsFound = G::LoadTranslation($noRecordsFound);
                }
                $this->tpl->assign("noRecordsFound", $noRecordsFound);
            }
            if (!$this->disableFooter) {
                $this->tpl->newBlock("bottomFooter");
                $this->tpl->assign("columnCount", $this->colCount);
                $this->tpl->assign("pagedTableId", $this->id);
                if ($this->totRows !== 0) {
                    if ($this->totPages > 1) {
                        $this->tpl->assign("first", $first);
                        $this->tpl->assign("prev", $prev);
                        $this->tpl->assign("next", $next);
                        $this->tpl->assign("last", $last);
                    }
                    $this->tpl->assign("currentPage", $this->currentPage);
                    $this->tpl->assign("totalPages", $this->totPages);
                    $firstRow = ($this->currentPage - 1) * $this->rowsPerPage + 1;
                    $lastRow = $firstRow + $rs->getRecordCount() - 1;
                    $this->tpl->assign("firstRow", $firstRow);
                    $this->tpl->assign("lastRow", $lastRow);
                    $this->tpl->assign("totalRows", $this->totRows);
                } else {
                    $this->tpl->assign("indexStyle", 'visibility:hidden;');
                }
                if ($this->searchBy) {
                    $this->tpl->assign("fastSearchValue", $this->fastSearch);
                } else {
                    $this->tpl->assign("fastSearchStyle", 'visibility:hidden;');
                }
                if ($this->addRow) {
                    if ($this->sqlInsert != '') {
                        $this->tpl->assign("insert", '<a href="#" onclick="pagedTable.event=\'Insert\';popup(\'' . $this->popupPage . '\');return false;">' . 'ID_ADD_NEW' . '</a>');
                    }
                }
                $this->tpl->assign("pagesEnum", $pagesEnum);
            }
            ?>

            <script language='JavaScript'>
            var <?php 
            echo $this->id;
            echo $this->name != '' ? '=' . $this->name : '';
            ?>
=new G_PagedTable();
            <?php 
            echo $this->id;
            ?>
.id<?php 
            echo '="' . addslashes($this->id) . '"';
            ?>
;
            <?php 
            echo $this->id;
            ?>
.name<?php 
            echo '="' . addslashes($this->name) . '"';
            ?>
;
            <?php 
            echo $this->id;
            ?>
.ajaxUri<?php 
            echo '="' . addslashes($this->ajaxServer) . '?ptID=' . $this->id . '"';
            ?>
;
            <?php 
            echo $this->id;
            ?>
.currentOrder<?php 
            echo '="' . addslashes($this->orderBy) . '"';
            ?>
;
            <?php 
            echo $this->id;
            ?>
.currentFilter;
            <?php 
            echo $this->id;
            ?>
.currentPage<?php 
            echo '=' . $this->currentPage;
            ?>
;
            <?php 
            echo $this->id;
            ?>
.totalRows<?php 
            echo '=' . $this->totRows;
            ?>
;
            <?php 
            echo $this->id;
            ?>
.rowsPerPage<?php 
            echo '=' . $this->rowsPerPage;
            ?>
;
            <?php 
            echo $this->id;
            ?>
.popupPage<?php 
            echo '="' . addslashes($this->popupPage) . '?ptID=' . $this->id . '"';
            ?>
;
            <?php 
            echo $this->id;
            ?>
.onUpdateField<?php 
            echo '="' . addslashes($this->onUpdateField) . '"';
            ?>
;
            <?php 
            echo $this->id;
            ?>
.shownFields<?php 
            echo '=' . $this->shownFields;
            ?>
;

            var panelPopup;
            var popupWidth<?php 
            echo '=' . $this->popupWidth;
            ?>
;
            var popupHeight<?php 
            echo '=' . $this->popupHeight;
            ?>
;
            </script>
            <?php 
        }
        /**
         * ******** CLOSE BLOCK **************
         */
        if ($block === '' || $block === 'close') {
            $this->tpl->newBlock("closeBlock");
        }
        //By JHL
        //Put the content of the table in a variable to be used for other puposes
        //Like rendering as PDF
        global $_TABLE_CONTENT_;
        $_TABLE_CONTENT_ = $this->tpl->getOutputContent();
        $this->tpl->printToScreen();
        unset($this->tpl);
        //unset($this->dbc);
        //unset($this->ses);
        $_SESSION['pagedTable[' . $this->id . ']'] = serialize($this);
        $this->fastSearch = '';
        return;
    }
Example #6
0
    /**
     * GET history of case
     *
     * @param $app_uid
     * @return array
     * @throws \Exception
     */
    public function getCasesListHistory($app_uid)
    {
        G::LoadClass( 'case' );
        G::LoadClass( "BasePeer" );

        //global $G_PUBLISH;
        $c = $this->getTransferHistoryCriteria( $app_uid );

        //$result     = new \stdClass();
        $aProcesses = Array ();

        $rs = \GulliverBasePeer::doSelectRs( $c );
        $rs->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
        $rs->next();
        for ($j = 0; $j < $rs->getRecordCount(); $j ++) {
            $result               = $rs->getRow();
            $result["ID_HISTORY"] = $result["PRO_UID"] . '_' . $result["APP_UID"] . '_' . $result["TAS_UID"];
            $aProcesses[]         = $result;
            $rs->next();
            $processUid = $result["PRO_UID"];
        }

        $process = new \Process();

        $arrayProcessData = $process->load($processUid);

        //$newDir = '/tmp/test/directory';
        //G::verifyPath( $newDir );

        $result = array();
        $result["processName"] = $arrayProcessData["PRO_TITLE"];
        //$result["PRO_DESCRIPTION"] = $arrayProcessData["PRO_DESCRIPTION"];
        $result['flow'] = $aProcesses;
        return $result;
    }