Exemplo n.º 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;
     }
 }
Exemplo n.º 2
0
G::LoadClass('processMap');
G::LoadClass('ArrayPeer');
G::LoadClass('dbConnections');
global $_DBArray;
switch ($action) {
    case 'loadInfoAssigConnecctionDB':
        $oStep = new Step();
        return print $oStep->loadInfoAssigConnecctionDB($_POST['PRO_UID'], $_POST['DBS_UID']);
        break;
    case 'showDbConnectionsList':
        $oProcess = new processMap();
        $oCriteria = $oProcess->getConditionProcessList();
        if (ProcessPeer::doCount($oCriteria) > 0) {
            $aProcesses = array();
            $aProcesses[] = array('PRO_UID' => 'char', 'PRO_TITLE' => 'char');
            $oDataset = ArrayBasePeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            $sProcessUID = '';
            while ($aRow = $oDataset->getRow()) {
                if ($sProcessUID == '') {
                    $sProcessUID = $aRow['PRO_UID'];
                }
                $aProcesses[] = array('PRO_UID' => isset($aRow['PRO_UID']) ? $aRow['PRO_UID'] : '', 'PRO_TITLE' => isset($aRow['PRO_TITLE']) ? $aRow['PRO_TITLE'] : '');
                $oDataset->next();
            }
            $_DBArray['PROCESSES'] = $aProcesses;
            $_SESSION['_DBArray'] = $_DBArray;
            $_SESSION['PROCESS'] = isset($_POST['PRO_UID']) ? $_POST['PRO_UID'] : '';
            $oDBSource = new DbSource();
            $oCriteria = $oDBSource->getCriteriaDBSList($_SESSION['PROCESS']);
Exemplo n.º 3
0
     $r = new stdclass();
     $r->data = $aProcesses;
     $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++;
     }
Exemplo n.º 4
0
 /**
  * Prepares the Criteria object and uses the parent doSelect()
  * method to get a ResultSet.
  *
  * Use this method directly if you want to just get the resultset
  * (instead of an array of objects).
  *
  * @param Criteria $criteria The Criteria object used to build the SELECT statement.
  * @param Connection $con the connection to use
  * @throws PropelException Any exceptions caught during processing will be
  * rethrown wrapped into a PropelException.
  * @return ResultSet The resultset object with numerically-indexed fields.
  * @see BasePeer::doSelect()
  */
 public static function doSelectRS(Criteria $criteria, $con = null)
 {
     global $_DBArray;
     if (!isset($_DBArray)) {
         $_DBArray = $_SESSION['_DBArray'];
     }
     $tableName = $criteria->getDBArrayTable();
     if (!isset($_DBArray[$tableName])) {
         throw new Exception("Error: the table '{$tableName}' doesn't exist in DBArray ");
     }
     $arrayTable = $_DBArray[$tableName];
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     if (!$criteria->getSelectColumns()) {
         foreach (array_keys($_DBArray[$tableName][0]) as $key => $val) {
             $criteria->addSelectColumn($tableName . '.' . $val);
         }
     }
     // Set the correct dbName
     $criteria->setDbName(self::DATABASE_NAME);
     // BasePeer returns a Creole ResultSet, set to return
     // rows indexed numerically.
     return ArrayBasePeer::doSelect($criteria, $tableName, $con);
 }
            if (!is_array($value2)) {
                $historyData[$key][$key1] = $value2;
            } else {
                foreach ($value2 as $key3 => $value3) {
                    if (is_array($value3)) {
                        foreach ($value3 as $key4 => $value4) {
                            $historyData[$key][$key1][$key3][$key4] = $value4;
                        }
                    }
                }
            }
        }
    }
    $changeCount--;
}
$oDataset = ArrayBasePeer::doSelectRs($c);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$changeCount = 0;
while ($oDataset->next()) {
    $aRow = $oDataset->getRow();
    $changeCount++;
    $changedValues = unserialize($aRow['HISTORY_DATA']);
    $tpl->newBlock("DYNLOG");
    $tableName = "_TCHANGE_" . $changeCount;
    $changeCountA = $changeCount + 1;
    $tableNameA = "_TCHANGE_" . $changeCountA;
    $tpl->assign("dynTitle", addslashes($aRow["DYN_TITLE"]));
    $tpl->assign("dynDate", $aRow["HISTORY_DATE"]);
    $tpl->assign("dynUser", addslashes($aRow["USR_NAME"]));
    $tpl->assign("changes", G::LoadTranslation("ID_CHANGES"));
    $tpl->assign("dynUID", $aRow["DYN_UID"]);
Exemplo n.º 6
0
 /**
  * newExtObjectPermission
  *
  * @param string $sProcessUID
  * @param string $sAction
  * @return array depending on action
  */
 public function newExtObjectPermission($sProcessUID, $sAction)
 {
     $aAllTasks = array();
     $aAllTasks[] = array('UID' => 'char', 'LABEL' => 'char');
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(TaskPeer::PRO_UID);
     $oCriteria->addSelectColumn(TaskPeer::TAS_UID);
     $oCriteria->addSelectColumn(ContentPeer::CON_VALUE);
     $aConditions = array();
     $aConditions[] = array(0 => TaskPeer::TAS_UID, 1 => ContentPeer::CON_ID);
     $aConditions[] = array(0 => ContentPeer::CON_CATEGORY, 1 => DBAdapter::getStringDelimiter() . 'TAS_TITLE' . DBAdapter::getStringDelimiter());
     $aConditions[] = array(0 => ContentPeer::CON_LANG, 1 => DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter());
     $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
     $oCriteria->add(TaskPeer::PRO_UID, $sProcessUID);
     $oDataset = TaskPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         $aAllTasks[] = array('UID' => $aRow['TAS_UID'], 'LABEL' => $aRow['CON_VALUE']);
         $oDataset->next();
     }
     $aUsersGroups = array();
     $aUsersGroups[] = array('UID' => 'char', 'LABEL' => 'char');
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(GroupwfPeer::GRP_UID);
     $oCriteria->addAsColumn('GRP_TITLE', ContentPeer::CON_VALUE);
     $aConditions = array();
     $aConditions[] = array(GroupwfPeer::GRP_UID, ContentPeer::CON_ID);
     $aConditions[] = array(ContentPeer::CON_CATEGORY, DBAdapter::getStringDelimiter() . 'GRP_TITLE' . DBAdapter::getStringDelimiter());
     $aConditions[] = array(ContentPeer::CON_LANG, DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter());
     $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
     $oCriteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE');
     $oDataset = GroupwfPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         $aUsersGroups[] = array('UID' => '2|' . $aRow['GRP_UID'], 'LABEL' => $aRow['GRP_TITLE'] . ' (' . G::LoadTranslation('ID_GROUP') . ')');
         $oDataset->next();
     }
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(UsersPeer::USR_UID);
     $oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);
     $oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
     $oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
     $oCriteria->add(UsersPeer::USR_STATUS, 'ACTIVE');
     $oDataset = UsersPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         $aUsersGroups[] = array('UID' => '1|' . $aRow['USR_UID'], 'LABEL' => $aRow['USR_FIRSTNAME'] . ' ' . $aRow['USR_LASTNAME'] . ' (' . $aRow['USR_USERNAME'] . ')');
         $oDataset->next();
     }
     $aAllObjects = array();
     $aAllObjects[] = array('UID' => 'char', 'LABEL' => 'char');
     $aAllDynaforms = array();
     $aAllDynaforms[] = array('UID' => 'char', 'LABEL' => 'char');
     $aAllInputs = array();
     $aAllInputs[] = array('UID' => 'char', 'LABEL' => 'char');
     $aAllOutputs = array();
     $aAllOutputs[] = array('UID' => 'char', 'LABEL' => 'char');
     $oCriteria = $this->getDynaformsCriteria($sProcessUID);
     $oCriteria->add(DynaformPeer::DYN_TYPE, 'XMLFORM');
     $oDataset = DynaformPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         $aRow['DYN_TITLE'] = isset($aRow['DYN_TITLE']) ? $aRow['DYN_TITLE'] : '';
         $aAllObjects[] = array('UID' => 'DYNAFORM|' . $aRow['DYN_UID'], 'LABEL' => $aRow['DYN_TITLE'] . ' (' . G::LoadTranslation('ID_DYNAFORM') . ')');
         $aAllDynaforms[] = array('UID' => $aRow['DYN_UID'], 'LABEL' => $aRow['DYN_TITLE']);
         $oDataset->next();
     }
     G::LoadClass('ArrayPeer');
     $oDataset = ArrayBasePeer::doSelectRS($this->getInputDocumentsCriteria($sProcessUID));
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         $aAllObjects[] = array('UID' => 'INPUT_DOCUMENT|' . $aRow['INP_DOC_UID'], 'LABEL' => $aRow['INP_DOC_TITLE'] . ' (' . G::LoadTranslation('ID_INPUT_DOCUMENT') . ')');
         $aAllInputs[] = array('UID' => $aRow['INP_DOC_UID'], 'LABEL' => $aRow['INP_DOC_TITLE']);
         $oDataset->next();
     }
     G::LoadClass('ArrayPeer');
     $oDataset = ArrayBasePeer::doSelectRS($this->getOutputDocumentsCriteria($sProcessUID));
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         $aAllObjects[] = array('UID' => 'OUTPUT_DOCUMENT|' . $aRow['OUT_DOC_UID'], 'LABEL' => $aRow['OUT_DOC_TITLE'] . ' (' . G::LoadTranslation('ID_OUTPUT_DOCUMENT') . ')');
         $aAllOutputs[] = array('UID' => $aRow['OUT_DOC_UID'], 'LABEL' => $aRow['OUT_DOC_TITLE']);
         $oDataset->next();
     }
     global $_DBArray;
     $_DBArray = isset($_SESSION['_DBArray']) ? $_SESSION['_DBArray'] : '';
     switch ($sAction) {
         case 'tasks':
             return $aAllTasks;
             break;
         case 'users':
             return $aUsersGroups;
             break;
         case 'dynaform':
             return $aAllDynaforms;
             break;
         case 'input':
             return $aAllInputs;
             break;
         case 'output':
             return $aAllOutputs;
             break;
     }
 }
    /**
     * 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;
    }
Exemplo n.º 8
0
 public function showObjects($pro_uid, $app_uid, $obj_uid, $typeObject)
 {
     switch ($typeObject) {
         case 'DYNAFORM':
             $oCase = new \Cases();
             $Fields = $oCase->loadCase($app_uid);
             $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PREVIOUS_STEP_LABEL'] = '';
             $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP_LABEL'] = '';
             $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_STEP'] = '#';
             $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['NEXT_ACTION'] = 'alert("Sample"); return false;';
             $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PRINT_PREVIEW'] = '#';
             $Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PRINT_PREVIEW_ACTION'] = 'tracker_PrintView?CTO_UID_OBJ=' . $obj_uid . '&CTO_TYPE_OBJ=PRINT_PREVIEW';
             $dynaForm = new \Dynaform();
             $arrayDynaFormData = $dynaForm->Load($obj_uid);
             if (isset($arrayDynaFormData["DYN_VERSION"]) && $arrayDynaFormData["DYN_VERSION"] == 2) {
                 \G::LoadClass("pmDynaform");
                 $Fields["PRO_UID"] = $pro_uid;
                 $Fields["CURRENT_DYNAFORM"] = $obj_uid;
                 $pmDynaForm = new \pmDynaform($Fields);
                 //                    if ($pmDynaForm->isResponsive()) {
                 //                        $pmDynaForm->printTracker();
                 //                    }
                 $response = $pmDynaForm;
             }
             break;
         case 'INPUT_DOCUMENT':
             //G::LoadClass( 'case' );
             $oCase = new \Cases();
             $c = $oCase->getAllUploadedDocumentsCriteriaTracker($pro_uid, $app_uid, $obj_uid);
             //                $response = array();
             if ($c->getDbName() == 'dbarray') {
                 $rs = \ArrayBasePeer::doSelectRs($c);
                 $rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
                 $rs->next();
                 $doc = array();
                 while ($row = $rs->getRow()) {
                     $doc[] = $row;
                     $rs->next();
                 }
                 //$response = $this->parserObjects($objects);
             }
             $response = $doc;
             break;
         case 'OUTPUT_DOCUMENT':
             //G::LoadClass( 'case' );
             $oCase = new \Cases();
             $c = $oCase->getAllGeneratedDocumentsCriteriaTracker($pro_uid, $app_uid, $obj_uid);
             $response = $c;
             break;
     }
     return $response;
 }