| @@ 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 | ||
| @@ 179-215 (lines=37) @@ | ||
| 176 | * |
|
| 177 | * @return Response |
|
| 178 | */ |
|
| 179 | public function actionsAction(Request $request, Application $app) |
|
| 180 | { |
|
| 181 | $limitPerPage = $request->query->get('limit_per_page', 20); |
|
| 182 | $currentPage = $request->query->get('page'); |
|
| 183 | ||
| 184 | $userActionResults = $app['orm.em'] |
|
| 185 | ->createQueryBuilder() |
|
| 186 | ->select('ua') |
|
| 187 | ->from('Application\Entity\UserActionEntity', 'ua') |
|
| 188 | ->where('ua.user = ?1') |
|
| 189 | ->setParameter(1, $app['user']) |
|
| 190 | ; |
|
| 191 | ||
| 192 | $pagination = $app['paginator']->paginate( |
|
| 193 | $userActionResults, |
|
| 194 | $currentPage, |
|
| 195 | $limitPerPage, |
|
| 196 | array( |
|
| 197 | 'route' => 'members-area.my.actions', |
|
| 198 | 'defaultSortFieldName' => 'ua.timeCreated', |
|
| 199 | 'defaultSortDirection' => 'desc', |
|
| 200 | 'searchFields' => array( |
|
| 201 | 'ua.key', |
|
| 202 | 'ua.ip', |
|
| 203 | ), |
|
| 204 | ) |
|
| 205 | ); |
|
| 206 | ||
| 207 | return new Response( |
|
| 208 | $app['twig']->render( |
|
| 209 | 'contents/members-area/my/actions.html.twig', |
|
| 210 | array( |
|
| 211 | 'pagination' => $pagination, |
|
| 212 | ) |
|
| 213 | ) |
|
| 214 | ); |
|
| 215 | } |
|
| 216 | } |
|
| 217 | ||