| @@ 20-58 (lines=39) @@ | ||
| 17 | * |
|
| 18 | * @return Response |
|
| 19 | */ |
|
| 20 | public function listAction(Request $request, Application $app) |
|
| 21 | { |
|
| 22 | if (!$app['security']->isGranted('ROLE_ADMIN')) { |
|
| 23 | $app->abort(403); |
|
| 24 | } |
|
| 25 | ||
| 26 | $limitPerPage = $request->query->get('limit_per_page', 20); |
|
| 27 | $currentPage = $request->query->get('page'); |
|
| 28 | ||
| 29 | $errorResults = $app['orm.em'] |
|
| 30 | ->createQueryBuilder() |
|
| 31 | ->select('e') |
|
| 32 | ->from('Application\Entity\ErrorEntity', 'e') |
|
| 33 | ; |
|
| 34 | ||
| 35 | $pagination = $app['paginator']->paginate( |
|
| 36 | $errorResults, |
|
| 37 | $currentPage, |
|
| 38 | $limitPerPage, |
|
| 39 | array( |
|
| 40 | 'route' => 'members-area.errors', |
|
| 41 | 'defaultSortFieldName' => 'e.timeCreated', |
|
| 42 | 'defaultSortDirection' => 'desc', |
|
| 43 | 'searchFields' => array( |
|
| 44 | 'e.code', |
|
| 45 | 'e.message', |
|
| 46 | ), |
|
| 47 | ) |
|
| 48 | ); |
|
| 49 | ||
| 50 | return new Response( |
|
| 51 | $app['twig']->render( |
|
| 52 | 'contents/members-area/errors/list.html.twig', |
|
| 53 | array( |
|
| 54 | 'pagination' => $pagination, |
|
| 55 | ) |
|
| 56 | ) |
|
| 57 | ); |
|
| 58 | } |
|
| 59 | } |
|
| 60 | ||
| @@ 260-296 (lines=37) @@ | ||
| 257 | * |
|
| 258 | * @return Response |
|
| 259 | */ |
|
| 260 | public function actionsAction(Request $request, Application $app) |
|
| 261 | { |
|
| 262 | $limitPerPage = $request->query->get('limit_per_page', 20); |
|
| 263 | $currentPage = $request->query->get('page'); |
|
| 264 | ||
| 265 | $userActionResults = $app['orm.em'] |
|
| 266 | ->createQueryBuilder() |
|
| 267 | ->select('ua') |
|
| 268 | ->from('Application\Entity\UserActionEntity', 'ua') |
|
| 269 | ->where('ua.user = ?1') |
|
| 270 | ->setParameter(1, $app['user']) |
|
| 271 | ; |
|
| 272 | ||
| 273 | $pagination = $app['paginator']->paginate( |
|
| 274 | $userActionResults, |
|
| 275 | $currentPage, |
|
| 276 | $limitPerPage, |
|
| 277 | array( |
|
| 278 | 'route' => 'members-area.my.actions', |
|
| 279 | 'defaultSortFieldName' => 'ua.timeCreated', |
|
| 280 | 'defaultSortDirection' => 'desc', |
|
| 281 | 'searchFields' => array( |
|
| 282 | 'ua.key', |
|
| 283 | 'ua.ip', |
|
| 284 | ), |
|
| 285 | ) |
|
| 286 | ); |
|
| 287 | ||
| 288 | return new Response( |
|
| 289 | $app['twig']->render( |
|
| 290 | 'contents/members-area/my/actions.html.twig', |
|
| 291 | array( |
|
| 292 | 'pagination' => $pagination, |
|
| 293 | ) |
|
| 294 | ) |
|
| 295 | ); |
|
| 296 | } |
|
| 297 | } |
|
| 298 | ||