/** * @Route("/user", name="admin_user") * @Template() */ public function indexAction() { $em = $this->getDoctrine()->getEntityManager(); $filter = $em->getRepository('ClubUserBundle:Filter')->findActive($this->get('security.context')->getToken()->getUser()); $order_by = array(); $repository = $em->getRepository('ClubUserBundle:User'); $usersCount = $repository->getUsersCount($filter); $paginator = new \Club\UserBundle\Helper\Paginator($usersCount, $this->generateUrl('admin_user')); if ('POST' === $this->getRequest()->getMethod() && isset($_POST['filter_order'])) { $order_by = array($_POST['filter_order'] => $_POST['filter_order_Dir']); $sort_direction = $_POST['filter_order_Dir'] == 'asc' ? 'desc' : 'asc'; $this->get('session')->set('lang_list_order_by', $order_by); $this->get('session')->set('lang_list_sort_dir', $sort_direction); } else { if ($this->get('session')->get('admin_user_list_order_by') != null) { $order_by = $this->get('session')->get('admin_user_list_order_by'); } else { $order_by = array('sort_order' => 'asc', 'id' => 'asc'); } if ($this->get('session')->get('admin_user_list_sort_dir') != null) { $sort_direction = $this->get('session')->get('admin_user_list_sort_dir'); } else { $sort_direction = 'desc'; } } $users = $repository->getUsersListWithPagination($filter, $order_by, $paginator->getOffset(), $paginator->getLimit()); return array('users' => $users, 'sort_dir' => $sort_direction, 'paginator' => $paginator); }
/** * @Route("/log", name="admin_log") * @Template() */ public function indexAction() { $em = $this->getDoctrine()->getEntityManager(); $logs_count = $em->getRepository('ClubLogBundle:Log')->getCount(); $paginator = new \Club\UserBundle\Helper\Paginator($logs_count, $this->generateUrl('admin_log')); $logs = $em->getRepository('ClubLogBundle:Log')->getWithPagination($paginator->getOffset(), $paginator->getLimit()); return array('logs' => $logs, 'paginator' => $paginator); }
/** * @Route("/shop/order", name="admin_shop_order") * @Template() */ public function indexAction() { $em = $this->getDoctrine()->getEntityManager(); $count = $em->getRepository('ClubShopBundle:Order')->getCount($this->getFilter()); $paginator = new \Club\UserBundle\Helper\Paginator($count, $this->generateUrl('admin_shop_order')); $orders = $em->getRepository('ClubShopBundle:Order')->getWithPagination($this->getFilter(), null, $paginator->getOffset(), $paginator->getLimit()); return array('orders' => $orders, 'paginator' => $paginator); }
/** * @Route("/account/ledger/{id}") * @Template() */ public function indexAction($id) { $em = $this->getDoctrine()->getEntityManager(); $filter = array('account' => $id); $count = $em->getRepository('ClubAccountBundle:Ledger')->getCount($filter); $paginator = new \Club\UserBundle\Helper\Paginator($count, $this->generateUrl('club_account_adminledger_index', array('id' => $id))); $ledgers = $em->getRepository('ClubAccountBundle:Ledger')->getWithPagination($filter, null, $paginator->getOffset(), $paginator->getLimit()); return array('paginator' => $paginator, 'ledgers' => $ledgers); }