Handles actions performed on collection list page

@param \Symfony\Component\HttpFoundation\Request $request

@return \Symfony\Component\HttpFoundation\RedirectResponse
191571
public function handleCollectionListAction(Request $request)
    {
        $this->denyAccessUnlessGranted('ez:infocollector:read');

        $contentId = $request->request->get('ContentId');
        $collections = $request->request->get('CollectionId', []);
        $count = count($collections);

        if (empty($collections)) {
            $this->addFlashMessage('errors', 'collections_not_selected');

            return $this->redirectToRoute('netgen_information_collection.route.admin.collection_list', ['contentId' => $contentId]);
        }

        if ($request->request->has('DeleteCollectionAction')) {
            $query = new Query([
                'contentId' => $contentId,
                'collections' => $collections,
            ]);
            $this->service->deleteCollections($query);

            $this->addFlashMessage('success', 'collection_removed', $count);

            return $this->redirectToRoute('netgen_information_collection.route.admin.collection_list', ['contentId' => $contentId]);
        }

        if ($request->request->has('AnonymizeCollectionAction')) {

            foreach ($collections as $collection) {
                $this->anonymizer->anonymizeCollection($collection);
            }

            $this->addFlashMessage('success', 'collection_anonymized', $count);

            return $this->redirectToRoute('netgen_information_collection.route.admin.collection_list', ['contentId' => $contentId]);
        }

        $this->addFlashMessage('error', 'something_went_wrong');

        return $this->redirectToRoute('netgen_information_collection.route.admin.collection_list', ['contentId' => $contentId]);
    }
987930
public function listAction(Request $request)
    {
        $this->denyAccessUnlessGranted(ContributionActionInterface::READ, ContentTypeInterface::ENTITY_TYPE);
        $mapping = array(
            'name' => 'names',
            'content_type_id' => 'contentTypeId',
            'linked_to_site' => 'linkedToSite'
        );
        $configuration = PaginateFinderConfiguration::generateFromRequest($request, $mapping);
        $repository = $this->get('open_orchestra_model.repository.content_type');

        $collection = $repository->findAllNotDeletedInLastVersionForPaginate($configuration);
        $recordsTotal = $repository->countByContentTypeInLastVersion();
        $recordsFiltered = $repository->countNotDeletedInLastVersionWithSearchFilter($configuration);
        $facade = $this->get('open_orchestra_api.transformer_manager')->transform('content_type_collection', $collection);
        $facade->recordsTotal = $recordsTotal;
        $facade->recordsFiltered = $recordsFiltered;

        return $facade;
    }
680775
public function listAction(Request $request)
    {
        $tid = $request->get('tid');
        $language = $request->get('language');
        $version = $request->get('version');
        $incoming = $request->get('incoming', false);

        $treeManager = $this->get('phlexible_tree.tree_manager');
        $elementService = $this->get('phlexible_element.element_service');
        $linkFetcher = $this->get('phlexible_element.link_fetcher');

        $tree = $treeManager->getByNodeId($tid);
        $node = $tree->get($tid);

        $element = $elementService->findElement($node->getTypeId());
        $elementVersion = $elementService->findElementVersion($element, $version);

        return new JsonResponse(['links' => $linkFetcher->fetch($elementVersion, $language, $incoming ? $node : null)]);
    }
