@param Request $request
@param int     $workflowProfileId

@Config\Route("/workflow-profile/form/{workflowProfileId}", name="open_orchestra_workflow_admin_workflow_profile_form")
@Config\Method({"GET", "POST"})

@return Response
178619
public function formAction(Request $request, $workflowProfileId)
    {
        $workflowProfile = $this->get('open_orchestra_model.repository.workflow_profile')->find($workflowProfileId);
        $this->denyAccessUnlessGranted(ContributionActionInterface::EDIT, $workflowProfile);

        $form = $this->createForm('oo_workflow_profile', $workflowProfile, array(
            'action' => $this->generateUrl('open_orchestra_workflow_admin_workflow_profile_form', array(
                'workflowProfileId' => $workflowProfileId,
            )),
            'delete_button' => $this->isGranted(ContributionActionInterface::DELETE, WorkflowProfileInterface::ENTITY_TYPE),
        ));

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

        return $this->renderAdminForm($form);
    }
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);
    }
758138
public function getWorkflow($id)
	{
		if ( ! array_key_exists($id, $this->_w) ) {

			$workflow = null;
			$def =  $this->getWorkflowDefinition($id);

			if ( $def != null ) {
				unset($def[self::KEY_NODES]);
				$def['id'] = $id;
				if ( isset($def[Workflow::PARAM_INITIAL_STATUS_ID])) {
					$ids = $this->parseStatusId($def[Workflow::PARAM_INITIAL_STATUS_ID], $id);
					$def[Workflow::PARAM_INITIAL_STATUS_ID] = implode(self::SEPARATOR_STATUS_NAME, $ids);
				} else {
					throw new WorkflowException('failed to load Workflow '.$id.' : missing initial status id');
				}
				$def['class'] = $this->getClassMapByType(self::TYPE_WORKFLOW);
				$def['source'] = $this;

				$workflow = Yii::createObject($def);
			}
			$this->_w[$id] = $workflow;
		}
		return $this->_w[$id];
	}
673214
public function getProfile()
    {
        $request = new GetAccountProfileRequest([$this->identifier]);
        $response = new GetAccountProfileResponse();
        return $this->client->sendRequest($request, $response);
    }
100215
public function postProfile(Request $request)
    {
        $user = $this->getAuthenticatedUser();

        if ($this->service->update($user->id, $request->all())) {
            return response()->json(compact('user'));
        }

        return response()->json(['error' => 'Could not update user']);
    }
368997
public function profileAction(Request $request)
    {
        $widget = $request->isXmlHttpRequest();

        $form = $this->getUserFormFactory()->createProfileForm()->handleRequest($request);

        if (!$form->isSubmitted()) {
            return new Response($this->getUserFormRenderer()->renderProfileForm($form, $widget));
        }

        $successMessage = 'user.action.profile.success';

        if (!$this->getUserFormHandler()->handleProfileForm($form, !$widget, $successMessage)) {
            $html = $this->getUserFormRenderer()->renderProfileForm($form, $widget);

            return $widget
                ? new AjaxResponse($html, false, FlashNotifierInterface::MESSAGE_FORM_ERROR)
                : new Response($html);
        }

        return $widget
            ? new AjaxResponse($this->getUserFormRenderer()->renderProfileForm($form), true, $successMessage)
            : $this->redirectToRoute('darvin_user_user_profile');
    }
1159572
public function profileAction(Request $request)
    {
        $user = $this->getUser();

        $form = $this->createForm(ProfileType::class, $user);
        $form->handleRequest($request);

        if ($form->isValid()) {

            if ($user->isTwoFactorEnabled() == false) {
                $user->setGoogleAuthenticatorSecret(null);
            }

            $this->get('fos_user.user_manager')->updateUser($user, true);

            if ($user->isTwoFactorEnabled() == true && empty($user->getGoogleAuthenticatorSecret())) {
                return $this->redirectToRoute('opifer_cms_user_activate_2fa');                    
            }

            $this->addFlash('success', 'Your profile was updated successfully!');

            return $this->redirectToRoute('opifer_cms_user_profile');
        }

        return $this->render('OpiferCmsBundle:Backend/User:profile.html.twig', [
            'form' => $form->createView(),
            'user' => $user,
        ]);
    }
