@@ -11,11 +11,11 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | private $container; |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Globals constructor. |
|
| 16 | - * @param ContainerInterface $container |
|
| 17 | - */ |
|
| 18 | - public function __construct(ContainerInterface $container) |
|
| 14 | + /** |
|
| 15 | + * Globals constructor. |
|
| 16 | + * @param ContainerInterface $container |
|
| 17 | + */ |
|
| 18 | + public function __construct(ContainerInterface $container) |
|
| 19 | 19 | { |
| 20 | 20 | $this->container = $container; |
| 21 | 21 | } |
@@ -51,9 +51,9 @@ |
||
| 51 | 51 | $dev_mode = $this->container->getParameter("ribs_admin")["dev_mode"]; |
| 52 | 52 | |
| 53 | 53 | if ($dev_mode === true) { |
| 54 | - $package = "lib/".$this->getPackageDevName($package); |
|
| 54 | + $package = "lib/" . $this->getPackageDevName($package); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - return implode("/", $path)."/../../" . $package; |
|
| 57 | + return implode("/", $path) . "/../../" . $package; |
|
| 58 | 58 | } |
| 59 | 59 | } |
@@ -8,11 +8,11 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PageController extends Controller |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * method to show index page of content management |
|
| 13 | - * @Route("/contents", name="ribsadmin_contents") |
|
| 14 | - * @return Response |
|
| 15 | - */ |
|
| 11 | + /** |
|
| 12 | + * method to show index page of content management |
|
| 13 | + * @Route("/contents", name="ribsadmin_contents") |
|
| 14 | + * @return Response |
|
| 15 | + */ |
|
| 16 | 16 | public function indexAction(): Response |
| 17 | 17 | { |
| 18 | 18 | $navigation = $this->getDoctrine()->getManager()->getRepository("RibsAdminBundle:Navigation")->findAllNavigationPage(); |
@@ -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(); |
@@ -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 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $data = $form->getData(); |
| 46 | 46 | $em->persist($data); |
| 47 | 47 | $em->flush(); |
| 48 | - $this->addFlash("success-flash", "Module ". $data->getTitleTag() . " was edited"); |
|
| 48 | + $this->addFlash("success-flash", "Module " . $data->getTitleTag() . " was edited"); |
|
| 49 | 49 | |
| 50 | 50 | return $this->redirectToRoute("ribsadmin_modules"); |
| 51 | 51 | } |
@@ -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,12 +11,12 @@ 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( |
|
| 14 | + protected function configure() |
|
| 15 | + { |
|
| 16 | + $this |
|
| 17 | + ->setName('ribsadmin:import-module') |
|
| 18 | + ->setDescription('Import a module in ribs admin') |
|
| 19 | + /*->addArgument( |
|
| 20 | 20 | 'name', |
| 21 | 21 | InputArgument::OPTIONAL, |
| 22 | 22 | 'Who do you want to greet?' |
@@ -27,12 +27,12 @@ discard block |
||
| 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 | - /*$name = $input->getArgument('name'); |
|
| 33 | + protected function execute(InputInterface $input, OutputInterface $output) |
|
| 34 | + { |
|
| 35 | + /*$name = $input->getArgument('name'); |
|
| 36 | 36 | if ($name) { |
| 37 | 37 | $text = 'Hello '.$name; |
| 38 | 38 | } else { |
@@ -43,6 +43,6 @@ discard block |
||
| 43 | 43 | $text = strtoupper($text); |
| 44 | 44 | }*/ |
| 45 | 45 | |
| 46 | - $output->writeln("Houra !"); |
|
| 47 | - } |
|
| 46 | + $output->writeln("Houra !"); |
|
| 47 | + } |
|
| 48 | 48 | } |