Refactor GenericTable to use PageIndex rather than inherit from it

This has on my todo list for years... I'm glad to finally get around to it.
This commit is contained in:
Aaron committed 2021-02-17 20:43:30 +01:00
1 parent 96937b6952
commit cba42a9129
3 files changed
+66 -28

No files matched your search

+9 -4
View File
@@ -6,12 +6,15 @@
* Kabuki CMS (C) 2013-2015, Aaron van Geffen
*****************************************************************************/
class TabularData extends Pagination
class TabularData extends SubTemplate
{
public function __construct(GenericTable $table)
{
$this->_t = $table;
parent::__construct($table);
$pageIndex = $table->getPageIndex();
if ($pageIndex)
$this->pager = new Pagination($pageIndex);
}
protected function html_content()
@@ -25,7 +28,8 @@ class TabularData extends Pagination
<h2>', $title, '</h2>';
// Showing a page index?
parent::html_content();
if (isset($this->pager))
$this->pager->html_content();
// Maybe even a small form?
if (isset($this->_t->form_above))
@@ -87,7 +91,8 @@ class TabularData extends Pagination
$this->showForm($this->_t->form_below);
// Showing a page index?
parent::html_content();
if (isset($this->pager))
$this->pager->html_content();
echo '
</div>';