<?php
namespace Modules\Admin\UsersTrails; class Model extends \App\Mvc\Model_ListingAbstract { public function list_execute(\App\Mvc\View\Listing\Members\Params $listingParams) { $filters = $listingParams->getFilters(); $listObj = new \App\EntityList\UserTraces(); $listObj->applyUserRestriction(false); $listObj->setColumns(['module', 'action', 'entityType', 'entityOperation', 'idEntity', 'extraData', 'timestamp', 'idUser']); if ($filters['timeInterval']['start']) { $listObj->setFilter('timestamp', '>=', \Engine\DateTime::createFromIsoDateOrDatetime($filters['timeInterval']['start'])->formatTime()); } else { $listObj->setFilter('timestamp', '>=', \Engine\DateTime::create('-1month')->formatTime()); } if ($filters['timeInterval']['end']) { $listObj->setFilter('timestamp', '<=', \Engine\DateTime::createFromIsoDateOrDatetime($filters['timeInterval']['end'])->formatTime()); } if ($filters['user']['id']) { $listObj->setFilter('idUser', '=', $filters['user']['id']); } if ($filters['module']) { $listObj->setFilter('module', 'LIKE', $filters['module']); } if ($filters['action']) { $listObj->setFilter('action', 'LIKE', $filters['action']); } if ($filters['entityType']) { $listObj->setFilter('entityType', 'LIKE', $filters['entityType']); } if ($filters['operation']) { $listObj->setFilter('entityOperation', 'LIKE', $filters['operation']); } if ($filters['entityCode']) { $listObj->setFilter('idEntity', 'LIKE', $filters['entityCode']); } $listObj = $this->entityList_inheritListingParams($listingParams, $listObj); $trailsList = $listObj->exportRecords(); foreach ($trailsList as $key => $visit) { if($visit['extraData']) { $trailsList[$key]['extraDataArr'] = unserialize($visit['extraData']); } } $this->recordsList = $trailsList; $this->totalRecordsCount = $listObj->getRecordsCount(); } }