|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace App\Controller;
|
|
|
|
|
|
+use App\Entity\Profile;
|
|
|
use App\Form\UserEditPasswordType;
|
|
|
use App\Form\UserEditType;
|
|
|
use App\Form\UserRegisterType;
|
|
@@ -14,6 +15,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|
|
use Symfony\Component\Routing\Annotation\Route;
|
|
|
use App\Form\UserType;
|
|
|
use App\Entity\User;
|
|
|
+use App\Form\ProfileType;
|
|
|
use App\Repository\UserRepository;
|
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
|
@@ -82,6 +84,27 @@ class SecurityController extends AbstractController
|
|
|
));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @Route("/admin/edituseroptions/{id}", name="admin_edituseroptions")
|
|
|
+ */
|
|
|
+ public function editUseroptions (Request $request, Profile $options, EntityManagerInterface $em)
|
|
|
+ {
|
|
|
+ $form = $this->createForm(ProfileType::class, $options);
|
|
|
+ $form->handleRequest($request);
|
|
|
+ if ($form->isSubmitted() && $form->isValid())
|
|
|
+ {
|
|
|
+ $em->flush();
|
|
|
+ $this->addFlash('success', 'Les options de l\'utilisateur ont bien été modifiées.');
|
|
|
+
|
|
|
+ return $this->redirectToRoute('admin_index');
|
|
|
+ }
|
|
|
+
|
|
|
+ return $this->render('profil/preferences.html.twig', [
|
|
|
+ 'user' => $options->getUser(),
|
|
|
+ 'form' => $form->createView()
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @Route("/admin", name="admin_index")
|
|
|
*/
|