942339
public function listAction(Request $request)
    {
        /** @var ConfiguratorFactory $configuratorFactory */
        $configuratorFactory = $this->getConfiguratorFactory($this->getClassName());
        /** @var CrudConfigurator $crudConfigurator */
        $crudConfigurator = $configuratorFactory->getConfigurator(CrudConfigurator::class);

        $this->isGrantedOr404Error($crudConfigurator, Constants::ACTION_READ);

        /** @var GridConfigurator $gridConfigurator */
        $gridConfigurator = $configuratorFactory->getConfigurator(GridConfigurator::class);
        /* @var PageConfigurator $pageConfigurator */
        $pageConfigurator = $configuratorFactory->getConfigurator(PageConfigurator::class);

        $translator = $this->get('translator');
        $translationDomain = $this->getParameter('symfonyid.admin.translation_domain');

        $template = $crudConfigurator->getTemplate();
        $listTemplate = $request->isXmlHttpRequest() ? $template->getAjaxTemplate() : $template->getList();

        $reflectionModel = new \ReflectionClass($crudConfigurator->getCrud()->getModelClass());
        $filters = $gridConfigurator->getFilters($reflectionModel);

        /** @var View $view */
        $view = $this->get('symfonyid.admin.view.view');
        $view->setParam('page_title', $translator->trans($pageConfigurator->getTitle(), array(), $translationDomain));
        $view->setParam('page_description', $translator->trans($pageConfigurator->getDescription(), array(), $translationDomain));

        /*
         * Translate tentity fields
         */
        $view->setParam('filter_fields', implode(', ', array_map(function ($value) use ($translator, $translationDomain) {
            return $translator->trans(sprintf('entity.fields.%s', $value), array(), $translationDomain);
        }, $filters)));
        $view->setParam('filter_fields_entity', implode(', ', $filters));

        return $this->doList($request, $crudConfigurator, $view, $gridConfigurator->getColumns($reflectionModel), $listTemplate, $gridConfigurator->getGrid()->isFormatNumber());
    }
962081
public function dispatch(Request $request)
    {
        // Create the action instance
        $action = $this->resolveAction($request->getHandler());

        return $action->execute($request->getParameters());
    }
287310
public function listAction(Request $request)
    {
        $this->denyAccessUnlessGranted(ContributionActionInterface::READ, KeywordInterface::ENTITY_TYPE);
        $mapping = array(
            'label' => 'label'
        );
        $configuration = PaginateFinderConfiguration::generateFromRequest($request, $mapping);
        $repository = $this->get('open_orchestra_model.repository.keyword');
        $collection = $repository->findForPaginate($configuration);
        $recordsTotal = $repository->count();
        $recordsFiltered = $repository->countWithFilter($configuration);
        $facade = $this->get('open_orchestra_api.transformer_manager')->transform('keyword_collection', $collection);
        $facade->recordsTotal = $recordsTotal;
        $facade->recordsFiltered = $recordsFiltered;

        return $facade;
    }
214392
public function handle(Request $request)
    {
        $response = new Response();
        $response = $this->executePassiveActions($request, $response);
        $response = $this->executeAction($request, $response);

        if ($response->isClientError() || $response->isServerError()) {
            return $this->handleError($request, $response);
        }

        return $response;
    }
342041
public function indexAction(Request $request)
    {
        $this->init($request);

        $nodeAdminListConfigurator = new NodeAdminListConfigurator(
            $this->em,
            $this->aclHelper,
            $this->locale,
            PermissionMap::PERMISSION_VIEW,
            $this->authorizationChecker
        );

        $locale = $this->locale;
        $acl = $this->authorizationChecker;
        $itemRoute = function (EntityInterface $item) use ($locale, $acl) {
            if ($acl->isGranted(PermissionMap::PERMISSION_VIEW, $item->getNode())) {
                return array(
                    'path' => '_slug_preview',
                    'params' => ['_locale' => $locale, 'url' => $item->getUrl()],
                );
            }
        };
        $nodeAdminListConfigurator->addSimpleItemAction('action.preview', $itemRoute, 'eye');
        $nodeAdminListConfigurator->setDomainConfiguration($this->get('kunstmaan_admin.domain_configuration'));
        $nodeAdminListConfigurator->setShowAddHomepage($this->getParameter('kunstmaan_node.show_add_homepage') && $this->isGranted('ROLE_SUPER_ADMIN'));

        /** @var AdminList $adminlist */
        $adminlist = $this->get('kunstmaan_adminlist.factory')->createList($nodeAdminListConfigurator);
        $adminlist->bindRequest($request);

        return array(
            'adminlist' => $adminlist,
        );
    }
