<?php
namespace Modules\Admin\Config\Services\AgencyCostCenters; class Model extends \App\Mvc\Model_ListingAbstract { public function list_execute(\App\Mvc\View\Listing\Members\Params $listingParams) { $list = []; $filters = $listingParams->getFilters(); foreach (\App\Config\AgencyCostCenters::getAdmin()->getAll() as $code => $details) { if ($filters['costCenter'] && strpos(mb_strtolower($details['name']), mb_strtolower($filters['costCenter']))===false) { continue; } if ($filters['costCenterCode'] && mb_strtolower($code) !== mb_strtolower($filters['costCenterCode'])) { continue; } $list[$code] = [ 'id' => $code, 'name' => $details['name'], 'disabled' => (bool) $details['disabled'] ]; } $this->totalRecordsCount = count($list); $this->recordsList = $list; } }