@@ 22-68 (lines=47) @@ | ||
19 | * |
|
20 | * @return Response |
|
21 | */ |
|
22 | public function listAction(Request $request, Application $app) |
|
23 | { |
|
24 | $data = array(); |
|
25 | ||
26 | if ( |
|
27 | !$app['security']->isGranted('ROLE_POSTS_EDITOR') && |
|
28 | !$app['security']->isGranted('ROLE_ADMIN') |
|
29 | ) { |
|
30 | $app->abort(403); |
|
31 | } |
|
32 | ||
33 | $limitPerPage = $request->query->get('limit_per_page', 20); |
|
34 | $currentPage = $request->query->get('page'); |
|
35 | ||
36 | $postResults = $app['orm.em'] |
|
37 | ->createQueryBuilder() |
|
38 | ->select('p') |
|
39 | ->from('Application\Entity\PostEntity', 'p') |
|
40 | ->leftJoin('p.user', 'u') |
|
41 | ; |
|
42 | ||
43 | $pagination = $app['paginator']->paginate( |
|
44 | $postResults, |
|
45 | $currentPage, |
|
46 | $limitPerPage, |
|
47 | array( |
|
48 | 'route' => 'members-area.posts', |
|
49 | 'defaultSortFieldName' => 'p.timeCreated', |
|
50 | 'defaultSortDirection' => 'desc', |
|
51 | 'searchFields' => array( |
|
52 | 'p.title', |
|
53 | 'p.content', |
|
54 | 'u.username', |
|
55 | 'u.email', |
|
56 | ), |
|
57 | ) |
|
58 | ); |
|
59 | ||
60 | $data['pagination'] = $pagination; |
|
61 | ||
62 | return new Response( |
|
63 | $app['twig']->render( |
|
64 | 'contents/members-area/posts/list.html.twig', |
|
65 | $data |
|
66 | ) |
|
67 | ); |
|
68 | } |
|
69 | ||
70 | /** |
|
71 | * @param Request $request |
@@ 22-69 (lines=48) @@ | ||
19 | * |
|
20 | * @return Response |
|
21 | */ |
|
22 | public function listAction(Request $request, Application $app) |
|
23 | { |
|
24 | $data = array(); |
|
25 | ||
26 | if ( |
|
27 | !$app['security']->isGranted('ROLE_USERS_EDITOR') && |
|
28 | !$app['security']->isGranted('ROLE_ADMIN') |
|
29 | ) { |
|
30 | $app->abort(403); |
|
31 | } |
|
32 | ||
33 | $limitPerPage = $request->query->get('limit_per_page', 20); |
|
34 | $currentPage = $request->query->get('page'); |
|
35 | ||
36 | $userResults = $app['orm.em'] |
|
37 | ->createQueryBuilder() |
|
38 | ->select('u') |
|
39 | ->from('Application\Entity\UserEntity', 'u') |
|
40 | ->leftJoin('u.profile', 'p') |
|
41 | ; |
|
42 | ||
43 | $pagination = $app['paginator']->paginate( |
|
44 | $userResults, |
|
45 | $currentPage, |
|
46 | $limitPerPage, |
|
47 | array( |
|
48 | 'route' => 'members-area.users', |
|
49 | 'defaultSortFieldName' => 'u.email', |
|
50 | 'defaultSortDirection' => 'asc', |
|
51 | 'searchFields' => array( |
|
52 | 'u.username', |
|
53 | 'u.email', |
|
54 | 'u.roles', |
|
55 | 'p.firstName', |
|
56 | 'p.lastName', |
|
57 | ), |
|
58 | ) |
|
59 | ); |
|
60 | ||
61 | $data['pagination'] = $pagination; |
|
62 | ||
63 | return new Response( |
|
64 | $app['twig']->render( |
|
65 | 'contents/members-area/users/list.html.twig', |
|
66 | $data |
|
67 | ) |
|
68 | ); |
|
69 | } |
|
70 | ||
71 | /** |
|
72 | * @param Request $request |