<?php
namespace Modules\Utils\AppReports; class Model extends \App\Mvc\Model_ListingAbstract { public function list_execute(\App\Mvc\View\Listing\Members\Params $listingParams) { $list = []; $filters = $listingParams->getFilters(); foreach (\Modules\Utils\AppReports\SqlManager::getInstance()->getAll() as $details) { if ($filters['name'] and strpos($details['name'], $filters['name']) === false) { continue; } if ($filters['sql'] and strpos($details['sql'], $filters['sql']) === false) { continue; } if ($filters['monthTable'] and strpos($details['monthTable'], $filters['monthTable']) === false) { continue; } $list[$details['name']] = [ "name" => $details['name'], "sql" => $details['sql'], "monthTable" => $details['monthTable'] ]; } $start = $listingParams->getResultsPerPage()*$listingParams->getCurrentPage(); $count = $listingParams->getResultsPerPage(); $this->totalRecordsCount = count($list); $recordsList = array_slice($list, $start, $count); $this->recordsList = $recordsList; } }