769004
public function indexAction(Request $request)
    {
        /** @var RedirectionRepository $errorRepository */
        $redirectionRepository = $this->getDoctrine()->getManager()->getRepository('VictoireSeoBundle:Redirection');

        // Fetch errors

        /** @var QueryBuilder $redirections */
        $redirections = $redirectionRepository->getUnresolvedQuery()->getQuery()->getResult();

        // Build forms

        $forms = [];

        /** @var Redirection[] $redirection */
        foreach ($redirections as $redirection) {
            $forms[$redirection->getId()] = $this->getRedirectionForm($redirection,
                sprintf('#redirection-%d-item-container', $redirection->getId())
            )->createView();
        }

        $newForm = $this->getRedirectionForm(new Redirection(), '#new-redirection-form-container')->createView();

        // Return datas

        return new Response($this->renderView('@VictoireSeo/Redirection/index.html.twig', [
            'newForm'      => $newForm,
            'redirections' => $redirections,
            'forms'        => $forms,
        ]));
    }
948968
public function index(Request $request)
    {
        // handle permission
//        list($request, $filters) = $this->handlePermission(__FUNCTION__, $request);

        // create response model
        $response = new ResponseModel();

        $pageSize = $this->DEFAULT_RESULT_PER_PAGE;

        $pageNumber = 1;

        //set default pagination

        //set page size
        if (!isset($request->toArray()['page']['size'])) {
            $pageSize = $this->DEFAULT_RESULT_PER_PAGE;
        } elseif (($request->get('page')['size']) == 0) {
            $pageSize = $this->DEFAULT_RESULT_PER_PAGE;
        } else {
            $pageSize = $request->get('page')['size'];
        }

        //set page number
        if (!isset($request->get('page')['number'])) {
            $pageNumber = $this->DEFAULT_PAGE_NUMBER;
        } elseif (($request->get('page')['number']) == 0) {
            $pageNumber = $this->DEFAULT_PAGE_NUMBER;
        } else {
            $pageNumber = $request->get('page')['number'];
        }
        $request['page'] = $pageNumber;


        //set default ordering
        if (isset($request->toArray()['order_by'])) {
            if (is_null($request['order_by'])) {
                $request['order_by'] = "{\"field\":\"id\",\"operator\":\"Desc\"}";
            }
        }

        $validationErrors = $this->checkRequestValidation($request, $this->indexValidateArray);
        if ($validationErrors != null) {
            if (env('APP_DEBUG', false)) {
                $response->setData(collect($validationErrors->toArray()));
            }
            $response->setMessage($this->getTrans(__FUNCTION__, 'validation_failed'));
            $response->setStatus(false);
            $response->setError(99);
            return SmartResponse::response($response);
        }

        try {
            $data = $request->get('query') != null ?
                $this->model
                    ->whereKey(collect($this->model
                        ->search(($request->get('query')))
                        ->raw())->get('ids')) :
                $this->model;

            if (array_key_exists('file', $request->toArray())) {
                //TODO add relation on top if here and create a tree flatter array in array helper
                //return (new ExcelHelper())->setOptions([
                //    'store_format' => $request->get('file') == null ? 'xls' : $request->get('file'),
                //    'download_format' => $request->get('file') == null ? 'xls' : $request->get('file'),
                //])->table($data->get()->toArray())->createExcelFile()->download();
            }

            // load relations
            if (count($this->indexLoad) > 0) {
                $data = $data->with($this->indexLoad);
            }

            // filters by
            if (!is_null($request->get('filters'))) {
                $data = (new QueryHelper())->deepFilter($data, (new RequestHelper())->getCollectFromJson($request['filters']));
            }

            // order by
            if (!is_null($request->get('order_by'))) {
                $data = (new QueryHelper())->orderBy($data, (new RequestHelper())->getCollectFromJson($request['order_by']));
            }

            // return response
            $response->setData(collect($data->paginate($pageSize)));
            $response->setMessage($this->getTrans('index', 'successful'));
            return SmartResponse::response($response);

        } catch (QueryException $exception) {

            // return response
            $response->setData(collect($exception->getMessage()));
            $response->setError($exception->getCode());
            $response->setMessage($this->getTrans('index', 'failed'));
            $response->setStatus(false);
            return SmartResponse::response($response);
        }
    }
