Handles removing object state groups based on submitted form.

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

@return \Symfony\Component\HttpFoundation\Response
485033
public function bulkDeleteAction(Request $request): Response
    {
        $this->denyAccessUnlessGranted(new Attribute('state', 'administrate'));
        $form = $this->formFactory->deleteObjectStateGroups(
            new ObjectStateGroupsDeleteData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (ObjectStateGroupsDeleteData $data) {
                foreach ($data->getObjectStateGroups() as $objectStateGroupId => $selected) {
                    $objectStateGroup = $this->objectStateService->loadObjectStateGroup($objectStateGroupId);
                    $this->objectStateService->deleteObjectStateGroup($objectStateGroup);

                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Object state group '%name%' deleted.") */
                            'object_state_group.delete.success',
                            ['%name%' => $objectStateGroup->getName()],
                            'object_state'
                        )
                    );
                }
            });

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

        return $this->redirectToRoute('ezplatform.object_state.groups.list');
    }
612352
public function massEdit(Request $request)
    {
        $result;
        switch ($request->action) {
            case 'mass_delete':
                $result = User::whereIn('id',$request->ids)->delete();
                break;
            case 'mass_publish':
                $result = User::whereIn('id',$request->ids)->update(['publish_status'=>Pages::STATUS_PUBLISHED]);
                break;
            case 'mass_hide':
                $result = User::whereIn('id',$request->ids)->update(['publish_status'=>Pages::STATUS_ARCHIVE]);
                break;
        }
        return $result;
    }
799998
public function moveDownAction(Request $request)
    {
        $row = $this->findRowByRequest($request);

        try {
            $sibling = $this->getEditor()->getRowManager()->moveDown($row);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        $container = $row->getContainer();

        $this->validate($container);
        $this->persist($container);

        $data = [
            'rows' => [
                $this->getViewBuilder()->buildRow($row),
                $this->getViewBuilder()->buildRow($sibling),
            ],
        ];

        return $this->buildResponse($data, self::SERIALIZE_LAYOUT);
    }
10083
public function bulkDeleteAction(Request $request, int $objectStateGroupId): Response
    {
        $this->denyAccessUnlessGranted(new Attribute('state', 'administrate'));
        $form = $this->formFactory->create(
            ObjectStatesDeleteType::class,
            new ObjectStatesDeleteData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (ObjectStatesDeleteData $data) {
                foreach ($data->getObjectStates() as $objectStateId => $selected) {
                    $objectState = $this->objectStateService->loadObjectState($objectStateId);
                    $this->objectStateService->deleteObjectState($objectState);

                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Object state '%name%' deleted.") */
                            'object_state.delete.success',
                            ['%name%' => $objectState->getName()],
                            'object_state'
                        )
                    );
                }
            });

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

        return $this->redirectToRoute('ezplatform.object_state.group.view', [
            'objectStateGroupId' => $objectStateGroupId,
        ]);
    }
1187127
public static function clean($request = null)
    {
        switch ($request) {
            case 'post':
                unset($_POST);
            break;

            case 'get':
                unset($_GET);
            break;

            case 'any':
                unset($_REQUEST);
            break;

            default:
                unset($_POST);
                unset($_REQUEST);
                unset($_GET);
        }
    }
1290431
public function deleteAjaxAction( Request $request ) {
		$id          = $request->get( 'id' );
		$pageId      = $request->get( 'pageId' );
		$uniqId      = $request->get( 'uniqId' );
		$code        = $request->get( 'code' );
		$formFieldId = $request->get( 'formFieldId' );

		if ( $id ) {
			$layoutBlock = $this->admin->getObject( $id );
			if ( $layoutBlock ) {
				$this->admin->delete( $layoutBlock );
			}
		}
		$html = $this->getLayoutBlockFormWidget( $pageId, $formFieldId, $uniqId, $code );

		return new JsonResponse( [
			'messageStatus' => 'success',
			'message'       => $this->translate( 'message.layout_block_deleted' ),
			'html'          => $html,
		] );
	}
1220474
public function trashAction(Request $request): Response
    {
        $form = $this->formFactory->trashLocation(
            new LocationTrashData()
        );

        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (LocationTrashData $data) {
                return $this->handleTrashLocationForm($data);
            });

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

        return $this->redirect($this->generateUrl('ezplatform.trash.list'));
    }
877061
public function deleteGroupsAction(Request $request)
    {
        $format = $request->get('_format', 'json');
        $facade = $this->get('jms_serializer')->deserialize(
            $request->getContent(),
            $this->getParameter('open_orchestra_group.facade.group_collection.class'),
            $format
        );
        $groupRepository = $this->get('open_orchestra_user.repository.group');
        $groups = $this->get('open_orchestra_api.transformer_manager')->reverseTransform('group_collection', $facade);

        $filter = $groups;
        array_walk($filter, function(&$item) {$item = $item->getId();});
        $nbrGroupsUsers = $this->get('open_orchestra_user.repository.user')->getCountsUsersByGroups($filter);
        $groupIds = array();
        foreach ($groups as $group) {
            if ($this->isGranted(ContributionActionInterface::DELETE, $group) &&
                $this->get('open_orchestra_backoffice.business_rules_manager')->isGranted(BusinessActionInterface::DELETE, $group, $nbrGroupsUsers)
            ) {
                $groupIds[] = $group->getId();
                $this->dispatchEvent(GroupEvents::GROUP_DELETE, new GroupEvent($group));
            }
        }

        $groupRepository->removeGroups($groupIds);

        return array();
    }
