bundle/Controller/Admin/AdminController.php
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]);
    }
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]);
    }
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 ] ) ; }
Handles actions performed on collection list page

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

@return \Symfony\Component\HttpFoundation\RedirectResponse
Handles actions performed on collection list page