public function getList($page, $actionsRestriction, $logFilterFormType, $workspaceIds = null, $maxResult = -1, $resourceNodeIds = null, $resourceClass = null) { $dateRangeToTextTransformer = new DateRangeToTextTransformer($this->container->get('translator')); $data = $this->processFormData($actionsRestriction, $logFilterFormType, $workspaceIds, $resourceClass, $dateRangeToTextTransformer); $range = $data['range']; $filterForm = $this->container->get('form.factory')->create($logFilterFormType, $data); $data['range'] = $dateRangeToTextTransformer->transform($range); $filter = urlencode(json_encode($data)); //Find if action refers to an resource type $actionData = $this->getResourceTypeFromAction($data['action']); $actionString = $actionData['action']; $resourceType = $actionData['resourceType']; $query = $this->logRepository->findFilteredLogsQuery($actionString, $range, $data['user'], $actionsRestriction, $workspaceIds, $maxResult, $resourceType, $resourceNodeIds); $adapter = new DoctrineORMAdapter($query); $pager = new PagerFanta($adapter); $pager->setMaxPerPage(self::LOG_PER_PAGE); try { $pager->setCurrentPage($page); } catch (NotValidCurrentPageException $e) { throw new NotFoundHttpException(); } $chartData = $this->logRepository->countByDayFilteredLogs($actionString, $range, $data['user'], $actionsRestriction, $workspaceIds, false, $resourceType, $resourceNodeIds); //List item delegation $views = $this->renderLogs($pager->getCurrentPageResults()); return ['pager' => $pager, 'listItemViews' => $views, 'filter' => $filter, 'filterForm' => $filterForm->createView(), 'chartData' => $chartData, 'actionName' => $actionString]; }
public function getDailyActionNumberForDateRange($range = null, $action = null, $unique = false, $workspaceIds = null) { if ($action === null) { $action = ''; } if ($range === null) { $range = $this->getDefaultRange(); } $userSearch = null; $actionRestriction = null; $chartData = $this->logRepository->countByDayFilteredLogs($action, $range, $userSearch, $actionRestriction, $workspaceIds, $unique); return $chartData; }