@param Request $request

@Config\Route("/transition/form", name="open_orchestra_workflow_admin_transitions_form")
@Config\Method({"GET", "POST"})

@return Response
164003
public function formAction(Request $request)
    {
        $this->denyAccessUnlessGranted(ContributionActionInterface::EDIT, WorkflowProfile::ENTITY_TYPE);
        $currentLocale = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getBackOfficeLanguage();
        $profiles = $this->get('open_orchestra_model.repository.workflow_profile')
            ->findAllOrderedByLocale($currentLocale);

        $form = $this->createForm('oo_workflow_transitions', $profiles, array(
           'action' => $this->generateUrl('open_orchestra_workflow_admin_transitions_form')
        ));

        $form->handleRequest($request);
        $message = $this->get('translator')->trans('open_orchestra_workflow_admin.form.transitions.success');
        if ($this->handleForm($form, $message)) {
            foreach ($profiles as $profile) {
                $this->dispatchEvent(WorkflowProfileEvents::WORKFLOW_PROFILE_UPDATE, new WorkflowProfileEvent($profile));
            }
        }

        return $this->renderAdminForm($form);
    }
131246
public function deleteRedirectionsAction(Request $request)
    {
        $format = $request->get('_format', 'json');

        $facade = $this->get('jms_serializer')->deserialize(
            $request->getContent(),
            $this->getParameter('open_orchestra_api.facade.redirection_collection.class'),
            $format
        );
        $redirections = $this->get('open_orchestra_api.transformer_manager')->reverseTransform('redirection_collection', $facade);

        $redirectionRepository = $this->get('open_orchestra_model.repository.redirection');
        $redirectionIds = array();
        foreach ($redirections as $redirection) {
            if ($this->isGranted(ContributionActionInterface::DELETE, $redirection)) {
                $redirectionIds[] = $redirection->getId();
                $this->dispatchEvent(RedirectionEvents::REDIRECTION_DELETE, new RedirectionEvent($redirection));
            }
        }

        $redirectionRepository->removeRedirections($redirectionIds);

        return array();
    }
680257
public function listAction(Request $request)
    {
        $this->denyAccessUnlessGranted(ContributionActionInterface::READ, UserInterface::ENTITY_TYPE);
        $mapping = array(
            'username' => 'username',
            'groups' => 'groups.label'
        );
        $configuration = PaginateFinderConfiguration::generateFromRequest($request, $mapping);
        $repository = $this->get('open_orchestra_user.repository.user');
        $language = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getBackOfficeLanguage();

        if ($this->get('security.authorization_checker')->isGranted(ContributionRoleInterface::PLATFORM_ADMIN)) {
            $collection = $repository->findForPaginate($configuration, $language);
            $recordsTotal = $repository->count();
            $recordsFiltered = $repository->countWithFilter($configuration, $language);
        } else {
            $sitesId = $this->getAvailableSiteIds();
            $collection = $repository->findForPaginateFilterBySiteIds($configuration, $language, $sitesId);
            $recordsTotal = $repository->countFilterBySiteIds($sitesId);
            $recordsFiltered = $repository->countWithFilterAndSiteIds($configuration, $language, $sitesId);
        }

        $facade = $this->get('open_orchestra_api.transformer_manager')->transform('user_collection', $collection);
        $facade->recordsTotal = $recordsTotal;
        $facade->recordsFiltered = $recordsFiltered;

        return $facade;
    }
324728
protected function nextStep(Request $request)
    {
        // Apply the current step. If success, we can redirect to next one
        $currentStep = \SetupWizard::currentStep();
        if (!$currentStep->apply($request->all())) {
            return view()->make('setup_wizard::steps.default', ['errors' => $currentStep->getMessageBag()]);
        }

        // If we have a next step, go for it. Else we redirect to somewhere else
        try {
            $nextStep = \SetupWizard::nextStep();

            return redirect()->route('setup_wizard.show', ['slug' => $nextStep->getSlug()]);
        } catch (StepNotFoundException $e) {
            $finalRouteName = config('setup_wizard.routing.success_route', '');
            if (!empty($finalRouteName)) return redirect()->route($finalRouteName);

            $finalRouteUrl = config('setup_wizard.routing.success_url', '');
            if (!empty($finalRouteUrl)) return redirect()->to($finalRouteUrl);

            return redirect('/');
        }
    }
635325
public function postEdit(Request $request)
    {

        $form = FormBuilder::create(get_class($this->form), [
            'model' => $this->model
        ]);

        if ($form->hasError())
        {
            return $form->validateAndRedirectBack();
        }

        $permissions = $request->get('permission');
        $this->model->truncate();


        foreach ($permissions as $role_id=>$permission) {

            foreach ($permission as $service_id) {
                $permModel = new $this->model;
                $permModel->role_id = $role_id;
                $permModel->service_id = $service_id;
                $permModel->save();
            }
        }


        return redirect()->to(action('\\'.get_class($this).'@getIndex'));

    }
