[Logicampus-cvs] logicampus/src/logicreate/lib lc_table.php, 1.12, 1.13 lc_table_renderer.php, 1.15
Brought to you by:
trilexcom
From: Mark K <har...@us...> - 2007-10-08 19:41:28
|
Update of /cvsroot/logicampus/logicampus/src/logicreate/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv4300/lib Modified Files: lc_table.php lc_table_renderer.php Log Message: Make my LOB table paginate. Index: lc_table.php =================================================================== RCS file: /cvsroot/logicampus/logicampus/src/logicreate/lib/lc_table.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** lc_table.php 15 May 2007 22:16:42 -0000 1.12 --- lc_table.php 8 Oct 2007 19:41:17 -0000 1.13 *************** *** 137,140 **** --- 137,162 ---- $this->tableHeader->setColumnName($i,$n); } + + + /** + * add a column at the specifiec index + * @return int new index + */ + function addColumnAt($idx, $c) { + $newColumns = array(); + $newMap = array(); + + for($x = 0; $x < count($this->columnModel->tableColumns); $x++) { + if ($x === $idx) { + $newColumns[] = $c; + $newMap[] = $c->name; + } + $newColumns[] =& $this->columnModel->tableColumns[$x]; + $newMap[] = $this->tableModel->colMap[$x]; + } + $this->columnModel->tableColumns = $newColumns; + $this->tableModel->colMap = $newMap; + return $idx; + } } *************** *** 143,168 **** class LC_TablePaged extends LC_Table { ! var $rowsPerPage = 10; var $currentPage = 1; var $url; ! function getPrevUrl() { ! return '#'; } ! function getNextUrl() { ! return '#'; } ! function getPageUrl($i) { ! return '#'; } function getMaxRows() { ! return 1; } } --- 165,199 ---- class LC_TablePaged extends LC_Table { ! var $rowsPerPage = 30; var $currentPage = 1; var $url; + var $maxRows = 1; ! function getPrevUrl($pageIdx=1) { ! return $this->getPageUrl($pageIdx-1); } ! function getNextUrl($pageIdx=1) { ! $maxRows = $this->getMaxRows(); ! $pages = ceil($maxRows / $this->rowsPerPage); ! $nextPage = $this->currentPage +1; ! if ($nextPage > $pages) { ! return '#'; ! // $nextPage = $pages; ! } ! ! return $this->getPageUrl($pageIdx+1); } ! function getPageUrl($pageIdx=1) { ! return sprintf($this->url, $pageIdx); } function getMaxRows() { ! return $this->maxRows; } } *************** *** 571,574 **** --- 602,623 ---- } + /** + * add a column at the specifiec index + * @return int new index + */ + function addColumnAt($idx, $c) { + $newColumns = array(); + + for($x = 0; $x < count($this->tableColumns); $x++) { + if ($x === $idx) { + $newColumns[] = $c; + } + $newColumns[] =& $this->tableColumns[$x]; + } + $this->tableColumns = $newColumns; + + return $idx; + } + /** Index: lc_table_renderer.php =================================================================== RCS file: /cvsroot/logicampus/logicampus/src/logicreate/lib/lc_table_renderer.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** lc_table_renderer.php 1 Oct 2007 19:17:10 -0000 1.15 --- lc_table_renderer.php 8 Oct 2007 19:41:21 -0000 1.16 *************** *** 10,13 **** --- 10,14 ---- var $table; //the table to render, must be of type LC_Table var $style = 'clear:right;'; + var $cssClass = 'datatable'; function LC_TableRenderer($t) { *************** *** 41,45 **** */ function startTable() { ! $this->html .= '<table cellpadding="0" cellspacing="1" class="datatable" width="100%" style="'.$this->style.'">'; $this->html .= "\n"; } --- 42,50 ---- */ function startTable() { ! $this->html .= '<table border="0" cellpadding="0" cellspacing="1" width="100%" style="'.$this->style.'"'; ! if ( strlen($this->cssClass) ) { ! $this->html .= ' class="'.$this->cssClass.'" '; ! } ! $this->html .= '>'; $this->html .= "\n"; } *************** *** 214,222 **** $pages = ceil($maxRows / $this->table->rowsPerPage); $this->html .= '<div class="datatable_nav" style="padding-top:7px;" align="right">'; ! $this->html .= '<a href="'.$this->table->getPrevUrl().'">«Prev</a> | '; for ($x=1; $x<=$pages; ++$x) { $this->html .= ' <a href="'.$this->table->getPageUrl($x).'">'.$x.'</a>'; } ! $this->html .= ' | <a href="'.$this->table->getNextUrl().'">Next»</a>'; $this->html .= ' Current Page: '.$this->table->currentPage; $this->html .= '</div>'; --- 219,227 ---- $pages = ceil($maxRows / $this->table->rowsPerPage); $this->html .= '<div class="datatable_nav" style="padding-top:7px;" align="right">'; ! $this->html .= '<a href="'.$this->table->getPrevUrl($this->table->currentPage).'">«Prev</a> | '; for ($x=1; $x<=$pages; ++$x) { $this->html .= ' <a href="'.$this->table->getPageUrl($x).'">'.$x.'</a>'; } ! $this->html .= ' | <a href="'.$this->table->getNextUrl($this->table->currentPage).'">Next»</a>'; $this->html .= ' Current Page: '.$this->table->currentPage; $this->html .= '</div>'; *************** *** 233,241 **** $pages = ceil($maxRows / $this->table->rowsPerPage); $this->html .= '<div class="datatable_nav" style="padding-bottom:7px;" align="right">'; ! $this->html .= '<a href="'.$this->table->getPrevUrl().'">«Prev</a> | '; for ($x=1; $x<=$pages; ++$x) { $this->html .= ' <a href="'.$this->table->getPageUrl($x).'">'.$x.'</a>'; } ! $this->html .= ' | <a href="'.$this->table->getNextUrl().'">Next»</a>'; $this->html .= ' Current Page: '.$this->table->currentPage; $this->html .= '</div>'; --- 238,246 ---- $pages = ceil($maxRows / $this->table->rowsPerPage); $this->html .= '<div class="datatable_nav" style="padding-bottom:7px;" align="right">'; ! $this->html .= '<a href="'.$this->table->getPrevUrl($this->table->currentPage).'">«Prev</a> | '; for ($x=1; $x<=$pages; ++$x) { $this->html .= ' <a href="'.$this->table->getPageUrl($x).'">'.$x.'</a>'; } ! $this->html .= ' | <a href="'.$this->table->getNextUrl($this->table->currentPage).'">Next»</a>'; $this->html .= ' Current Page: '.$this->table->currentPage; $this->html .= '</div>'; *************** *** 477,479 **** --- 482,505 ---- } } + + class LC_TableStaticRenderer extends LC_TableCellRenderer { + + var $values; + var $returnSpace = true; + + function getRenderedValue() { + if (!isset($this->values[$this->row])) { + if ($this->returnSpace === true) { + return ' '; + } else { + return ''; + } + } + return $this->values[$this->row]; + } + } + + + + ?> |