514595
public function deleteAction(Request $request)
    {
        $treeIds = $request->get('id');
        if (!is_array($treeIds)) {
            $treeIds = [$treeIds];
        }

        $treeManager = $this->get('phlexible_tree.tree_manager');

        foreach ($treeIds as $treeId) {
            $tree = $treeManager->getByNodeId($treeId);
            $node = $tree->get($treeId);

            $tree->delete($node, $this->getUser()->getId());
        }

        return new ResultResponse(true, 'Item(s) deleted');
    }
964456
public function cgetAction(Request $request)
    {
        // required parameter
        $locale = $this->getRequestParameter($request, 'locale', true);
        $entityClass = $this->getRequestParameter($request, 'entityClass', true);
        $entityId = $this->getRequestParameter($request, 'entityId', true);

        // optional parameter
        $history = $this->getBooleanRequestParameter($request, 'history', false, false);

        $routes = $this->findRoutes($history, $entityClass, $entityId, $locale);

        return $this->handleView($this->view(new CollectionRepresentation($routes, 'routes')));
    }
6407
public function cgetAction(Request $request)
    {
        $list = new CollectionRepresentation(
            $this->getManager()->findAll($this->getLocale($request)),
            self::$entityKey
        );

        $view = $this->view($list);

        return $this->handleView($view);
    }
123997
public function handle(Request $request): Response
    {
        try {
            $matcher = $this->getUrlMatcher($request);

            $parameters = $matcher->match($request->getPathInfo());

            if (empty($parameters['_controller'])) {
                throw new InvalidRouteException('Route requires a _controller callable');
            }

            if (!\is_callable($parameters['_controller'])) {
                throw new InvalidRouteException('_controller must be a callable');
            }

            $callback = $parameters['_controller'];

            $result = call_user_func_array($callback, $this->getControllerParameters($request, $parameters));

            if (!$result instanceof Response) {
                throw new InvalidResponseException('Response must be an instance of \Symfony\Component\HttpFoundation\Response');
            }
        } catch (\Exception $e) {
            $result = $this->handleException($request, $e);
        }

        return $result;
    }
587968
protected function handle(Request $request)
    {
        try {
            list($routeInformation, $parameters) = $this->findRoute($request);

            return (new Pipeline($this->container))
                ->through($routeInformation['middlewares'])
                ->send($request)
                ->then(function (Request $request) use ($routeInformation, $parameters) {
                    if ($routeInformation['action'] instanceof Closure) {
                        return call_user_func_array($routeInformation['action'], $parameters);
                    }

                    list($controller, $action) = $routeInformation['action'];
                    $controllerInstance = new $controller;

                    if ($controllerInstance instanceof KeeperBaseController) {
                        $controllerInstance->setContainer($this->container);
                        $controllerInstance->setRequest($request);
                    }

                    return call_user_func_array([$controllerInstance, $action], $parameters);
                });

        } catch (Throwable $exception) {
            if ($this->exceptionHandler) {
                return $this->exceptionHandler->handle($exception, $request);
            }

            return new Response((string)$exception, 500);
        }
    }
1187921
public function removeAction(Request $request): Response
    {
        $form = $this->formFactory->removeCustomUrl();
        $form->handleRequest($request);

        $location = $form->getData()->getLocation();

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (CustomUrlRemoveData $data) {
                $aliasToRemoveList = [];
                foreach ($data->getUrlAliases() as $customUrlId => $selected) {
                    $aliasToRemoveList[] = $this->urlAliasService->load($customUrlId);
                }
                $this->urlAliasService->removeAliases($aliasToRemoveList);

                return $this->redirectToLocation($data->getLocation(), UrlsTab::URI_FRAGMENT);
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        if ($location) {
            return $this->redirectToLocation($location, UrlsTab::URI_FRAGMENT);
        }

        return $this->redirectToRoute('ezplatform.dashboard');
    }
407196
public function listAction(Request $request)
    {
        return $this->render('SynapsePageBundle:Admin/Page:list.html.twig', array(
            'pages' => $this->container->get('synapse.page.loader')->retrieveAll(),
            'page_rendering_route' => $this->container->getParameter('synapse.page.rendering_route'),
        ));
    }