@@ -8,14 +8,14 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageController extends AbstractController |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * @Route("/contents", name="ribsadmin_contents") |
|
| 13 | - * @return Response |
|
| 14 | - */ |
|
| 15 | - public function index(): Response |
|
| 16 | - { |
|
| 17 | - $navigation = $this->getDoctrine()->getManager()->getRepository("RibsAdminBundle:Navigation")->findAllNavigationPage(); |
|
| 11 | + /** |
|
| 12 | + * @Route("/contents", name="ribsadmin_contents") |
|
| 13 | + * @return Response |
|
| 14 | + */ |
|
| 15 | + public function index(): Response |
|
| 16 | + { |
|
| 17 | + $navigation = $this->getDoctrine()->getManager()->getRepository("RibsAdminBundle:Navigation")->findAllNavigationPage(); |
|
| 18 | 18 | |
| 19 | - return $this->render('@RibsAdmin/page/index.html.twig', ["navigation" => $navigation]); |
|
| 20 | - } |
|
| 19 | + return $this->render('@RibsAdmin/page/index.html.twig', ["navigation" => $navigation]); |
|
| 20 | + } |
|
| 21 | 21 | } |
@@ -12,126 +12,126 @@ |
||
| 12 | 12 | |
| 13 | 13 | class AccountsController extends AbstractController |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * @Route("/accounts/", name="ribsadmin_accounts") |
|
| 17 | - * @return Response |
|
| 18 | - */ |
|
| 19 | - public function list(): Response |
|
| 20 | - { |
|
| 21 | - $em = $this->getDoctrine()->getManager(); |
|
| 22 | - $current_account = $this->getUser()->getUser(); |
|
| 23 | - |
|
| 24 | - $users = $em->getRepository("RibsAdminBundle:Account")->findAllUserArchived($current_account); |
|
| 25 | - $users_archived = $em->getRepository("RibsAdminBundle:Account")->findAllUserArchived($current_account, true); |
|
| 26 | - |
|
| 27 | - return $this->render('@RibsAdmin/accounts/list.html.twig', [ |
|
| 28 | - "users" => $users, |
|
| 29 | - "users_archived" => $users_archived |
|
| 30 | - ]); |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * @Route("/accounts/create/", name="ribsadmin_accounts_create") |
|
| 35 | - * @Route("/accounts/edit/{guid}", name="ribsadmin_accounts_edit") |
|
| 36 | - * @param Request $request |
|
| 37 | - * @param string|null $guid |
|
| 38 | - * @return Response |
|
| 39 | - */ |
|
| 40 | - public function edit(Request $request, string $guid = null): Response |
|
| 41 | - { |
|
| 42 | - $em = $this->getDoctrine()->getManager(); |
|
| 43 | - |
|
| 44 | - if ($guid === null) { |
|
| 45 | - $account = new Account(); |
|
| 46 | - $old_password = null; |
|
| 47 | - $user = null; |
|
| 48 | - } else { |
|
| 49 | - $user = $em->getRepository(User::class)->findOneBy(["guid" => $guid]); |
|
| 50 | - $account = $em->getRepository(Account::class)->findOneBy(["user" => $user->getId()]); |
|
| 51 | - $old_password = $account->getPassword(); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - $form = $this->createForm("PiouPiou\RibsAdminBundle\Form\Account", $account); |
|
| 55 | - |
|
| 56 | - $form->handleRequest($request); |
|
| 57 | - |
|
| 58 | - if ($form->isSubmitted() && $form->isValid()) { |
|
| 59 | - /** |
|
| 60 | - * @var Account |
|
| 61 | - */ |
|
| 62 | - $data = $form->getData(); |
|
| 63 | - |
|
| 64 | - $account_exist = $em->getRepository(Account::class)->findOneBy(["username" => $data->getUsername()]); |
|
| 65 | - |
|
| 66 | - if ($account_exist && $account_exist === $account) { |
|
| 67 | - $account_exist = null; |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - if (!$account_exist) { |
|
| 71 | - if ($guid === null) { |
|
| 72 | - $temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData()); |
|
| 73 | - $data->setPassword($temp_password); |
|
| 74 | - } else if ($form->get("password")->getData()) { |
|
| 75 | - $temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData()); |
|
| 76 | - $data->setPassword($temp_password); |
|
| 77 | - } else { |
|
| 78 | - $data->setPassword($old_password); |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - $em->persist($data); |
|
| 82 | - $em->flush(); |
|
| 83 | - |
|
| 84 | - $username = $data->getUser()->getFirstName() . " " . $data->getUser()->getLastName(); |
|
| 85 | - |
|
| 86 | - if ($guid === null) { |
|
| 87 | - $this->addFlash("success-flash", "the account of " . $username . " was created"); |
|
| 88 | - } else { |
|
| 89 | - $this->addFlash("success-flash", "the account of " . $username . " was edited"); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - return $this->redirectToRoute("ribsadmin_accounts"); |
|
| 93 | - } else { |
|
| 94 | - $this->addFlash("error-flash", "An account with username " . $data->getUsername() . " already exist"); |
|
| 95 | - return $this->redirectToRoute($request->get("_route"), ["guid" => $guid]); |
|
| 96 | - } |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - return $this->render("@RibsAdmin/accounts/edit.html.twig", [ |
|
| 100 | - "form" => $form->createView(), |
|
| 101 | - "form_errors" => $form->getErrors(), |
|
| 102 | - "user" => $user |
|
| 103 | - ]); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * method to disable or enable a user |
|
| 108 | - * @Route("/accounts/archive/{guid}/{activate}", name="ribsadmin_accounts_archive") |
|
| 109 | - * @param string $guid |
|
| 110 | - * @param bool $activate |
|
| 111 | - * @return RedirectResponse |
|
| 112 | - */ |
|
| 113 | - public function archive(string $guid, bool $activate = false): RedirectResponse |
|
| 114 | - { |
|
| 115 | - $em = $this->getDoctrine()->getManager(); |
|
| 116 | - |
|
| 117 | - $user = $em->getRepository("RibsAdminBundle:User")->findOneBy(["guid" => $guid]); |
|
| 118 | - |
|
| 119 | - if ($user) { |
|
| 120 | - if ($activate === true) { |
|
| 121 | - $user->setArchived(false); |
|
| 122 | - $word = "activated"; |
|
| 123 | - } else { |
|
| 124 | - $user->setArchived(true); |
|
| 125 | - $word = "disabled"; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - $em->persist($user); |
|
| 129 | - $em->flush(); |
|
| 130 | - |
|
| 131 | - $this->addFlash("success-flash", "The user " . $user->getFirstname() . " " . $user->getLastname() . |
|
| 132 | - " was " . $word . " sucessfuly"); |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - return $this->redirectToRoute("ribsadmin_accounts"); |
|
| 136 | - } |
|
| 15 | + /** |
|
| 16 | + * @Route("/accounts/", name="ribsadmin_accounts") |
|
| 17 | + * @return Response |
|
| 18 | + */ |
|
| 19 | + public function list(): Response |
|
| 20 | + { |
|
| 21 | + $em = $this->getDoctrine()->getManager(); |
|
| 22 | + $current_account = $this->getUser()->getUser(); |
|
| 23 | + |
|
| 24 | + $users = $em->getRepository("RibsAdminBundle:Account")->findAllUserArchived($current_account); |
|
| 25 | + $users_archived = $em->getRepository("RibsAdminBundle:Account")->findAllUserArchived($current_account, true); |
|
| 26 | + |
|
| 27 | + return $this->render('@RibsAdmin/accounts/list.html.twig', [ |
|
| 28 | + "users" => $users, |
|
| 29 | + "users_archived" => $users_archived |
|
| 30 | + ]); |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * @Route("/accounts/create/", name="ribsadmin_accounts_create") |
|
| 35 | + * @Route("/accounts/edit/{guid}", name="ribsadmin_accounts_edit") |
|
| 36 | + * @param Request $request |
|
| 37 | + * @param string|null $guid |
|
| 38 | + * @return Response |
|
| 39 | + */ |
|
| 40 | + public function edit(Request $request, string $guid = null): Response |
|
| 41 | + { |
|
| 42 | + $em = $this->getDoctrine()->getManager(); |
|
| 43 | + |
|
| 44 | + if ($guid === null) { |
|
| 45 | + $account = new Account(); |
|
| 46 | + $old_password = null; |
|
| 47 | + $user = null; |
|
| 48 | + } else { |
|
| 49 | + $user = $em->getRepository(User::class)->findOneBy(["guid" => $guid]); |
|
| 50 | + $account = $em->getRepository(Account::class)->findOneBy(["user" => $user->getId()]); |
|
| 51 | + $old_password = $account->getPassword(); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + $form = $this->createForm("PiouPiou\RibsAdminBundle\Form\Account", $account); |
|
| 55 | + |
|
| 56 | + $form->handleRequest($request); |
|
| 57 | + |
|
| 58 | + if ($form->isSubmitted() && $form->isValid()) { |
|
| 59 | + /** |
|
| 60 | + * @var Account |
|
| 61 | + */ |
|
| 62 | + $data = $form->getData(); |
|
| 63 | + |
|
| 64 | + $account_exist = $em->getRepository(Account::class)->findOneBy(["username" => $data->getUsername()]); |
|
| 65 | + |
|
| 66 | + if ($account_exist && $account_exist === $account) { |
|
| 67 | + $account_exist = null; |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + if (!$account_exist) { |
|
| 71 | + if ($guid === null) { |
|
| 72 | + $temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData()); |
|
| 73 | + $data->setPassword($temp_password); |
|
| 74 | + } else if ($form->get("password")->getData()) { |
|
| 75 | + $temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData()); |
|
| 76 | + $data->setPassword($temp_password); |
|
| 77 | + } else { |
|
| 78 | + $data->setPassword($old_password); |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + $em->persist($data); |
|
| 82 | + $em->flush(); |
|
| 83 | + |
|
| 84 | + $username = $data->getUser()->getFirstName() . " " . $data->getUser()->getLastName(); |
|
| 85 | + |
|
| 86 | + if ($guid === null) { |
|
| 87 | + $this->addFlash("success-flash", "the account of " . $username . " was created"); |
|
| 88 | + } else { |
|
| 89 | + $this->addFlash("success-flash", "the account of " . $username . " was edited"); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + return $this->redirectToRoute("ribsadmin_accounts"); |
|
| 93 | + } else { |
|
| 94 | + $this->addFlash("error-flash", "An account with username " . $data->getUsername() . " already exist"); |
|
| 95 | + return $this->redirectToRoute($request->get("_route"), ["guid" => $guid]); |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + return $this->render("@RibsAdmin/accounts/edit.html.twig", [ |
|
| 100 | + "form" => $form->createView(), |
|
| 101 | + "form_errors" => $form->getErrors(), |
|
| 102 | + "user" => $user |
|
| 103 | + ]); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * method to disable or enable a user |
|
| 108 | + * @Route("/accounts/archive/{guid}/{activate}", name="ribsadmin_accounts_archive") |
|
| 109 | + * @param string $guid |
|
| 110 | + * @param bool $activate |
|
| 111 | + * @return RedirectResponse |
|
| 112 | + */ |
|
| 113 | + public function archive(string $guid, bool $activate = false): RedirectResponse |
|
| 114 | + { |
|
| 115 | + $em = $this->getDoctrine()->getManager(); |
|
| 116 | + |
|
| 117 | + $user = $em->getRepository("RibsAdminBundle:User")->findOneBy(["guid" => $guid]); |
|
| 118 | + |
|
| 119 | + if ($user) { |
|
| 120 | + if ($activate === true) { |
|
| 121 | + $user->setArchived(false); |
|
| 122 | + $word = "activated"; |
|
| 123 | + } else { |
|
| 124 | + $user->setArchived(true); |
|
| 125 | + $word = "disabled"; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + $em->persist($user); |
|
| 129 | + $em->flush(); |
|
| 130 | + |
|
| 131 | + $this->addFlash("success-flash", "The user " . $user->getFirstname() . " " . $user->getLastname() . |
|
| 132 | + " was " . $word . " sucessfuly"); |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + return $this->redirectToRoute("ribsadmin_accounts"); |
|
| 136 | + } |
|
| 137 | 137 | } |
@@ -11,79 +11,79 @@ |
||
| 11 | 11 | |
| 12 | 12 | class ModuleController extends AbstractController |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * @Route("/modules/", name="ribsadmin_modules") |
|
| 16 | - * @return Response |
|
| 17 | - */ |
|
| 18 | - public function list(): Response |
|
| 19 | - { |
|
| 20 | - $em = $this->getDoctrine()->getManager(); |
|
| 14 | + /** |
|
| 15 | + * @Route("/modules/", name="ribsadmin_modules") |
|
| 16 | + * @return Response |
|
| 17 | + */ |
|
| 18 | + public function list(): Response |
|
| 19 | + { |
|
| 20 | + $em = $this->getDoctrine()->getManager(); |
|
| 21 | 21 | |
| 22 | - $modules = $em->getRepository(Module::class)->findBy([], ['titleTag' => 'ASC']); |
|
| 22 | + $modules = $em->getRepository(Module::class)->findBy([], ['titleTag' => 'ASC']); |
|
| 23 | 23 | |
| 24 | - return $this->render('@RibsAdmin/modules/list.html.twig', [ |
|
| 25 | - "modules" => $modules, |
|
| 26 | - ]); |
|
| 27 | - } |
|
| 24 | + return $this->render('@RibsAdmin/modules/list.html.twig', [ |
|
| 25 | + "modules" => $modules, |
|
| 26 | + ]); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @Route("/modules/create/", name="ribsadmin_modules_create") |
|
| 31 | - * @Route("/modules/edit/{id}", name="ribsadmin_modules_edit") |
|
| 32 | - * @param Request $request |
|
| 33 | - * @param int|null $id |
|
| 34 | - * @return Response |
|
| 35 | - */ |
|
| 36 | - public function edit(Request $request, int $id = null): Response |
|
| 37 | - { |
|
| 38 | - $em = $this->getDoctrine()->getManager(); |
|
| 29 | + /** |
|
| 30 | + * @Route("/modules/create/", name="ribsadmin_modules_create") |
|
| 31 | + * @Route("/modules/edit/{id}", name="ribsadmin_modules_edit") |
|
| 32 | + * @param Request $request |
|
| 33 | + * @param int|null $id |
|
| 34 | + * @return Response |
|
| 35 | + */ |
|
| 36 | + public function edit(Request $request, int $id = null): Response |
|
| 37 | + { |
|
| 38 | + $em = $this->getDoctrine()->getManager(); |
|
| 39 | 39 | |
| 40 | - if (!$id) { |
|
| 41 | - $module = new Module(); |
|
| 42 | - $text = "created"; |
|
| 43 | - } else { |
|
| 44 | - $module = $em->getRepository(Module::class)->findOneBy(["id" => $id]); |
|
| 45 | - $text = "edited"; |
|
| 46 | - } |
|
| 40 | + if (!$id) { |
|
| 41 | + $module = new Module(); |
|
| 42 | + $text = "created"; |
|
| 43 | + } else { |
|
| 44 | + $module = $em->getRepository(Module::class)->findOneBy(["id" => $id]); |
|
| 45 | + $text = "edited"; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - $form = $this->createForm(\PiouPiou\RibsAdminBundle\Form\Module::class, $module); |
|
| 49 | - $form->handleRequest($request); |
|
| 48 | + $form = $this->createForm(\PiouPiou\RibsAdminBundle\Form\Module::class, $module); |
|
| 49 | + $form->handleRequest($request); |
|
| 50 | 50 | |
| 51 | - if ($form->isSubmitted() && $form->isValid()) { |
|
| 52 | - /** @var Module $data */ |
|
| 53 | - $data = $form->getData(); |
|
| 54 | - $em->persist($data); |
|
| 55 | - $em->flush(); |
|
| 56 | - $this->addFlash("success-flash", "Module " . $data->getTitleTag() . " was " . $text); |
|
| 51 | + if ($form->isSubmitted() && $form->isValid()) { |
|
| 52 | + /** @var Module $data */ |
|
| 53 | + $data = $form->getData(); |
|
| 54 | + $em->persist($data); |
|
| 55 | + $em->flush(); |
|
| 56 | + $this->addFlash("success-flash", "Module " . $data->getTitleTag() . " was " . $text); |
|
| 57 | 57 | |
| 58 | - return $this->redirectToRoute("ribsadmin_modules"); |
|
| 59 | - } |
|
| 58 | + return $this->redirectToRoute("ribsadmin_modules"); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - return $this->render("@RibsAdmin/modules/edit.html.twig", [ |
|
| 62 | - "form" => $form->createView(), |
|
| 63 | - "form_errors" => $form->getErrors(), |
|
| 64 | - "module" => $module |
|
| 65 | - ]); |
|
| 66 | - } |
|
| 61 | + return $this->render("@RibsAdmin/modules/edit.html.twig", [ |
|
| 62 | + "form" => $form->createView(), |
|
| 63 | + "form_errors" => $form->getErrors(), |
|
| 64 | + "module" => $module |
|
| 65 | + ]); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * @Route("/modules/delete/{id}", name="ribsadmin_modules_delete") |
|
| 70 | - * @param int $id |
|
| 71 | - * @return RedirectResponse |
|
| 72 | - */ |
|
| 73 | - public function delete(int $id): RedirectResponse |
|
| 74 | - { |
|
| 75 | - $em = $this->getDoctrine()->getManager(); |
|
| 76 | - $module = $em->getRepository(Module::class)->findOneBy(["id" => $id]); |
|
| 68 | + /** |
|
| 69 | + * @Route("/modules/delete/{id}", name="ribsadmin_modules_delete") |
|
| 70 | + * @param int $id |
|
| 71 | + * @return RedirectResponse |
|
| 72 | + */ |
|
| 73 | + public function delete(int $id): RedirectResponse |
|
| 74 | + { |
|
| 75 | + $em = $this->getDoctrine()->getManager(); |
|
| 76 | + $module = $em->getRepository(Module::class)->findOneBy(["id" => $id]); |
|
| 77 | 77 | |
| 78 | - if ($module) { |
|
| 79 | - $name = $module->getTitle(); |
|
| 80 | - $em->remove($module); |
|
| 81 | - $em->flush(); |
|
| 82 | - $this->addFlash("success-flash", "Module " . $name . " was deleted"); |
|
| 83 | - } else { |
|
| 84 | - $this->addFlash("error-flash", "An error occured, module doesn't found"); |
|
| 85 | - } |
|
| 78 | + if ($module) { |
|
| 79 | + $name = $module->getTitle(); |
|
| 80 | + $em->remove($module); |
|
| 81 | + $em->flush(); |
|
| 82 | + $this->addFlash("success-flash", "Module " . $name . " was deleted"); |
|
| 83 | + } else { |
|
| 84 | + $this->addFlash("error-flash", "An error occured, module doesn't found"); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - return $this->redirectToRoute("ribsadmin_modules"); |
|
| 88 | - } |
|
| 87 | + return $this->redirectToRoute("ribsadmin_modules"); |
|
| 88 | + } |
|
| 89 | 89 | } |
@@ -9,22 +9,22 @@ |
||
| 9 | 9 | |
| 10 | 10 | class RenderPageController extends AbstractController |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * @Route("/page/{url}", name="page", requirements={"url" = "[a-zA-Z0-9\-\_\/]*"}) |
|
| 14 | - * @param string $url |
|
| 15 | - * @return Response |
|
| 16 | - */ |
|
| 17 | - public function renderPage(string $url): Response |
|
| 18 | - { |
|
| 19 | - $em = $this->getDoctrine()->getManager(); |
|
| 12 | + /** |
|
| 13 | + * @Route("/page/{url}", name="page", requirements={"url" = "[a-zA-Z0-9\-\_\/]*"}) |
|
| 14 | + * @param string $url |
|
| 15 | + * @return Response |
|
| 16 | + */ |
|
| 17 | + public function renderPage(string $url): Response |
|
| 18 | + { |
|
| 19 | + $em = $this->getDoctrine()->getManager(); |
|
| 20 | 20 | |
| 21 | - $page = $em->getRepository("RibsAdminBundle:Page")->findOneBy(["url" => $url]); |
|
| 22 | - $navigation = $em->getRepository("RibsAdminBundle:Navigation")->findAllNavigation(); |
|
| 21 | + $page = $em->getRepository("RibsAdminBundle:Page")->findOneBy(["url" => $url]); |
|
| 22 | + $navigation = $em->getRepository("RibsAdminBundle:Navigation")->findAllNavigation(); |
|
| 23 | 23 | |
| 24 | - if ($page) { |
|
| 25 | - return $this->render("@RibsAdmin/page.html.twig", ["page" => $page, "navigation" => $navigation]); |
|
| 26 | - } |
|
| 24 | + if ($page) { |
|
| 25 | + return $this->render("@RibsAdmin/page.html.twig", ["page" => $page, "navigation" => $navigation]); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - throw new NotFoundHttpException("The required page does not exist"); |
|
| 29 | - } |
|
| 28 | + throw new NotFoundHttpException("The required page does not exist"); |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | class Account extends AbstractType |
| 15 | 15 | { |
| 16 | - /** |
|
| 17 | - * @param FormBuilderInterface $builder |
|
| 18 | - * @param array $options |
|
| 19 | - */ |
|
| 16 | + /** |
|
| 17 | + * @param FormBuilderInterface $builder |
|
| 18 | + * @param array $options |
|
| 19 | + */ |
|
| 20 | 20 | public function buildForm(FormBuilderInterface $builder, array $options) |
| 21 | 21 | { |
| 22 | 22 | $builder |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | $builder->add('user', User::class); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @param OptionsResolver $resolver |
|
| 54 | - */ |
|
| 52 | + /** |
|
| 53 | + * @param OptionsResolver $resolver |
|
| 54 | + */ |
|
| 55 | 55 | public function configureOptions(OptionsResolver $resolver) |
| 56 | 56 | { |
| 57 | 57 | $resolver->setDefaults([ |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | class Module extends AbstractType |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * @param FormBuilderInterface $builder |
|
| 17 | - * @param array $options |
|
| 18 | - */ |
|
| 15 | + /** |
|
| 16 | + * @param FormBuilderInterface $builder |
|
| 17 | + * @param array $options |
|
| 18 | + */ |
|
| 19 | 19 | public function buildForm(FormBuilderInterface $builder, array $options) |
| 20 | 20 | { |
| 21 | 21 | $builder |
@@ -27,22 +27,22 @@ discard block |
||
| 27 | 27 | "label" => "Package name", |
| 28 | 28 | "required" => true |
| 29 | 29 | ]) |
| 30 | - ->add("titleTag", TextType::class, [ |
|
| 31 | - "label" => "Title tag", |
|
| 32 | - "required" => true |
|
| 33 | - ]) |
|
| 34 | - ->add("descriptionTag", TextareaType::class, [ |
|
| 35 | - "label" => "Description tag", |
|
| 36 | - "required" => true, |
|
| 37 | - ]) |
|
| 38 | - ->add("url", TextType::class, [ |
|
| 39 | - "label" => "Url", |
|
| 40 | - "required" => true |
|
| 41 | - ]) |
|
| 42 | - ->add("urlAdmin", TextType::class, [ |
|
| 43 | - "label" => "Admin url", |
|
| 44 | - "required" => true |
|
| 45 | - ]) |
|
| 30 | + ->add("titleTag", TextType::class, [ |
|
| 31 | + "label" => "Title tag", |
|
| 32 | + "required" => true |
|
| 33 | + ]) |
|
| 34 | + ->add("descriptionTag", TextareaType::class, [ |
|
| 35 | + "label" => "Description tag", |
|
| 36 | + "required" => true, |
|
| 37 | + ]) |
|
| 38 | + ->add("url", TextType::class, [ |
|
| 39 | + "label" => "Url", |
|
| 40 | + "required" => true |
|
| 41 | + ]) |
|
| 42 | + ->add("urlAdmin", TextType::class, [ |
|
| 43 | + "label" => "Admin url", |
|
| 44 | + "required" => true |
|
| 45 | + ]) |
|
| 46 | 46 | ->add("active", CheckboxType::class, [ |
| 47 | 47 | "label" => "Enable module", |
| 48 | 48 | "attr" => [ |
@@ -50,22 +50,22 @@ discard block |
||
| 50 | 50 | ], |
| 51 | 51 | "required" => false |
| 52 | 52 | ]) |
| 53 | - ->add("displayed", CheckboxType::class, [ |
|
| 54 | - "label" => "Display module in navigation", |
|
| 55 | - "attr" => [ |
|
| 56 | - "class" => "ribs-checkbox switched cxs-2 no-pl" |
|
| 57 | - ], |
|
| 58 | - "required" => false |
|
| 59 | - ]) |
|
| 60 | - ->add('submit', SubmitType::class, [ |
|
| 61 | - 'label' => 'Validate', |
|
| 62 | - 'attr' => [] |
|
| 63 | - ]); |
|
| 53 | + ->add("displayed", CheckboxType::class, [ |
|
| 54 | + "label" => "Display module in navigation", |
|
| 55 | + "attr" => [ |
|
| 56 | + "class" => "ribs-checkbox switched cxs-2 no-pl" |
|
| 57 | + ], |
|
| 58 | + "required" => false |
|
| 59 | + ]) |
|
| 60 | + ->add('submit', SubmitType::class, [ |
|
| 61 | + 'label' => 'Validate', |
|
| 62 | + 'attr' => [] |
|
| 63 | + ]); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * @param OptionsResolver $resolver |
|
| 68 | - */ |
|
| 66 | + /** |
|
| 67 | + * @param OptionsResolver $resolver |
|
| 68 | + */ |
|
| 69 | 69 | public function configureOptions(OptionsResolver $resolver) |
| 70 | 70 | { |
| 71 | 71 | $resolver->setDefaults([ |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | class Registration extends AbstractType |
| 15 | 15 | { |
| 16 | - /** |
|
| 17 | - * @param FormBuilderInterface $builder |
|
| 18 | - * @param array $options |
|
| 19 | - */ |
|
| 16 | + /** |
|
| 17 | + * @param FormBuilderInterface $builder |
|
| 18 | + * @param array $options |
|
| 19 | + */ |
|
| 20 | 20 | public function buildForm(FormBuilderInterface $builder, array $options) |
| 21 | 21 | { |
| 22 | 22 | $builder |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | ]); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @param OptionsResolver $resolver |
|
| 34 | - */ |
|
| 32 | + /** |
|
| 33 | + * @param OptionsResolver $resolver |
|
| 34 | + */ |
|
| 35 | 35 | public function configureOptions(OptionsResolver $resolver) |
| 36 | 36 | { |
| 37 | 37 | $resolver->setDefaults([ |
@@ -10,35 +10,35 @@ |
||
| 10 | 10 | |
| 11 | 11 | class AutocompleteType extends AbstractType |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * @param FormBuilderInterface $builder |
|
| 15 | - * @param array $options |
|
| 16 | - */ |
|
| 17 | - public function buildForm(FormBuilderInterface $builder, array $options) |
|
| 18 | - { |
|
| 19 | - $builder |
|
| 20 | - ->add($options["autocomplete_name"], TextType::class, [ |
|
| 21 | - "label" => false, |
|
| 22 | - "attr" => [ |
|
| 23 | - "class" => "input-autocomplete", |
|
| 24 | - "data-url" => $options["data_url"], |
|
| 25 | - "autocomplete" => "off" |
|
| 26 | - ], |
|
| 27 | - "mapped" => false |
|
| 28 | - ]) |
|
| 29 | - ->add($options["autocomplete_name"] . "_id", HiddenType::class, [ |
|
| 30 | - "mapped" => false |
|
| 31 | - ]); |
|
| 32 | - } |
|
| 13 | + /** |
|
| 14 | + * @param FormBuilderInterface $builder |
|
| 15 | + * @param array $options |
|
| 16 | + */ |
|
| 17 | + public function buildForm(FormBuilderInterface $builder, array $options) |
|
| 18 | + { |
|
| 19 | + $builder |
|
| 20 | + ->add($options["autocomplete_name"], TextType::class, [ |
|
| 21 | + "label" => false, |
|
| 22 | + "attr" => [ |
|
| 23 | + "class" => "input-autocomplete", |
|
| 24 | + "data-url" => $options["data_url"], |
|
| 25 | + "autocomplete" => "off" |
|
| 26 | + ], |
|
| 27 | + "mapped" => false |
|
| 28 | + ]) |
|
| 29 | + ->add($options["autocomplete_name"] . "_id", HiddenType::class, [ |
|
| 30 | + "mapped" => false |
|
| 31 | + ]); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @param OptionsResolver $resolver |
|
| 36 | - */ |
|
| 37 | - public function configureOptions(OptionsResolver $resolver) |
|
| 38 | - { |
|
| 39 | - $resolver->setDefaults([ |
|
| 40 | - "autocomplete_name" => null, |
|
| 41 | - "data_url" => null, |
|
| 42 | - ]); |
|
| 43 | - } |
|
| 34 | + /** |
|
| 35 | + * @param OptionsResolver $resolver |
|
| 36 | + */ |
|
| 37 | + public function configureOptions(OptionsResolver $resolver) |
|
| 38 | + { |
|
| 39 | + $resolver->setDefaults([ |
|
| 40 | + "autocomplete_name" => null, |
|
| 41 | + "data_url" => null, |
|
| 42 | + ]); |
|
| 43 | + } |
|
| 44 | 44 | } |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | $this->tokenStorage = $tokenStorage; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @param FormBuilderInterface $builder |
|
| 39 | - * @param array $options |
|
| 40 | - */ |
|
| 37 | + /** |
|
| 38 | + * @param FormBuilderInterface $builder |
|
| 39 | + * @param array $options |
|
| 40 | + */ |
|
| 41 | 41 | public function buildForm(FormBuilderInterface $builder, array $options) |
| 42 | 42 | { |
| 43 | 43 | $access_rights_lists = $this->em->getRepository(\PiouPiou\RibsAdminBundle\Entity\AccessRight::class)->findAll(); |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | ]); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * @param OptionsResolver $resolver |
|
| 75 | - */ |
|
| 73 | + /** |
|
| 74 | + * @param OptionsResolver $resolver |
|
| 75 | + */ |
|
| 76 | 76 | public function configureOptions(OptionsResolver $resolver) |
| 77 | 77 | { |
| 78 | 78 | $resolver->setDefaults([ |