/**
  * Update progression of a User.
  *
  * @param User                           $user
  * @param \Innova\PathBundle\Entity\Step $step
  * @param Request                        $request
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  *
  * @Route(
  *     "",
  *     name = "innova_path_progression_update"
  * )
  * @Method("PUT")
  */
 public function updateAction(User $user, Step $step, Request $request)
 {
     $status = $request->get('user_progression_status');
     $authorized = $request->get('user_progression_authorized');
     $progression = $this->userProgressionManager->update($step, $user, $status, $authorized);
     return new JsonResponse(['progression' => $progression]);
 }
 /**
  * Ajax call for unlocking step.
  *
  * @Route(
  *     "unlockstep/{step}/user/{user}",
  *     name="innova_path_unlock_step",
  *     options={"expose"=true}
  * )
  * @Method("GET")
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 public function unlockStep(Step $step, User $user)
 {
     $userIds = [$user->getId()];
     //create an event, and pass parameters
     $event = new LogStepUnlockDoneEvent($step, $userIds);
     //send the event to the event dispatcher
     $this->eventDispatcher->dispatch('log', $event);
     //update lockedcall value : set to true = called
     $progression = $this->userProgressionManager->updateLockedState($user, $step, false, false, true, 'unseen');
     //return response
     return new JsonResponse($progression);
 }
 /**
  * Update progression of a User
  * @param \Innova\PathBundle\Entity\Step $step
  * @param string $status
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  *
  * @Route(
  *     "/step/{id}/{status}/{authorized}",
  *     name         = "innova_path_progression_update",
  *     requirements = {"id" = "\d+"},
  *     options      = { "expose" = true }
  * )
  * @Method("PUT")
  */
 public function updateAction(Step $step, $status, $authorized)
 {
     $progression = $this->userProgressionManager->update($step, null, $status, $authorized);
     return new JsonResponse($progression);
 }
 /**
  * Display path player.
  *
  * @param \Innova\PathBundle\Entity\Path\Path $path
  *
  * @return array
  *
  * @Route(
  *      "/{id}",
  *      name     = "innova_path_player_wizard",
  *      options  = { "expose" = true }
  * )
  * @Template("InnovaPathBundle:Wizard:player.html.twig")
  */
 public function displayAction(Path $path)
 {
     // Check User credentials
     $this->pathManager->checkAccess('OPEN', $path);
     return ['_resource' => $path, 'workspace' => $path->getWorkspace(), 'userProgression' => $this->pathManager->getUserProgression($path), 'editEnabled' => $this->pathManager->isAllow('EDIT', $path), 'totalProgression' => $this->userProgressionManager->calculateUserProgressionInPath($path)];
 }