. */ namespace SP\Modules\Web\Controllers; use SP\Core\Acl\ActionsInterface; use SP\Http\JsonResponse; use SP\Modules\Web\Controllers\Helpers\ItemsGridHelper; use SP\Modules\Web\Controllers\Traits\ItemTrait; use SP\Modules\Web\Controllers\Traits\JsonTrait; use SP\Services\EventLog\EventlogService; /** * Class EventlogController * * @package SP\Modules\Web\Controllers */ class EventlogController extends ControllerBase { use JsonTrait, ItemTrait; /** * @var EventlogService */ protected $eventLogService; /** * @throws \SP\Core\Dic\ContainerException */ public function indexAction() { if (!$this->acl->checkUserAccess(ActionsInterface::EVENTLOG)) { return; } $this->view->addTemplate('index'); $this->view->assign('data', $this->getSearchGrid()); $this->view(); } /** * @return $this * @throws \SP\Core\Dic\ContainerException */ protected function getSearchGrid() { $itemsGridHelper = $this->dic->get(ItemsGridHelper::class); $itemSearchData = $this->getSearchData($this->configData); return $itemsGridHelper->updatePager($itemsGridHelper->getEventLogGrid($this->eventLogService->search($itemSearchData)), $itemSearchData); } /** * @throws \SP\Core\Dic\ContainerException */ public function searchAction() { if (!$this->acl->checkUserAccess(ActionsInterface::EVENTLOG_SEARCH)) { return; } $this->view->addTemplate('datagrid-table-simple', 'grid'); $this->view->assign('data', $this->getSearchGrid()); $this->returnJsonResponseData(['html' => $this->render()]); } /** * clearAction */ public function clearAction() { try { $this->eventLogService->clear(); $this->returnJsonResponse(JsonResponse::JSON_SUCCESS, __u('Registro de eventos vaciado')); } catch (\Exception $e) { processException($e); $this->returnJsonResponseException($e); } } protected function initialize() { $this->eventLogService = $this->dic->get(EventlogService::class); } }