/** * * @Route("/{next_page}", name = "home", defaults = {"next_page" = 1}) * * @return */ public function homeAction(Request $request, $next_page) { $category_manager = $this->get("app.mm_electric_category_manager"); $category_manager->Init($this); $content_by = $category_manager->getContentXCategory(); $pag = new Paginate($content_by["projects"], 9, $next_page); $content_by["projects"] = $pag->setPagination(); $form = $this->quoteProssesing($request); return $this->render('mmelectric/pg-views/pg-main.html.twig', array('category' => $content_by, 'form' => $form->createView())); }
/** * @Route("/wms/management/show/{table}/{column}/{value}/{next_page}/{items_x_page}" , name = "show_table" , defaults = {"next_page" = 1, "items_x_page" = 10, "column" = "all", "value" = "values"}) */ public function showEntityItemsAction(Request $request, $table, $column, $value, $next_page, $items_x_page) { $this->denyAccessUnlessGranted(array("ROLE_ADMIN", "ROLE_USER"), NULL, "Sorry, not enough privileges to access."); if (!$this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) { throw $this->createAccessDeniedException("Sorry, You must login with a valid username to reach this address"); } $className = "WebManagementBundle\\Entity\\" . substr($table, 3); //Getting the class name from the view and creating the related model Name $entity_obj = new $className($this); //Creating object of the related model class $common_query = $this->get('app.common_queries'); // getting the common queries service $table_columns = $entity_obj->getfilterColumns(); $column_values_arr = array(); $column_param = NULL; $value_param = NULL; if ($column != "all") { $column_values_query = $common_query->getColumnValuesFromTable($this, $table, $column); foreach ($column_values_query as $column_values) { foreach ($column_values as $key => $val) { $column_values_arr[] = $val; } } $column_values_arr = array_unique($column_values_arr); if ($value != 'values') { $column_param = preg_replace("/_id/", "", $column); $value_param = $value; } } $items_list = $entity_obj->showList($column_param, $value_param); $pag = new Paginate($items_list, $items_x_page, $next_page); $pagination_obj = $pag->setPagination(); $dependencies_arr = $this->getDBDependencies($table); return $this->render('webmanager/pg-views/pg_main-back-end-list.html.twig', array('tb_columns' => $table_columns, 'selected_col' => $column, 'selected_val' => $value, 'column_values' => $column_values_arr, 'pagination_obj' => $pagination_obj, "active_table" => $table, 'tb_dependencies_arr' => $dependencies_arr[$table])); }