554698
function WorkflowFormController($scope, workflowService, workflowFlowService, $stateParams, $q, $timeout) {
  var self = this;
  self.model = false;
  self.submitted = false;

  //If there is no workflow ID, then we are creating a new workflow.
  var workflowPromise = $stateParams.workflowId ? workflowService.read($stateParams.workflowId) : $q.when({
    steps: []
  });

  workflowPromise.then(function(workflow) {
    $timeout(function() {
      self.model = workflow;
    });
  });

  self.done = function(isValid) {
    self.submitted = true;
    if (isValid) {
      var hasId = self.model.id;
      var createUpdatePromise;
      if (hasId) {
        createUpdatePromise = workflowService.update(self.model);
      } else {
        createUpdatePromise = workflowService.create(self.model);
      }
      createUpdatePromise.then(function(workflow) {
        workflowFlowService.goToWorkflowDetails(workflow);
      });
    }
  };

  self.selectWorkflow = function(event, workflow) {
    if (workflow.id) {
      workflowFlowService.goToWorkflowDetails(workflow);
    } else {
      workflowFlowService.goToWorkflowList();
    }
    event.preventDefault();
    event.stopPropagation();
  };
}
519804
public function postRegister(Request $request) {

        if (config('lasallecmsusermanagement.auth_users_registration_front_end_require_terms_of_service')) {
            if (!$request->input('terms-of-service')) {
                return redirect()->route('auth.register')
                    ->withInput($request->only('name', 'email', 'phone_country_code', 'phone_number'))
                    ->withErrors([
                        'terms-of-service' => 'Please read our Terms of Service',
                    ]);
            }
        }

        $response = $this->dispatchFrom(CreateRegisterUserCommand::class, $request);

        Session::flash('status_code', $response['status_code'] );

        if ($response['status_text'] == "validation_failed") {
            Session::flash('message', $response['errorMessages']->first());
            // Return to the edit form with error messages
            return Redirect::back()
                ->withInput($response['data'])
                ->withErrors($response['errorMessages']);
        }

        if ($response['status_text'] == "persist_failed") {
            $message = "Processing error. Please try again.";
            Session::flash('message', $message);
            // Return to the edit form with error messages
            return Redirect::back()
                ->withInput($response['data'])
                ->withErrors($message);
        }

        // User registration was successful


        // Login registrant
        if (config('lasallecmsusermanagement.auth_frontend_registration_successful_auto_login')) {
            $userId = $this->userRepository->findUserIdByEmail($response['data']['email']);
            Auth::loginUsingId($userId);
        }


        // Fire the custom event
        event(new FrontendRegistrationWasSuccessful($response));


        // Display the registration confirmation view, if the config says so
        if (config('auth.auth_display_register_confirmation_view_after_successful_frontend_registration')) {
            return view('usermanagement::frontend.'.$this->frontend_template_name.'.register_confirmed.register_confirmed', [
                'title'          => 'Register Confirmation',
                'username'       => strtoupper($response['data']['name']),
                'isUserLoggedIn' => Auth::check(),
            ]);
        }


        // $name = strtoupper($response['data']['name']);
        $message = 'You successfully registered!';
        Session::flash('message', $message);

        return Redirect::route('home');
    }
191613
public function formAction(Request $request)
    {
        $option = array('action' => $this->generateUrl('open_orchestra_backoffice_internal_link_form'));

        $option["method"] = "POST";
        if ("PATCH" === $request->getMethod()) {
            $option["validation_groups"] = false;
            $option["method"] = "PATCH";
        }
        $form = $this->createForm(
            'oo_internal_link',
            $request->query->all(),
            $option
        );

        $form->handleRequest($request);

        return $this->renderAdminForm($form);
    }
1222463
public function doFrontEndAction(array $data, Form $form, HTTPRequest $request)
    {
        if (!$obj = $this->getContextObject()) {
            throw new Exception(
                _t(
                    'FrontEndWorkflowController.FRONTENDACTION_CONTEXT_EXCEPTION',
                    'Context Object Not Found'
                )
            );
        }

        if (!$this->getCurrentTransition()->canExecute($this->contextObj->getWorkflowInstance())) {
            throw new Exception(
                _t(
                    'FrontEndWorkflowController.FRONTENDACTION_TRANSITION_EXCEPTION',
                    'You do not have permission to execute this action'
                )
            );
        }

        //Only Save data when Transition is 'Active'
        if ($this->getCurrentTransition()->Type == 'Active') {
            //Hand off to WorkflowAction to perform Save
            $svc    = singleton(WorkflowService::class);
            $active = $svc->getWorkflowFor($obj);

            $active->doFrontEndAction($data, $form, $request);
        }

        //run execute on WorkflowInstance instance
        $action = $this->contextObj->getWorkflowInstance()->currentAction();
        $action->BaseAction()->execute($this->contextObj->getWorkflowInstance());

        //get valid transitions
        $transitions = $action->getValidTransitions();

        //tell instance to execute transition if it's in the permitted list
        if ($transitions->find('ID', $this->transitionID)) {
            $this->contextObj->getWorkflowInstance()->performTransition($this->getCurrentTransition());
        }
    }
946969
public function getWorkflowProgressCurrentStatusNum(WorkflowProgress $wp)
    {
        $req = $wp->getWorkflowRequestObject();
        if (is_object($req)) {
            return $req->getWorkflowRequestStatusNum();
        }
    }
564880
public function editAction(Request $request, DataInterface $data, FamilyInterface $family = null)
    {
        $this->initDataFamily($data, $family);
        $form = $this->getForm($request, $data, $family->getFormOptions());

        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            $this->saveEntity($data);

            $parameters = $request->query->all();
            $parameters['success'] = 1;

            return $this->redirectToEntity($data, 'edit', $parameters);
        }

        return $this->renderAction($this->getViewParameters($request, $form, $data));
    }
