<?php
namespace Modules\Admin\Config\Currencies; class Model extends \App\Mvc\Model_ListingAbstract { public function list_execute(\App\Mvc\View\Listing\Members\Params $listingParams) { $alternates = (bool) $this->globalCfg['useAlternativeNames']['currencies']; $list = []; $filters = $listingParams->getFilters(); foreach (\App\Config\Currencies::getAdmin()->getAll() as $code => $details) { if ($filters['currencyName'] && strpos(mb_strtolower($details['currencyName']), mb_strtolower($filters['currencyName']))===false) { continue; } $list[$code] = [ 'id' => $code, 'name' => $details['currencyName'], 'subdivision' =>$details['subdivisionName'] ]; if($alternates) { $list[$code]['nameAlt'] = $details['currencyName2']; $list[$code]['subdivisionAlt'] = $details['subdivisionName2']; } } $defaultCurrency = \App\Config\Currencies::getAdmin()->getDefaultCurrency(); $workCurrency = \App\Config\Currencies::getAdmin()->getWorkCurrency(); if (array_key_exists($defaultCurrency,$list)) { $list[$defaultCurrency]['default'] = true; } if (array_key_exists($workCurrency,$list)) { $list[$workCurrency]['work'] = true; } $this->totalRecordsCount = count($list); $this->recordsList = $list; } }