<?php
 namespace App\Mvc; abstract class View_Window_PaginatedListing_ListAbstract extends ViewAbstract { protected $resultsPerPageList= [5, 10, 15, 20, 25, 30]; protected $totalRecordsCountIsCached = false; protected function getListObject() { $listObj = $this->createListingObj(); $listObj->setColumns($this->list_getThDetails()); $listObj->setResultsPerPageList($this->resultsPerPageList); $listObj->setRecords($this->input['recordsList']); $listObj->setRecordsCountTotal($this->input['totalRecordsCount']); $listObj->setRecordsCountTotalIsCached($this->totalRecordsCountIsCached); $listObj->importFromListingParams($this->input['listingParams']); $listObj->setListingSelection($this->input['listingSelection']); return $listObj; } protected function createListingObj() { return \Theme::getInstance()->listing()->createListingObj(); } public function render() { $this->setOutputVar('listObj', $this->getListObject()); return $this->render_smarty(\Theme::getInstance()->listing()->getListingBodyTemplate()); } protected function assignSmartyDefaultVars($smarty) { $smarty->assign('messagesCollector', $this->messagesCollector); return parent::assignSmartyDefaultVars($smarty); } public function renderRecords() { $this->render_prepare(\Engine\Smarty\SmartyMultiton::getInstance()); \Engine\Plugins\Manager::getInstance()->executeEvent("MVC-BeforeViewRender-[{$this->controller->getModule()}-{$this->controller->getAction()}]", ['view'=>$this]); $this->getListObject()->templateInitialize(); $filteredModuleOptions = $this->controller->filterOptionsForSections($this->controller->getAllDefinedOptions(), ['row']); $filteredModuleMenuComponent = $this->controller->buildOptionsComponent($filteredModuleOptions)->setOption('staticRender', true); $recordsHtml = $this->getListObject()->renderRecords([ 'filteredModuleOptions' => $filteredModuleOptions, 'filteredModuleMenuComponent' => $filteredModuleMenuComponent, ]); $this->getListObject()->templateCleanup(); return $recordsHtml . "<script type='text/javascript'>{$filteredModuleMenuComponent->renderJs(\Engine\Theme\JSLoader\JSLoader::getInstance())}</script>"; } public function getPaginationData() { return $this->getListObject()->renderJsonPagination(); } abstract protected function list_getThDetails() ; }