445631
public function newAction(Request $request)
    {
        /** @var ContentTypeInterface $contentType */
        $contentType = $this->get('open_orchestra_backoffice.manager.content_type')->initializeNewContentType();

        $action = $this->generateUrl('open_orchestra_backoffice_content_type_new', array());
        $form = $this->createContentTypeForm($request, array(
            'action' => $action,
            'new_button' => true,
            'need_link_to_site_defintion' => true,
        ), $contentType);

        $form->handleRequest($request);
        if ('PATCH' !== $request->getMethod()) {
            if ($form->isValid()) {
                $contentType->setVersion(1);
                $language = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getBackOfficeLanguage();
                $documentManager = $this->get('object_manager');
                $documentManager->persist($contentType);
                $documentManager->flush();
                $message = $this->get('translator')->trans('open_orchestra_backoffice.form.content_type.creation');
                $this->dispatchEvent(ContentTypeEvents::CONTENT_TYPE_CREATE, new ContentTypeEvent($contentType));
                $response = new Response(
                    $message,
                    Response::HTTP_CREATED,
                    array('Content-type' => 'text/plain; charset=utf-8', 'contentTypeId' => $contentType->getContentTypeId(), 'name' => $contentType->getName($language))
                );

                return $response;
            }
        }

        return $this->renderAdminForm($form);
    }
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;
    }
1093775
public function indexAction(Request $request)
    {
        $response = $this->getCacheTimeKeeper()->getResponse('AnimeDbAppBundle:Notice');
        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        $rep = $this->getRepository();
        $change_form = $this->createForm(new ChangeNotice())->handleRequest($request);
        if ($change_form->isValid() && ($notices = $change_form->getData()['notices'])) {
            switch ($change_form->getData()['action']) {
                case ChangeNotice::ACTION_SET_STATUS_SHOWN:
                    $rep->setStatus($notices->toArray(), Notice::STATUS_SHOWN);
                    break;
                case ChangeNotice::ACTION_SET_STATUS_CLOSED:
                    $rep->setStatus($notices->toArray(), Notice::STATUS_CLOSED);
                    break;
                case ChangeNotice::ACTION_REMOVE:
                    $rep->remove($notices->toArray());
            }

            return $this->redirect($this->generateUrl('notice_list'));
        }

        return $this->render('AnimeDbCatalogBundle:Notice:index.html.twig', [
            'has_notices' => $rep->count(),
        ], $response);
    }
736124
public function postAction(Request $request)
    {
        $type = 'page';
        $language = $this->getLanguage($request);
        $action = $request->get('action');

        $this->checkActionParameterSecurity($action, $language);

        $document = $this->getDocumentManager()->create($type);
        $formType = $this->getMetadataFactory()->getMetadataForAlias($type)->getFormType();

        $this->persistDocument($request, $formType, $document, $language);
        $this->handleActionParameter($action, $document, $language);
        $this->getDocumentManager()->flush();

        $context = new Context();
        $context->setGroups(['defaultPage']);

        return $this->handleView($this->view($document)->setContext($context));
    }
751504
public function reloadAction(Request $request)
	{
		$pageId      = $request->get( 'pageId' );
		$formFieldId = $request->get( 'formFieldId' );
		$uniqId      = $request->get( 'uniqId' );
		$code        = $request->get( 'code', 'networking_init_cms.admin.page' );
		$html   = $this->getLayoutBlockFormWidget( $pageId, $formFieldId, $uniqId, $code );
		$status = 200;

		return new Response( $html, $status );
	}
1023836
public function ajaxFormPage(Request $request) {
    $response = new AjaxResponse();

    try {
      $plugin = $this->loadCheckoutFlowPlugin();
    }
    catch (NeedsRedirectException $e) {
      // If someone tries access a step that isn't available yet, they get
      // redirected to the last available step. So catch the exception and tell
      // the Javascript app where to go.
      $response->addCommand(new PaneFormRedirectCommand($e->getRedirectUrl()));
      return $response;
    }

    $form_state = (new FormState())
      ->disableRedirect();
    $form = $this->formBuilder->buildForm($plugin, $form_state);

    if ($form_state->isExecuted()) {
      // Form is saved without errors, so return the url of the next checkout
      // step.
      $next_page = Url::fromRoute('acm_checkout.form', [
        'step' => $plugin->getNextStepId(),
      ])->toString();
      $response->addCommand(new PaneFormSavedCommand($next_page));
    }
    else {
      $output = $this->renderer->renderRoot($form);

      if ($request->request->get('nocssjs') !== 'true') {
        $response->setAttachments($form['#attached']);
      }
      else {
        // Libraries we always want attached.
        $attached = [];
        $attached['library'] = [
          'core/drupal.states',
          'core/drupal.ajax',
        ];
        $attached['drupalSettings'] = $form['#attached']['drupalSettings'];
        $response->setAttachments($attached);
      }

      $response->addCommand(new PaneFormCommand($output));

      $errors = $form_state->getErrors();
      if (count($errors)) {
        $status_messages = [
          '#type' => 'status_messages',
        ];
        $response->addCommand(new PaneFormValidationErrorsCommand($this->renderer->renderRoot($status_messages)));
        $response->addCommand(new PaneFormValidationErrorsFieldsCommand(array_keys($errors)));
      }
    }

    return $response;
  }
