container->get('net15.form.forge.reasons.manager')->getAll(); $locale = $this->get('request_stack')->getCurrentRequest()->getLocale(); return $this->render("@FormForge/FormForgeReason/default.html.twig",['ticketReasonList'=>$ticketReasonList,'lang'=>$locale]); } /** * @return \Symfony\Component\HttpFoundation\Response */ public function createAction(){ $locale = $this->get('request_stack')->getCurrentRequest()->getLocale(); /** * @var User $user */ return $this->render('@FormForge/FormForgeReason/view.html.twig',['reason'=>null,'lang'=>$locale]); } /** * @param Request $request * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function validate_createReasonAction(Request $request){ $submittedToken = $request->request->get('_csrf_token'); if($this->isCsrfTokenValid('support_ticket_new_reason',$submittedToken)){ $languages = array(); $languages['fr'] = $request->get('name_fr'); $languages['en'] = $request->get('name_en'); $languages['es'] = $request->get('name_es'); $reason = $this->container->get('net15.form.forge.reasons.manager')->create($languages); return $this->redirectToRoute('form_forge_update_reason',['publicKey'=>$reason->getPublicKey()]); } else { return $this->redirectToRoute('form_forge_new_reason',[]); } } /** * @param string $publicKey * @return \Symfony\Component\HttpFoundation\Response */ public function updateAction(string $publicKey){ $reason = $this->container->get('net15.form.forge.reasons.manager')->getByPublicKey($publicKey); $locale = $this->get('request_stack')->getCurrentRequest()->getLocale(); /** * @var User $user */ return $this->render('@FormForge/FormForgeReason/view.html.twig',['reason'=>$reason, 'lang'=>$locale]); } /** * @param string $publicKey * @return \Symfony\Component\HttpFoundation\Response */ public function editReasonAction(string $publicKey) { $reason = $this->container->get('net15.form.forge.reasons.manager')->getByPublicKey($publicKey); $locale = $this->get('request_stack')->getCurrentRequest()->getLocale(); return $this->render('@FormForge/FormForgeReason/edit.reason.html.twig',['reason'=>$reason, 'lang'=>$locale]); } /** * @param Request $request * @return \Symfony\Component\HttpFoundation\Response */ public function updateReasonAction(Request $request) { $languages = array(); $languages['fr'] = $request->get('name_fr'); $languages['en'] = $request->get('name_en'); $languages['es'] = $request->get('name_es'); $reason = $this->container->get('net15.form.forge.reasons.manager')->updateReason($request->get('publicKey'), $languages); $locale = $this->get('request_stack')->getCurrentRequest()->getLocale(); return $this->render('@FormForge/FormForgeReason/text.name.html.twig', [ 'reason' => $reason, 'lang' => $locale ]); } /** * @param string $publicKey * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function deleteAction(string $publicKey){ $this->get('net15.form.forge.reasons.manager')->delete($publicKey); return $this->redirectToRoute('form_forge_reason_list'); } }