760647
public function newAction(Request $request)
    {
        $groupClass = $this->getParameter('open_orchestra_user.document.group.class');
        /** @var GroupInterface $group */
        $group = new $groupClass();
        $siteId = $this->get('open_orchestra_backoffice.context_backoffice_manager')->getSiteId();
        $group->setSite($this->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId));

        $this->denyAccessUnlessGranted(ContributionActionInterface::CREATE, $group);

        $form = $this->createForm('oo_group', $group, array(
            'action'   => $this->generateUrl('open_orchestra_group_new'),
            'creation' => true,
            'method'   => 'POST'
        ));

        $form->handleRequest($request);

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

            $this->dispatchEvent(GroupEvents::GROUP_CREATE, new GroupEvent($group));
            $response = new Response(
                '',
                Response::HTTP_CREATED,
                array('Content-type' => 'text/plain; charset=utf-8', 'groupId' => $group->getId(), 'name' => $group->getName())
            );

            return $response;
        }

        return $this->renderAdminForm($form);
    }
1321719
public function formAction(Request $request, $siteId)
    {
        $site = $this->get('open_orchestra_model.repository.site')->findOneBySiteId($siteId);
        $this->denyAccessUnlessGranted(ContributionActionInterface::EDIT, $site);

        if ($site instanceof SiteInterface) {
            $oldAliases = clone $site->getAliases();
            $form = $this->createForm(
                'oo_site',
                $site,
                array(
                    'action' => $this->generateUrl('open_orchestra_backoffice_site_form', array(
                        'siteId' => $siteId,
                    )),
                    'delete_button' => $this->isGranted(ContributionActionInterface::DELETE, $site)
                )
            );

            $form->handleRequest($request);
            $message =  $this->get('translator')->trans('open_orchestra_backoffice.form.website.success');
            if ($this->handleForm($form, $message)) {
                $this->dispatchEvent(SiteEvents::SITE_UPDATE, new SiteEvent($site, $oldAliases));
            }
            $response = $this->renderAdminForm($form);
            $response->headers->set('languages', json_encode($site->getLanguages()));

            return $response;
        }

        return new Response();
    }
1173425
public function activationForm(Request $request): Response
    {
        $form = $this->createActivationForm();
        $form->handleRequest($request);

        if (!$form->isValid()) {
            return $this->render(
                $this->getConfigResolver()->getParameter('template.user.activate', 'ngsite'),
                [
                    'form' => $form->createView(),
                ]
            );
        }

        $users = $this->userService->loadUsersByEmail($form->get('email')->getData());

        $activationRequestEvent = new UserEvents\ActivationRequestEvent(
            $form->get('email')->getData(),
            $users[0] ?? null
        );

        $this->eventDispatcher->dispatch(SiteEvents::USER_ACTIVATION_REQUEST, $activationRequestEvent);

        return $this->render(
            $this->getConfigResolver()->getParameter('template.user.activate_sent', 'ngsite')
        );
    }
123981
public function addWorkflowProfile(GroupFormEvent $event)
    {
        $builder = $event->getBuilder();
        $group = $builder->getData();
        $configuration = array();
        $workflowProfiles = $this->workflowProfileRepository->findAll();
        foreach ($workflowProfiles as $workflowProfile) {
            $configuration['default']['row'][] = $workflowProfile->getLabel($this->contextManager->getBackOfficeLanguage());
        }
        $configuration['default']['column'][NodeInterface::ENTITY_TYPE] = $this->translator->trans('open_orchestra_workflow_admin.profile.page');
        if ($group instanceof GroupInterface) {
            $site = $group->getSite();
            if (!empty($site->getContentTypes())) {
                $contentTypes = $this->contentTypeRepository->findAllNotDeletedInLastVersion($site->getContentTypes());
                foreach ($contentTypes as $contentType) {
                    $configuration['default']['column'][$contentType->getContentTypeId()] = $contentType->getName($this->contextManager->getBackOfficeLanguage());
                }
            }
        }
        $builder->setAttribute('group_render', array_merge($builder->getAttribute('group_render'), array(
            'profile' => array(
                'rank' => '2',
                'label' => 'open_orchestra_workflow_admin.form.profile',
            )
        )));
        $builder->setAttribute('sub_group_render', array_merge($builder->getAttribute('sub_group_render'), array(
            'backoffice' => array(
                'rank' => '0',
                'label' => 'open_orchestra_workflow_admin.form.backoffice',
            )
        )));
        $builder->add('workflow_profile_collections', 'oo_check_list_collection', array(
            'label' => false,
            'configuration' => $configuration,
            'group_id' => 'profile',
            'sub_group_id' => 'backoffice',
            'required' => false
        ));
        $builder->get('workflow_profile_collections')->addModelTransformer($this->workflowProfileCollectionTransformer);
   }