844988
public function createAction(Request $request)
    {
        $template = new Template();

        $form = $this->createForm(TemplateType::class, $template);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();

            $em->persist($template);
            $em->flush();

            return $this->redirectToRoute('opifer_cms_template_edit', ['id' => $template->getId()]);
        }

        return $this->render('OpiferCmsBundle:Backend/Template:create.html.twig', [
            'form' => $form->createView(),
        ]);
    }
346550
public function moveAction(Request $request)
    {
        $admin = $this->getAdmin();

        $admin->checkAccess('edit');

        if ($admin->isChild()) {
            $id = $request->query->get('childId');
        } else {
            $id = $request->query->get('id');
        }

        $targetId = $request->query->get('target');
        $dropPosition = $request->query->get('position');

        $em = $this->getDoctrine()->getManager();

        /** @var NestedTreeRepository $repo */
        $repo = $em->getRepository($admin->getClass());

        $currentNode = $repo->find($id);
        $targetNode = $repo->find($targetId);

        switch ($dropPosition) {
            case 'before':
                $currentNode->setParent($targetNode->getParent());

                if ($targetNode->getPosition()) {
                    $currentNode->setPosition($targetNode->getPosition() - 1);
                } else {
                    $currentNode->setPosition(0);
                }
                break;
            case 'after':
                $currentNode->setParent($targetNode->getParent());
                $currentNode->setPosition($targetNode->getPosition() + 1);
                break;
            case 'append':
                $currentNode->setParent($targetNode);
                $currentNode->setPosition(-1);
                break;
        }

        $admin->update($currentNode);
        $admin->update($targetNode);

        return $this->renderJson(['result' => true]);
    }
721541
public function createAction(Request $request)
    {
        $form = $this->buildForm();

        if ($request->isMethod('POST') && $this->submitForm($form, $request)->isValid()) {
            try {
                $this->getDomainManager()->create($form->getData());
            } catch (DomainException $e) {
                $this->processException($e);
            }
        }

        return $this->processAction('create', $form, Response::HTTP_CREATED);
    }
642911
public function newAction(Request $request)
    {
        $statusClass = $this->getParameter('open_orchestra_model.document.status.class');
        /** @var StatusInterface $status */
        $status = new $statusClass();
        $this->denyAccessUnlessGranted(ContributionActionInterface::CREATE, StatusInterface::ENTITY_TYPE);

        $form = $this->createForm('oo_status', $status, array(
            'action' => $this->generateUrl('open_orchestra_workflow_admin_status_new'),
            'method' => 'POST',
            'new_button' => true
        ));

        $form->handleRequest($request);

        if ($form->isValid()) {
            $documentManager = $this->get('object_manager');
            $documentManager->persist($status);
            $documentManager->flush();
            $message = $this->get('translator')->trans('open_orchestra_workflow_admin.form.status.creation');
            $this->get('session')->getFlashBag()->add('success', $message);

            $this->dispatchEvent(StatusEvents::STATUS_CREATE, new StatusEvent($status));
            $response = new Response(
                '',
                Response::HTTP_CREATED,
                array('Content-type' => 'text/html; charset=utf-8', 'statusId' => $status->getId(), 'name' => $status->getLabel($this->get('open_orchestra_backoffice.context_backoffice_manager')->getBackOfficeLanguage()))
            );

            return $response;
        }

        return $this->renderAdminForm($form);
    }
628064
public function newAction(Request $request)
    {
        $keywordClass = $this->container->getParameter('open_orchestra_model.document.keyword.class');
        /** @var KeywordInterface $keyword */
        $keyword = new $keywordClass();
        $this->denyAccessUnlessGranted(ContributionActionInterface::CREATE, KeywordInterface::ENTITY_TYPE);

        $form = $this->createForm('oo_keyword', $keyword, array(
            'action' => $this->generateUrl('open_orchestra_backoffice_keyword_new'),
            'method' => 'POST',
            'new_button' => true
        ));

        $form->handleRequest($request);
        $message = $this->get('translator')->trans('open_orchestra_backoffice.form.keyword.creation');

        if ($this->handleForm($form, $message, $keyword)) {
            $this->dispatchEvent(KeywordEvents::KEYWORD_CREATE, new KeywordEvent($keyword));
            $response = new Response(
                '',
                Response::HTTP_CREATED,
                array('Content-type' => 'text/html; charset=utf-8', 'keywordId' => $keyword->getId(),  'name' => $keyword->getLabel())
            );

            return $response;
        }

        return $this->renderAdminForm($form);
    }
185308
public function post(Request $request)
    {
        $this->authorizeUserAction('create');

        $model = new static::$model;

        $this->restfulService->validateResource($model, $request->input());

        $resource = $this->restfulService->persistResource(new $model($request->input()));

        // Retrieve full model
        $resource = $model::with($model::$localWith)->where($model->getKeyName(), '=', $resource->getKey())->first();

        if ($this->shouldTransform()) {
            $response = $this->response->item($resource, $this->getTransformer())->setStatusCode(201);
        } else {
            $response = $resource;
        }

        return $response;
    }