/** * @Route("/ajax-list", name="admin_app_text_ajax_list") */ public function ajaxListAction(Request $request) { $routes = $this->dataRoutes()->link('info_link', $this->crudInfo->getInfoPage(), ['id' => '::id'])->link('edit_link', $this->crudInfo->getEditPage(), ['id' => '::id'])->link('remove_link', $this->crudInfo->getRemovePage(), ['id' => '::id']); $repository = $this->get(self::REPOSITORY_NAME); $dataTable = $repository->createDataTable(); $dataTable->process($request); return new JsonResponse($routes->process($repository->listData($dataTable))); }
/** * @Route("/ajax-list", name="project_course_ajax_list") */ public function ajaxListAction(Request $request) { $routes = $this->dataRoutes()->link('info_link', $this->crudInfo->getInfoPage(), ['id' => '::id', 'slug' => $this->getSlug()])->link('edit_link', $this->crudInfo->getEditPage(), ['id' => '::id', 'slug' => $this->getSlug()])->link('remove_link', $this->crudInfo->getRemovePage(), ['id' => '::id', 'slug' => $this->getSlug()]); $repository = $this->crudInfo->getRepository(); $dataTable = $repository->createDataTable(); $dataTable->process($request); return new JsonResponse($routes->process($repository->listData($dataTable, $this->get('cantiga.time')))); }
/** * @Route("/ajax-list", name="project_area_ajax_list") */ public function ajaxListAction(Request $request) { $filter = $this->get(self::FILTER_NAME); $filter->setTargetProject($this->getActiveProject()); $filterForm = $filter->createForm($this->createFormBuilder($filter)); $filterForm->handleRequest($request); $routes = $this->dataRoutes()->link('info_link', $this->crudInfo->getInfoPage(), ['id' => '::id', 'slug' => $this->getSlug()])->link('edit_link', $this->crudInfo->getEditPage(), ['id' => '::id', 'slug' => $this->getSlug()]); $repository = $this->get(self::REPOSITORY_NAME); $dataTable = $repository->createDataTable(); $dataTable->filter($filter); $dataTable->process($request); return new JsonResponse($routes->process($repository->listData($dataTable, $this->getTranslator()))); }
/** * @Route("/{id}/edit", name="user_area_request_edit") */ public function editAction($id, Request $request) { try { $repository = $this->get(self::REPOSITORY_NAME); $item = $repository->getItem($id); $settings = $this->getProjectSettings(); $settings->setProject($item->getProject()); $formModel = $this->getExtensionPoints()->getImplementation(CoreExtensions::AREA_REQUEST_FORM, $item->getProject()->createExtensionPointFilter()->fromSettings($settings, CoreSettings::AREA_REQUEST_FORM)); $this->territoryRepository->setProject($item->getProject()); $form = $this->createForm(UserAreaRequestForm::class, $item, ['action' => $this->generateUrl($this->crudInfo->getEditPage(), ['id' => $id]), 'customFormModel' => $formModel, 'projectSettings' => $settings, 'territoryRepository' => $this->territoryRepository]); $form->handleRequest($request); if ($form->isValid()) { $repository->update($item); return $this->showPageWithMessage($this->trans('The area request has been updated.'), $this->crudInfo->getInfoPage(), ['id' => $item->getId()]); } $this->breadcrumbs()->link($item->getName(), $this->crudInfo->getInfoPage(), ['id' => $id]); $this->breadcrumbs()->link($this->trans('Edit', [], 'pages'), $this->crudInfo->getEditPage(), ['id' => $id]); return $this->render($this->crudInfo->getTemplateLocation() . 'edit.html.twig', array('item' => $item, 'pageTitle' => $this->crudInfo->getPageTitle(), 'pageSubtitle' => $this->crudInfo->getPageSubtitle(), 'form' => $form->createView(), 'formRenderer' => $formModel->createFormRenderer(), 'project' => $item->getProject())); } catch (ModelException $ex) { return $this->showPageWithError($this->trans($ex->getMessage()), $this->crudInfo->getIndexPage()); } }