1254740
public function editAction(Request $request)
    {
        $form     = $this->validateRequestParameters($request);
        $resource = $this->mapper->getResource($request->get('id'));

        $this->mapper->populateResourceWithForm($resource, $form);
        $this->mapper->update($resource);

        // returns an empty 200 (OK)
        return new Response();
    }
417491
public function removeAction(Request $request): Response
    {
        $isDraftForm = null !== $request->get(
            sprintf('version-remove-%s', VersionsTab::FORM_REMOVE_DRAFT)
        );

        $formName = $isDraftForm
            ? sprintf('version-remove-%s', VersionsTab::FORM_REMOVE_DRAFT)
            : sprintf('version-remove-%s', VersionsTab::FORM_REMOVE_ARCHIVED);

        $form = $this->formFactory->removeVersion(
            new VersionRemoveData(),
            $formName
        );
        $form->handleRequest($request);

        /** @var ContentInfo $contentInfo */
        $contentInfo = $form->getData()->getContentInfo();
        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (VersionRemoveData $data) {
                $contentInfo = $data->getContentInfo();

                foreach ($data->getVersions() as $versionNo => $selected) {
                    $versionInfo = $this->contentService->loadVersionInfo($contentInfo, $versionNo);
                    $this->contentService->deleteVersion($versionInfo);
                }

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Versions removed from '%name%' content.") */
                        'version.delete.success',
                        ['%name%' => $contentInfo->name],
                        'version'
                    )
                );

                return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
                    'locationId' => $contentInfo->mainLocationId,
                    '_fragment' => VersionsTab::URI_FRAGMENT,
                ]));
            });

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

        return $this->redirect($this->generateUrl('_ezpublishLocation', [
            'locationId' => $contentInfo->mainLocationId,
            '_fragment' => VersionsTab::URI_FRAGMENT,
        ]));
    }
891952
public function repeaterEntriesDelete(Request $request)
    {
        // AUTHORIZE ... COMES HERE
        $status = $this->content->deleteById($request->get('repeater_id'));
        return $status;
    }
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');
    }
404848
public function removeAction(Request $request)
    {
        $row = $this->findRowByRequest($request);
        $container = $row->getContainer();

        try {
            $this->getEditor()->getRowManager()->delete($row);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        // Stores id for front removal
        $removedId = $this->getViewBuilder()->buildRow($row)->getAttributes()->getId();

        $this->validate($container);
        $this->persist($container);

        $data = [
            'removed' => [$removedId],
            //'containers' => [$this->getViewBuilder()->buildContainer($container)],
        ];

        return $this->buildResponse($data, self::SERIALIZE_LAYOUT);
    }
1236538
public function cdeleteAction(Request $request)
    {
        $manager = $this->getTaskManager();

        $ids = array_filter(explode(',', $request->get('ids')));
        foreach ($ids as $id) {
            $manager->remove($id);
        }

        $this->getEntityManager()->flush();

        return $this->handleView($this->view());
    }
1058787
public function removeAction(Request $request): Response
    {
        $form = $this->formFactory->removeBookmark(
            new BookmarkRemoveData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (BookmarkRemoveData $data) {
                foreach ($data->getBookmarks() as $locationId => $selected) {
                    $this->bookmarkService->deleteBookmark(
                        $this->locationService->loadLocation($locationId)
                    );
                }

                return $this->redirectToRoute('ezplatform.bookmark.list');
            });

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

        return $this->redirectToRoute('ezplatform.bookmark.list');
    }
1360905
public function changeTypeAction(Request $request)
    {
        $container = $this->findContainerByRequest($request);

        $type = $request->request->get('type', null);

        $data = [];

        if ($type != $container->getType()) {
            try {
                $removed = $this->getEditor()->getContainerManager()->changeType($container, $type);
            } catch (EditorExceptionInterface $e) {
                return $this->handleException($e);
            }

            if (!empty($removed)) {
                $data['removed'] = $removed;
            }

            $this->validate($container);
            $this->persist($container);
        }

        $data['containers'] = [$this->getViewBuilder()->buildContainer($container)];

        return $this->buildResponse($data, self::SERIALIZE_FULL);
    }
1355954
public function editAction(Request $request)
    {
        $container = $this->findContainerByRequest($request);

        try {
            $response = $this->getEditor()->getContainerManager()->update($container, $request);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        if ($response instanceof Modal) {
            return $this->renderModal($response);
        } elseif ($response instanceof Response) {
            return $response;
        }

        $this->validate($container);
        $this->persist($container);

        $data = [
            'containers' => [$this->getViewBuilder()->buildContainer($container)],
        ];

        return $this->buildResponse($data, self::SERIALIZE_FULL);
    }