@@ -7,13 +7,13 @@ |
||
7 | 7 | |
8 | 8 | class DefaultController extends AbstractController |
9 | 9 | { |
10 | - /** |
|
11 | - * @Route("/", name="ribsadmin") |
|
12 | - * @Route("/index", name="ribsadmin_index") |
|
13 | - * @Route("/navigation", name="ribsadmin_navigation") |
|
14 | - */ |
|
15 | - public function index() |
|
16 | - { |
|
17 | - return $this->render('@RibsAdmin/Default/index.html.twig'); |
|
18 | - } |
|
10 | + /** |
|
11 | + * @Route("/", name="ribsadmin") |
|
12 | + * @Route("/index", name="ribsadmin_index") |
|
13 | + * @Route("/navigation", name="ribsadmin_navigation") |
|
14 | + */ |
|
15 | + public function index() |
|
16 | + { |
|
17 | + return $this->render('@RibsAdmin/Default/index.html.twig'); |
|
18 | + } |
|
19 | 19 | } |
@@ -10,48 +10,48 @@ |
||
10 | 10 | |
11 | 11 | class NavigationBuilderController extends AbstractController |
12 | 12 | { |
13 | - private $nav = []; |
|
14 | - |
|
15 | - /** |
|
16 | - * function that display the left navigation mapped by user rights |
|
17 | - * @param Globals $globals |
|
18 | - * @param AccessRights $access_rights |
|
19 | - * @return Response |
|
20 | - */ |
|
21 | - public function getLeftNavigation(Globals $globals, AccessRights $access_rights): Response |
|
22 | - { |
|
23 | - $navigation = json_decode(file_get_contents($globals->getBaseBundlePath() . "/Resources/json/navigation.json"), true); |
|
24 | - |
|
25 | - foreach ($navigation["items"] as $item) { |
|
26 | - if ($access_rights->testRight($item["right"]) && (!isset($item["position"]) || $item["position"] === "left")) { |
|
27 | - $this->nav[] = $item; |
|
28 | - } |
|
29 | - } |
|
30 | - |
|
31 | - $this->getModuleNavigation(); |
|
32 | - |
|
33 | - return $this->render("@RibsAdmin/navigation.html.twig", ["navigation" => $this->nav]); |
|
34 | - } |
|
35 | - |
|
36 | - /** |
|
37 | - * to get all modules navigation and test right navigation |
|
38 | - */ |
|
39 | - private function getModuleNavigation() |
|
40 | - { |
|
41 | - $modules = $this->getDoctrine()->getRepository(Module::class)->findBy([ |
|
42 | - "active" => true, |
|
43 | - "displayed" => true |
|
44 | - ]); |
|
45 | - |
|
46 | - foreach ($modules as $module) { |
|
47 | - $navigation = json_decode(file_get_contents($this->get("ribs_admin.globals")->getBaseBundlePath |
|
48 | - ($module->getPackageName(), $module->getDevMode()) . "/Resources/json/navigation.json"), true); |
|
49 | - |
|
50 | - foreach ($navigation["items"] as $item) { |
|
51 | - if ($this->get("ribs_admin.acess_rights")->testRight($item["right"]) && (!isset($item["position"]) || $item["position"] === "left")) { |
|
52 | - $this->nav[] = $item; |
|
53 | - } |
|
54 | - } |
|
55 | - } |
|
56 | - } |
|
13 | + private $nav = []; |
|
14 | + |
|
15 | + /** |
|
16 | + * function that display the left navigation mapped by user rights |
|
17 | + * @param Globals $globals |
|
18 | + * @param AccessRights $access_rights |
|
19 | + * @return Response |
|
20 | + */ |
|
21 | + public function getLeftNavigation(Globals $globals, AccessRights $access_rights): Response |
|
22 | + { |
|
23 | + $navigation = json_decode(file_get_contents($globals->getBaseBundlePath() . "/Resources/json/navigation.json"), true); |
|
24 | + |
|
25 | + foreach ($navigation["items"] as $item) { |
|
26 | + if ($access_rights->testRight($item["right"]) && (!isset($item["position"]) || $item["position"] === "left")) { |
|
27 | + $this->nav[] = $item; |
|
28 | + } |
|
29 | + } |
|
30 | + |
|
31 | + $this->getModuleNavigation(); |
|
32 | + |
|
33 | + return $this->render("@RibsAdmin/navigation.html.twig", ["navigation" => $this->nav]); |
|
34 | + } |
|
35 | + |
|
36 | + /** |
|
37 | + * to get all modules navigation and test right navigation |
|
38 | + */ |
|
39 | + private function getModuleNavigation() |
|
40 | + { |
|
41 | + $modules = $this->getDoctrine()->getRepository(Module::class)->findBy([ |
|
42 | + "active" => true, |
|
43 | + "displayed" => true |
|
44 | + ]); |
|
45 | + |
|
46 | + foreach ($modules as $module) { |
|
47 | + $navigation = json_decode(file_get_contents($this->get("ribs_admin.globals")->getBaseBundlePath |
|
48 | + ($module->getPackageName(), $module->getDevMode()) . "/Resources/json/navigation.json"), true); |
|
49 | + |
|
50 | + foreach ($navigation["items"] as $item) { |
|
51 | + if ($this->get("ribs_admin.acess_rights")->testRight($item["right"]) && (!isset($item["position"]) || $item["position"] === "left")) { |
|
52 | + $this->nav[] = $item; |
|
53 | + } |
|
54 | + } |
|
55 | + } |
|
56 | + } |
|
57 | 57 | } |
@@ -44,8 +44,7 @@ |
||
44 | 44 | ]); |
45 | 45 | |
46 | 46 | foreach ($modules as $module) { |
47 | - $navigation = json_decode(file_get_contents($this->get("ribs_admin.globals")->getBaseBundlePath |
|
48 | - ($module->getPackageName(), $module->getDevMode()) . "/Resources/json/navigation.json"), true); |
|
47 | + $navigation = json_decode(file_get_contents($this->get("ribs_admin.globals")->getBaseBundlePath($module->getPackageName(), $module->getDevMode()) . "/Resources/json/navigation.json"), true); |
|
49 | 48 | |
50 | 49 | foreach ($navigation["items"] as $item) { |
51 | 50 | if ($this->get("ribs_admin.acess_rights")->testRight($item["right"]) && (!isset($item["position"]) || $item["position"] === "left")) { |
@@ -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([ |