@@ -9,11 +9,11 @@ |
||
| 9 | 9 | |
| 10 | 10 | class RenderPageController extends Controller |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * @Route("/page/{url}", name="page", requirements={"url" = "[a-zA-Z0-9\-\_\/]*"}) |
|
| 14 | - * @param string $url |
|
| 15 | - * @return Response |
|
| 16 | - */ |
|
| 12 | + /** |
|
| 13 | + * @Route("/page/{url}", name="page", requirements={"url" = "[a-zA-Z0-9\-\_\/]*"}) |
|
| 14 | + * @param string $url |
|
| 15 | + * @return Response |
|
| 16 | + */ |
|
| 17 | 17 | public function renderPageAction(string $url): Response |
| 18 | 18 | { |
| 19 | 19 | $em = $this->getDoctrine()->getManager(); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | private $nav = []; |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * function that display the left navigation mapped by user rights |
|
| 14 | + * function that display the left navigation mapped by user rights |
|
| 15 | 15 | * @return Response |
| 16 | 16 | */ |
| 17 | 17 | public function getLeftNavigationAction(): Response |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | ]); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * @Route("/accounts/create/", name="ribsadmin_accounts_create") |
|
| 38 | - * @Route("/accounts/edit/{guid}", name="ribsadmin_accounts_edit") |
|
| 39 | - * @param Request $request |
|
| 40 | - * @param string|null $guid |
|
| 41 | - * @return Response |
|
| 42 | - */ |
|
| 36 | + /** |
|
| 37 | + * @Route("/accounts/create/", name="ribsadmin_accounts_create") |
|
| 38 | + * @Route("/accounts/edit/{guid}", name="ribsadmin_accounts_edit") |
|
| 39 | + * @param Request $request |
|
| 40 | + * @param string|null $guid |
|
| 41 | + * @return Response |
|
| 42 | + */ |
|
| 43 | 43 | public function editUserAction(Request $request, string $guid = null): Response |
| 44 | 44 | { |
| 45 | 45 | $em = $this->getDoctrine()->getManager(); |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | if ($guid === null) { |
| 48 | 48 | $account = new Account(); |
| 49 | 49 | $old_password = null; |
| 50 | - $user = null; |
|
| 50 | + $user = null; |
|
| 51 | 51 | } else { |
| 52 | 52 | $user = $em->getRepository(User::class)->findOneBy(["guid" => $guid]); |
| 53 | 53 | $account = $em->getRepository(Account::class)->findOneBy(["user" => $user->getId()]); |
| 54 | - $old_password = $account->getPassword(); |
|
| 54 | + $old_password = $account->getPassword(); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $form = $this->createForm("PiouPiou\RibsAdminBundle\Form\Account", $account); |
@@ -71,15 +71,15 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | if (!$account_exist) { |
| 74 | - if ($guid === null) { |
|
| 75 | - $temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData()); |
|
| 76 | - $data->setPassword($temp_password); |
|
| 77 | - } else if ($form->get("password")->getData()) { |
|
| 78 | - $temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData()); |
|
| 79 | - $data->setPassword($temp_password); |
|
| 80 | - } else { |
|
| 81 | - $data->setPassword($old_password); |
|
| 82 | - } |
|
| 74 | + if ($guid === null) { |
|
| 75 | + $temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData()); |
|
| 76 | + $data->setPassword($temp_password); |
|
| 77 | + } else if ($form->get("password")->getData()) { |
|
| 78 | + $temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData()); |
|
| 79 | + $data->setPassword($temp_password); |
|
| 80 | + } else { |
|
| 81 | + $data->setPassword($old_password); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | 84 | $em->persist($data); |
| 85 | 85 | $em->flush(); |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | return $this->render("@RibsAdmin/accounts/edit.html.twig", [ |
| 103 | 103 | "form" => $form->createView(), |
| 104 | - "form_errors" => $form->getErrors(), |
|
| 105 | - "user" => $user |
|
| 104 | + "form_errors" => $form->getErrors(), |
|
| 105 | + "user" => $user |
|
| 106 | 106 | ]); |
| 107 | 107 | } |
| 108 | 108 | //-------------------------------------------- END DISPLAY VIEWS -----------------------------------------------------------// |
@@ -10,50 +10,50 @@ |
||
| 10 | 10 | |
| 11 | 11 | class ModuleController extends AbstractController |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * @Route("/modules/", name="ribsadmin_modules") |
|
| 15 | - * @return Response |
|
| 16 | - * function that return a list of all modules |
|
| 17 | - */ |
|
| 18 | - public function List(): Response |
|
| 19 | - { |
|
| 20 | - $em = $this->getDoctrine()->getManager(); |
|
| 21 | - |
|
| 22 | - $modules = $em->getRepository(Module::class)->findBy([], ['titleTag' => 'ASC']); |
|
| 23 | - |
|
| 24 | - return $this->render('@RibsAdmin/modules/list.html.twig', [ |
|
| 25 | - "modules" => $modules, |
|
| 26 | - ]); |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * @Route("/modules/edit/{id}", name="ribsadmin_modules_edit") |
|
| 31 | - * @param Request $request |
|
| 32 | - * @param int|null $id |
|
| 33 | - * @return Response |
|
| 34 | - * method to edit a module |
|
| 35 | - */ |
|
| 36 | - public function editUserAction(Request $request, int $id = null): Response |
|
| 37 | - { |
|
| 38 | - $em = $this->getDoctrine()->getManager(); |
|
| 39 | - $module = $em->getRepository(Module::class)->findOneBy(["id" => $id]); |
|
| 40 | - $form = $this->createForm(\PiouPiou\RibsAdminBundle\Form\Module::class, $module); |
|
| 41 | - $form->handleRequest($request); |
|
| 42 | - |
|
| 43 | - if ($form->isSubmitted() && $form->isValid()) { |
|
| 44 | - /** @var Module $data */ |
|
| 45 | - $data = $form->getData(); |
|
| 46 | - $em->persist($data); |
|
| 47 | - $em->flush(); |
|
| 48 | - $this->addFlash("success-flash", "Module ". $data->getTitleTag() . " was edited"); |
|
| 49 | - |
|
| 50 | - return $this->redirectToRoute("ribsadmin_modules"); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - return $this->render("@RibsAdmin/modules/edit.html.twig", [ |
|
| 54 | - "form" => $form->createView(), |
|
| 55 | - "form_errors" => $form->getErrors(), |
|
| 56 | - "module" => $module |
|
| 57 | - ]); |
|
| 58 | - } |
|
| 13 | + /** |
|
| 14 | + * @Route("/modules/", name="ribsadmin_modules") |
|
| 15 | + * @return Response |
|
| 16 | + * function that return a list of all modules |
|
| 17 | + */ |
|
| 18 | + public function List(): Response |
|
| 19 | + { |
|
| 20 | + $em = $this->getDoctrine()->getManager(); |
|
| 21 | + |
|
| 22 | + $modules = $em->getRepository(Module::class)->findBy([], ['titleTag' => 'ASC']); |
|
| 23 | + |
|
| 24 | + return $this->render('@RibsAdmin/modules/list.html.twig', [ |
|
| 25 | + "modules" => $modules, |
|
| 26 | + ]); |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @Route("/modules/edit/{id}", name="ribsadmin_modules_edit") |
|
| 31 | + * @param Request $request |
|
| 32 | + * @param int|null $id |
|
| 33 | + * @return Response |
|
| 34 | + * method to edit a module |
|
| 35 | + */ |
|
| 36 | + public function editUserAction(Request $request, int $id = null): Response |
|
| 37 | + { |
|
| 38 | + $em = $this->getDoctrine()->getManager(); |
|
| 39 | + $module = $em->getRepository(Module::class)->findOneBy(["id" => $id]); |
|
| 40 | + $form = $this->createForm(\PiouPiou\RibsAdminBundle\Form\Module::class, $module); |
|
| 41 | + $form->handleRequest($request); |
|
| 42 | + |
|
| 43 | + if ($form->isSubmitted() && $form->isValid()) { |
|
| 44 | + /** @var Module $data */ |
|
| 45 | + $data = $form->getData(); |
|
| 46 | + $em->persist($data); |
|
| 47 | + $em->flush(); |
|
| 48 | + $this->addFlash("success-flash", "Module ". $data->getTitleTag() . " was edited"); |
|
| 49 | + |
|
| 50 | + return $this->redirectToRoute("ribsadmin_modules"); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + return $this->render("@RibsAdmin/modules/edit.html.twig", [ |
|
| 54 | + "form" => $form->createView(), |
|
| 55 | + "form_errors" => $form->getErrors(), |
|
| 56 | + "module" => $module |
|
| 57 | + ]); |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -314,13 +314,13 @@ |
||
| 314 | 314 | $this->updateDate = $updateDate; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - public function getFormattedActive() |
|
| 318 | - { |
|
| 319 | - return $this->getActive() ? "Oui" : "Non"; |
|
| 320 | - } |
|
| 317 | + public function getFormattedActive() |
|
| 318 | + { |
|
| 319 | + return $this->getActive() ? "Oui" : "Non"; |
|
| 320 | + } |
|
| 321 | 321 | |
| 322 | 322 | public function getFormattedDisplayed() |
| 323 | - { |
|
| 324 | - return $this->getDisplayed() ? "Oui" : "Non"; |
|
| 325 | - } |
|
| 323 | + { |
|
| 324 | + return $this->getDisplayed() ? "Oui" : "Non"; |
|
| 325 | + } |
|
| 326 | 326 | } |
@@ -25,24 +25,24 @@ discard block |
||
| 25 | 25 | ->add("packageName", TextType::class, [ |
| 26 | 26 | "label" => "Package name", |
| 27 | 27 | "required" => true, |
| 28 | - "disabled" => true |
|
| 28 | + "disabled" => 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,17 +50,17 @@ 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 | 66 | public function configureOptions(OptionsResolver $resolver) |
@@ -11,30 +11,30 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | class ImportModuleCommand extends ContainerAwareCommand |
| 13 | 13 | { |
| 14 | - protected function configure() |
|
| 15 | - { |
|
| 16 | - $this |
|
| 17 | - ->setName('ribsadmin:import-module') |
|
| 18 | - ->setDescription('Import a module in ribs admin') |
|
| 19 | - ->addArgument( |
|
| 20 | - 'package-name', |
|
| 21 | - InputArgument::REQUIRED, |
|
| 22 | - 'Name of composer package to import' |
|
| 23 | - ) |
|
| 24 | - /*->addOption( |
|
| 14 | + protected function configure() |
|
| 15 | + { |
|
| 16 | + $this |
|
| 17 | + ->setName('ribsadmin:import-module') |
|
| 18 | + ->setDescription('Import a module in ribs admin') |
|
| 19 | + ->addArgument( |
|
| 20 | + 'package-name', |
|
| 21 | + InputArgument::REQUIRED, |
|
| 22 | + 'Name of composer package to import' |
|
| 23 | + ) |
|
| 24 | + /*->addOption( |
|
| 25 | 25 | 'yell', |
| 26 | 26 | null, |
| 27 | 27 | InputOption::VALUE_NONE, |
| 28 | 28 | 'If set, the task will yell in uppercase letters' |
| 29 | 29 | )*/ |
| 30 | - ; |
|
| 31 | - } |
|
| 30 | + ; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - protected function execute(InputInterface $input, OutputInterface $output) |
|
| 34 | - { |
|
| 35 | - $pacakge_name = $input->getArgument('package-name'); |
|
| 33 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 34 | + { |
|
| 35 | + $pacakge_name = $input->getArgument('package-name'); |
|
| 36 | 36 | |
| 37 | - /*$name = $input->getArgument('name'); |
|
| 37 | + /*$name = $input->getArgument('name'); |
|
| 38 | 38 | if ($name) { |
| 39 | 39 | $text = 'Hello '.$name; |
| 40 | 40 | } else { |
@@ -45,6 +45,6 @@ discard block |
||
| 45 | 45 | $text = strtoupper($text); |
| 46 | 46 | }*/ |
| 47 | 47 | |
| 48 | - $output->writeln("Houra ! -- " . $pacakge_name); |
|
| 49 | - } |
|
| 48 | + $output->writeln("Houra ! -- " . $pacakge_name); |
|
| 49 | + } |
|
| 50 | 50 | } |