/** * 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'> </a>"; $prev = "<a href=\"" . htmlentities($prevUrl, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $prevAjax . "\" class='previousPage'> </a>"; } else { $first = "<a class='noFirstPage'> </a>"; $prev = "<a class='noPreviousPage'> </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'> </a>"; $last = "<a href=\"" . htmlentities($lastUrl, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $lastAjax . "\" class='lastPage'> </a>"; } else { $next = "<a class='noNextPage'> </a>"; $last = "<a class='noLastPage'> </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 .= " <a href=\"" . htmlentities($this->ownerPage . '?order=' . $this->orderBy . '&page=' . $r, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $pageAjax . "\">" . $r . "</a>"; } else { $pagesEnum .= " <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; }
/** * Function renderTable * @author David S. Callizaya S. <*****@*****.**> * @param $block : = 'content'(Prints contentBlock only) * @access public * @return string */ function renderTable($block = '') { // DBConnection $this->prepareQuery(); //Query for get the number of rows $this->query = $this->ses->execute($this->sql); $this->totRows = $this->query->count(); $this->totpages = ceil($this->query->count() / $this->rowsPerPage); //Query for obtain the records $this->query = $this->ses->execute($this->sql . ' LIMIT ' . ($this->currentPage - 1) * $this->rowsPerPage . ', ' . $this->rowsPerPage); // Prepare the template $this->tpl = new TemplatePower(PATH_CORE . $this->template); $this->tpl->prepare(); /********** 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); 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)); $menu->setValues(array('PAGED_TABLE_FAST_SEARCH' => $this->fastSearch)); if (isset($filterForm->name)) { $menu->setValues(array('SEARCH_FILTER_FORM' => $filterForm->name)); } $this->tpl->assign('content', $menu->render($template, $scriptCode)); $oHeadPublisher =& headPublisher::getSingleton(); $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 =& headPublisher::getSingleton(); $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->query->count()); $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 $gridRows = 0; for ($j = 0; $j < $this->query->count(); $j++) { $result = $this->query->read(); $gridRows++; $this->tpl->newBlock("row"); $this->tpl->assign("class", "Row" . ($j % 2 + 1)); $this->tdStyle = ''; $this->tdClass = ''; foreach ($this->fields as $r => $rval) { if (strcasecmp($this->fields[$r]['Type'], 'cellMark') == 0) { $result1 = $result; $result1['row__'] = $j + 1; $this->xmlForm->setDefaultValues(); $this->xmlForm->setValues($result1); $result1 = array_merge($this->xmlForm->values, $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') { $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'> </a>"; $prev = "<a href=\"" . htmlentities($prevUrl, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $prevAjax . "\" class='previousPage'> </a>"; } else { $first = "<a class='noFirstPage'> </a>"; $prev = "<a class='noPreviousPage'> </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'> </a>"; $last = "<a href=\"" . htmlentities($lastUrl, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $lastAjax . "\" class='lastPage'> </a>"; } else { $next = "<a class='noNextPage'> </a>"; $last = "<a class='noLastPage'> </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 .= " <a href=\"" . htmlentities($this->ownerPage . '?order=' . $this->orderBy . '&page=' . $r, ENT_QUOTES, 'utf-8') . "\" onclick=\"" . $pageAjax . "\">" . $r . "</a>"; } else { $pagesEnum .= " <a>" . $r . "</a>"; } } } if ($this->query->count() === 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->query->count() !== 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 + $this->query->count() - 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->query->count(); ?> ; <?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"); } $this->tpl->printToScreen(); unset($this->tpl); unset($this->dbc); unset($this->ses); $_SESSION['pagedTable[' . $this->id . ']'] = serialize($this); return; }