Conditions | 2 |
Paths | 2 |
Total Lines | 49 |
Code Lines | 35 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
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 | $userActionResults = $app['orm.em'] |
||
30 | ->createQueryBuilder() |
||
31 | ->select('ua') |
||
32 | ->from('Application\Entity\UserActionEntity', 'ua') |
||
33 | ->leftJoin('ua.user', 'u') |
||
34 | ->leftJoin('u.profile', 'p') |
||
35 | ; |
||
36 | |||
37 | $pagination = $app['paginator']->paginate( |
||
38 | $userActionResults, |
||
39 | $currentPage, |
||
40 | $limitPerPage, |
||
41 | array( |
||
42 | 'route' => 'members-area.user-actions', |
||
43 | 'defaultSortFieldName' => 'ua.timeCreated', |
||
44 | 'defaultSortDirection' => 'desc', |
||
45 | 'searchFields' => array( |
||
46 | 'u.username', |
||
47 | 'u.email', |
||
48 | 'p.name', |
||
49 | 'p.firstName', |
||
50 | 'p.middleName', |
||
51 | 'p.lastName', |
||
52 | 'ua.type', |
||
53 | 'ua.key', |
||
54 | 'ua.message', |
||
55 | 'ua.data', |
||
56 | ), |
||
57 | ) |
||
58 | ); |
||
59 | |||
60 | return new Response( |
||
61 | $app['twig']->render( |
||
62 | 'contents/members-area/user-actions/list.html.twig', |
||
63 | array( |
||
64 | 'pagination' => $pagination, |
||
65 | ) |
||
66 | ) |
||
67 | ); |
||
68 | } |
||
69 | } |
||
70 |