| @@ 32-209 (lines=178) @@ | ||
| 29 | * |
|
| 30 | * @Route("/admin/settings/divers/familylog") |
|
| 31 | */ |
|
| 32 | class FamilyLogController extends Controller |
|
| 33 | { |
|
| 34 | /** |
|
| 35 | * Lists all FamilyLog entities. |
|
| 36 | * |
|
| 37 | * @Route("/", name="admin_familylog") |
|
| 38 | * @Method("GET") |
|
| 39 | * @Template() |
|
| 40 | */ |
|
| 41 | public function indexAction() |
|
| 42 | { |
|
| 43 | $em = $this->getDoctrine()->getManager(); |
|
| 44 | $entities = $em->getRepository('AppBundle:FamilyLog')->childrenHierarchy(); |
|
| 45 | ||
| 46 | return array( |
|
| 47 | 'entities' => $entities, |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Finds and displays a FamilyLog entity. |
|
| 53 | * |
|
| 54 | * @Route("/{slug}/show", name="admin_familylog_show") |
|
| 55 | * @Method("GET") |
|
| 56 | * @Template() |
|
| 57 | */ |
|
| 58 | public function showAction(FamilyLog $familylog) |
|
| 59 | { |
|
| 60 | $deleteForm = $this->createDeleteForm($familylog->getId(), 'admin_familylog_delete'); |
|
| 61 | ||
| 62 | return array( |
|
| 63 | 'familylog' => $familylog, |
|
| 64 | 'delete_form' => $deleteForm->createView(), |
|
| 65 | ); |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * Displays a form to create a new FamilyLog entity. |
|
| 70 | * |
|
| 71 | * @Route("/new", name="admin_familylog_new") |
|
| 72 | * @Method("GET") |
|
| 73 | * @Template() |
|
| 74 | */ |
|
| 75 | public function newAction() |
|
| 76 | { |
|
| 77 | $familylog = new FamilyLog(); |
|
| 78 | $form = $this->createForm(new FamilyLogType(), $familylog); |
|
| 79 | ||
| 80 | return array( |
|
| 81 | 'familylog' => $familylog, |
|
| 82 | 'form' => $form->createView(), |
|
| 83 | ); |
|
| 84 | } |
|
| 85 | ||
| 86 | /** |
|
| 87 | * Creates a new FamilyLog entity. |
|
| 88 | * |
|
| 89 | * @Route("/create", name="admin_familylog_create") |
|
| 90 | * @Method("POST") |
|
| 91 | * @Template("AppBundle:FamilyLog:new.html.twig") |
|
| 92 | */ |
|
| 93 | public function createAction(Request $request) |
|
| 94 | { |
|
| 95 | $familylog = new FamilyLog(); |
|
| 96 | $form = $this->createForm(new FamilyLogType(), $familylog); |
|
| 97 | if ($form->handleRequest($request)->isValid()) { |
|
| 98 | $em = $this->getDoctrine()->getManager(); |
|
| 99 | $em->persist($familylog); |
|
| 100 | $em->flush(); |
|
| 101 | ||
| 102 | if ($form->get('save')->isSubmitted()) { |
|
| 103 | $url = $this->redirect($this->generateUrl( |
|
| 104 | 'admin_familylog_show', |
|
| 105 | array('slug' => $familylog->getSlug()) |
|
| 106 | )); |
|
| 107 | } elseif ($form->get('addmore')->isSubmitted()) { |
|
| 108 | $this->addFlash('info', 'gestock.settings.add_ok'); |
|
| 109 | $url = $this->redirectToRoute('admin_familylog_new'); |
|
| 110 | } |
|
| 111 | return $url; |
|
| 112 | } |
|
| 113 | ||
| 114 | return array( |
|
| 115 | 'familylog' => $familylog, |
|
| 116 | 'form' => $form->createView(), |
|
| 117 | ); |
|
| 118 | } |
|
| 119 | ||
| 120 | /** |
|
| 121 | * Displays a form to edit an existing FamilyLog entity. |
|
| 122 | * |
|
| 123 | * @Route("/{slug}/edit", name="admin_familylog_edit") |
|
| 124 | * @Method("GET") |
|
| 125 | * @Template() |
|
| 126 | */ |
|
| 127 | public function editAction(FamilyLog $familylog) |
|
| 128 | { |
|
| 129 | $editForm = $this->createForm(new FamilyLogType(), $familylog, array( |
|
| 130 | 'action' => $this->generateUrl( |
|
| 131 | 'admin_familylog_update', |
|
| 132 | array('slug' => $familylog->getSlug()) |
|
| 133 | ), |
|
| 134 | 'method' => 'PUT', |
|
| 135 | )); |
|
| 136 | $deleteForm = $this->createDeleteForm($familylog->getId(), 'admin_familylog_delete'); |
|
| 137 | ||
| 138 | return array( |
|
| 139 | 'familylog' => $familylog, |
|
| 140 | 'edit_form' => $editForm->createView(), |
|
| 141 | 'delete_form' => $deleteForm->createView(), |
|
| 142 | ); |
|
| 143 | } |
|
| 144 | ||
| 145 | /** |
|
| 146 | * Edits an existing FamilyLog entity. |
|
| 147 | * |
|
| 148 | * @Route("/{slug}/update", name="admin_familylog_update") |
|
| 149 | * @Method("PUT") |
|
| 150 | * @Template("AppBundle:FamilyLog:edit.html.twig") |
|
| 151 | */ |
|
| 152 | public function updateAction(FamilyLog $famlog, Request $request) |
|
| 153 | { |
|
| 154 | $editForm = $this->createForm(new FamilyLogType(), $famlog, array( |
|
| 155 | 'action' => $this->generateUrl( |
|
| 156 | 'admin_familylog_update', |
|
| 157 | array('slug' => $famlog->getSlug()) |
|
| 158 | ), |
|
| 159 | 'method' => 'PUT', |
|
| 160 | )); |
|
| 161 | if ($editForm->handleRequest($request)->isValid()) { |
|
| 162 | $this->getDoctrine()->getManager()->flush(); |
|
| 163 | $this->addFlash('info', 'gestock.settings.edit_ok'); |
|
| 164 | ||
| 165 | return $this->redirectToRoute('admin_familylog_edit', array('slug' => $famlog->getSlug())); |
|
| 166 | } |
|
| 167 | $deleteForm = $this->createDeleteForm($famlog->getId(), 'admin_familylog_delete'); |
|
| 168 | ||
| 169 | return array( |
|
| 170 | 'familylog' => $famlog, |
|
| 171 | 'edit_form' => $editForm->createView(), |
|
| 172 | 'delete_form' => $deleteForm->createView(), |
|
| 173 | ); |
|
| 174 | } |
|
| 175 | ||
| 176 | /** |
|
| 177 | * Deletes a FamilyLog entity. |
|
| 178 | * |
|
| 179 | * @Route("/{id}/delete", name="admin_familylog_delete", requirements={"id"="\d+"}) |
|
| 180 | * @Method("DELETE") |
|
| 181 | */ |
|
| 182 | public function deleteAction(FamilyLog $familylog, Request $request) |
|
| 183 | { |
|
| 184 | $form = $this->createDeleteForm($familylog->getId(), 'admin_familylog_delete'); |
|
| 185 | if ($form->handleRequest($request)->isValid()) { |
|
| 186 | $em = $this->getDoctrine()->getManager(); |
|
| 187 | $em->remove($familylog); |
|
| 188 | $em->flush(); |
|
| 189 | } |
|
| 190 | ||
| 191 | return $this->redirectToRoute('admin_familylog'); |
|
| 192 | } |
|
| 193 | ||
| 194 | /** |
|
| 195 | * Create Delete form |
|
| 196 | * |
|
| 197 | * @param integer $id |
|
| 198 | * @param string $route |
|
| 199 | * @return \Symfony\Component\Form\Form |
|
| 200 | */ |
|
| 201 | protected function createDeleteForm($id, $route) |
|
| 202 | { |
|
| 203 | return $this->createFormBuilder(null, array('attr' => array('id' => 'delete'))) |
|
| 204 | ->setAction($this->generateUrl($route, array('id' => $id))) |
|
| 205 | ->setMethod('DELETE') |
|
| 206 | ->getForm() |
|
| 207 | ; |
|
| 208 | } |
|
| 209 | } |
|
| 210 | ||
| @@ 32-200 (lines=169) @@ | ||
| 29 | * |
|
| 30 | * @Route("/admin/settings/divers/rate") |
|
| 31 | */ |
|
| 32 | class TvaController extends Controller |
|
| 33 | { |
|
| 34 | /** |
|
| 35 | * Lists all Tva entities. |
|
| 36 | * |
|
| 37 | * @Route("/", name="admin_rate") |
|
| 38 | * @Method("GET") |
|
| 39 | * @Template() |
|
| 40 | */ |
|
| 41 | public function indexAction() |
|
| 42 | { |
|
| 43 | $em = $this->getDoctrine()->getManager(); |
|
| 44 | $entities = $em->getRepository('AppBundle:Tva')->findAll(); |
|
| 45 | ||
| 46 | return array( |
|
| 47 | 'entities' => $entities, |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Finds and displays a Tva entity. |
|
| 53 | * |
|
| 54 | * @Route("/{id}/show", name="admin_rate_show", requirements={"id"="\d+"}) |
|
| 55 | * @Method("GET") |
|
| 56 | * @Template() |
|
| 57 | */ |
|
| 58 | public function showAction(Tva $tva) |
|
| 59 | { |
|
| 60 | $deleteForm = $this->createDeleteForm($tva->getId(), 'admin_rate_delete'); |
|
| 61 | ||
| 62 | return array( |
|
| 63 | 'tva' => $tva, |
|
| 64 | 'delete_form' => $deleteForm->createView(), |
|
| 65 | ); |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * Displays a form to create a new Tva entity. |
|
| 70 | * |
|
| 71 | * @Route("/new", name="admin_rate_new") |
|
| 72 | * @Method("GET") |
|
| 73 | * @Template() |
|
| 74 | */ |
|
| 75 | public function newAction() |
|
| 76 | { |
|
| 77 | $tva = new Tva(); |
|
| 78 | $form = $this->createForm(new TvaType(), $tva); |
|
| 79 | ||
| 80 | return array( |
|
| 81 | 'tva' => $tva, |
|
| 82 | 'form' => $form->createView(), |
|
| 83 | ); |
|
| 84 | } |
|
| 85 | ||
| 86 | /** |
|
| 87 | * Creates a new Tva entity. |
|
| 88 | * |
|
| 89 | * @Route("/create", name="admin_rate_create") |
|
| 90 | * @Method("POST") |
|
| 91 | * @Template("AppBundle:Tva:new.html.twig") |
|
| 92 | */ |
|
| 93 | public function createAction(Request $request) |
|
| 94 | { |
|
| 95 | $tva = new Tva(); |
|
| 96 | $form = $this->createForm(new TvaType(), $tva); |
|
| 97 | if ($form->handleRequest($request)->isValid()) { |
|
| 98 | $em = $this->getDoctrine()->getManager(); |
|
| 99 | $em->persist($tva); |
|
| 100 | $em->flush(); |
|
| 101 | ||
| 102 | if ($form->get('save')->isSubmitted()) { |
|
| 103 | $url = $this->redirectToRoute('admin_rate_show', array('id' => $tva->getId())); |
|
| 104 | } elseif ($form->get('addmore')->isSubmitted()) { |
|
| 105 | $this->addFlash('info', 'gestock.settings.add_ok'); |
|
| 106 | $url = $this->redirectToRoute('admin_rate_new'); |
|
| 107 | } |
|
| 108 | return $url; |
|
| 109 | } |
|
| 110 | ||
| 111 | return array( |
|
| 112 | 'tva' => $tva, |
|
| 113 | 'form' => $form->createView(), |
|
| 114 | ); |
|
| 115 | } |
|
| 116 | ||
| 117 | /** |
|
| 118 | * Displays a form to edit an existing Tva entity. |
|
| 119 | * |
|
| 120 | * @Route("/{id}/edit", name="admin_rate_edit", requirements={"id"="\d+"}) |
|
| 121 | * @Method("GET") |
|
| 122 | * @Template() |
|
| 123 | */ |
|
| 124 | public function editAction(Tva $tva) |
|
| 125 | { |
|
| 126 | $editForm = $this->createForm(new TvaType(), $tva, array( |
|
| 127 | 'action' => $this->generateUrl('admin_rate_update', array('id' => $tva->getId())), |
|
| 128 | 'method' => 'PUT', |
|
| 129 | )); |
|
| 130 | $deleteForm = $this->createDeleteForm($tva->getId(), 'admin_rate_delete'); |
|
| 131 | ||
| 132 | return array( |
|
| 133 | 'tva' => $tva, |
|
| 134 | 'edit_form' => $editForm->createView(), |
|
| 135 | 'delete_form' => $deleteForm->createView(), |
|
| 136 | ); |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Edits an existing Tva entity. |
|
| 141 | * |
|
| 142 | * @Route("/{id}/update", name="admin_rate_update", requirements={"id"="\d+"}) |
|
| 143 | * @Method("PUT") |
|
| 144 | * @Template("AppBundle:Tva:edit.html.twig") |
|
| 145 | */ |
|
| 146 | public function updateAction(Tva $tva, Request $request) |
|
| 147 | { |
|
| 148 | $editForm = $this->createForm(new TvaType(), $tva, array( |
|
| 149 | 'action' => $this->generateUrl('admin_rate_update', array('id' => $tva->getId())), |
|
| 150 | 'method' => 'PUT', |
|
| 151 | )); |
|
| 152 | if ($editForm->handleRequest($request)->isValid()) { |
|
| 153 | $this->getDoctrine()->getManager()->flush(); |
|
| 154 | $this->addFlash('info', 'gestock.settings.edit_ok'); |
|
| 155 | ||
| 156 | return $this->redirectToRoute('admin_rate_edit', array('id' => $tva->getId())); |
|
| 157 | } |
|
| 158 | $deleteForm = $this->createDeleteForm($tva->getId(), 'admin_rate_delete'); |
|
| 159 | ||
| 160 | return array( |
|
| 161 | 'tva' => $tva, |
|
| 162 | 'edit_form' => $editForm->createView(), |
|
| 163 | 'delete_form' => $deleteForm->createView(), |
|
| 164 | ); |
|
| 165 | } |
|
| 166 | ||
| 167 | /** |
|
| 168 | * Deletes a Tva entity. |
|
| 169 | * |
|
| 170 | * @Route("/{id}/delete", name="admin_rate_delete", requirements={"id"="\d+"}) |
|
| 171 | * @Method("DELETE") |
|
| 172 | */ |
|
| 173 | public function deleteAction(Tva $tva, Request $request) |
|
| 174 | { |
|
| 175 | $form = $this->createDeleteForm($tva->getId(), 'admin_rate_delete'); |
|
| 176 | if ($form->handleRequest($request)->isValid()) { |
|
| 177 | $em = $this->getDoctrine()->getManager(); |
|
| 178 | $em->remove($tva); |
|
| 179 | $em->flush(); |
|
| 180 | } |
|
| 181 | ||
| 182 | return $this->redirectToRoute('admin_rate'); |
|
| 183 | } |
|
| 184 | ||
| 185 | /** |
|
| 186 | * Create Delete form |
|
| 187 | * |
|
| 188 | * @param integer $id |
|
| 189 | * @param string $route |
|
| 190 | * @return \Symfony\Component\Form\Form |
|
| 191 | */ |
|
| 192 | protected function createDeleteForm($id, $route) |
|
| 193 | { |
|
| 194 | return $this->createFormBuilder(null, array('attr' => array('id' => 'delete'))) |
|
| 195 | ->setAction($this->generateUrl($route, array('id' => $id))) |
|
| 196 | ->setMethod('DELETE') |
|
| 197 | ->getForm() |
|
| 198 | ; |
|
| 199 | } |
|
| 200 | } |
|
| 201 | ||
| @@ 32-200 (lines=169) @@ | ||
| 29 | * |
|
| 30 | * @Route("/admin/settings/divers/zonestorage") |
|
| 31 | */ |
|
| 32 | class ZoneStorageController extends Controller |
|
| 33 | { |
|
| 34 | /** |
|
| 35 | * Lists all ZoneStorage entities. |
|
| 36 | * |
|
| 37 | * @Route("/", name="admin_zonestorage") |
|
| 38 | * @Method("GET") |
|
| 39 | * @Template() |
|
| 40 | */ |
|
| 41 | public function indexAction() |
|
| 42 | { |
|
| 43 | $em = $this->getDoctrine()->getManager(); |
|
| 44 | $entities = $em->getRepository('AppBundle:ZoneStorage')->findAll(); |
|
| 45 | ||
| 46 | return array( |
|
| 47 | 'entities' => $entities, |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Finds and displays a ZoneStorage entity. |
|
| 53 | * |
|
| 54 | * @Route("/{slug}/show", name="admin_zonestorage_show") |
|
| 55 | * @Method("GET") |
|
| 56 | * @Template() |
|
| 57 | */ |
|
| 58 | public function showAction(ZoneStorage $zonestorage) |
|
| 59 | { |
|
| 60 | $deleteForm = $this->createDeleteForm($zonestorage->getId(), 'admin_zonestorage_delete'); |
|
| 61 | ||
| 62 | return array( |
|
| 63 | 'zonestorage' => $zonestorage, |
|
| 64 | 'delete_form' => $deleteForm->createView(), |
|
| 65 | ); |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * Displays a form to create a new ZoneStorage entity. |
|
| 70 | * |
|
| 71 | * @Route("/new", name="admin_zonestorage_new") |
|
| 72 | * @Method("GET") |
|
| 73 | * @Template() |
|
| 74 | */ |
|
| 75 | public function newAction() |
|
| 76 | { |
|
| 77 | $zonestorage = new ZoneStorage(); |
|
| 78 | $form = $this->createForm(new ZoneStorageType(), $zonestorage); |
|
| 79 | ||
| 80 | return array( |
|
| 81 | 'zonestorage' => $zonestorage, |
|
| 82 | 'form' => $form->createView(), |
|
| 83 | ); |
|
| 84 | } |
|
| 85 | ||
| 86 | /** |
|
| 87 | * Creates a new ZoneStorage entity. |
|
| 88 | * |
|
| 89 | * @Route("/create", name="admin_zonestorage_create") |
|
| 90 | * @Method("POST") |
|
| 91 | * @Template("AppBundle:Settings/Divers/ZoneStorage:new.html.twig") |
|
| 92 | */ |
|
| 93 | public function createAction(Request $request) |
|
| 94 | { |
|
| 95 | $zonestorage = new ZoneStorage(); |
|
| 96 | $form = $this->createForm(new ZoneStorageType(), $zonestorage); |
|
| 97 | if ($form->handleRequest($request)->isValid()) { |
|
| 98 | $em = $this->getDoctrine()->getManager(); |
|
| 99 | $em->persist($zonestorage); |
|
| 100 | $em->flush(); |
|
| 101 | ||
| 102 | if ($form->get('save')->isSubmitted()) { |
|
| 103 | $url = $this->redirectToRoute('admin_zonestorage_show', array('slug' => $zonestorage->getSlug())); |
|
| 104 | } elseif ($form->get('addmore')->isSubmitted()) { |
|
| 105 | $this->addFlash('info', 'gestock.settings.add_ok'); |
|
| 106 | $url = $this->redirect($this->generateUrl('admin_zonestorage_new')); |
|
| 107 | } |
|
| 108 | return $url; |
|
| 109 | } |
|
| 110 | ||
| 111 | return array( |
|
| 112 | 'zonestorage' => $zonestorage, |
|
| 113 | 'form' => $form->createView(), |
|
| 114 | ); |
|
| 115 | } |
|
| 116 | ||
| 117 | /** |
|
| 118 | * Displays a form to edit an existing ZoneStorage entity. |
|
| 119 | * |
|
| 120 | * @Route("/{slug}/edit", name="admin_zonestorage_edit") |
|
| 121 | * @Method("GET") |
|
| 122 | * @Template() |
|
| 123 | */ |
|
| 124 | public function editAction(ZoneStorage $zonestorage) |
|
| 125 | { |
|
| 126 | $editForm = $this->createForm(new ZoneStorageType(), $zonestorage, array( |
|
| 127 | 'action' => $this->generateUrl('admin_zonestorage_update', array('slug' => $zonestorage->getSlug())), |
|
| 128 | 'method' => 'PUT', |
|
| 129 | )); |
|
| 130 | $deleteForm = $this->createDeleteForm($zonestorage->getId(), 'admin_zonestorage_delete'); |
|
| 131 | ||
| 132 | return array( |
|
| 133 | 'zonestorage' => $zonestorage, |
|
| 134 | 'edit_form' => $editForm->createView(), |
|
| 135 | 'delete_form' => $deleteForm->createView(), |
|
| 136 | ); |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Edits an existing ZoneStorage entity. |
|
| 141 | * |
|
| 142 | * @Route("/{slug}/update", name="admin_zonestorage_update") |
|
| 143 | * @Method("PUT") |
|
| 144 | * @Template("AppBundle:Settings/Divers/ZoneStorage:edit.html.twig") |
|
| 145 | */ |
|
| 146 | public function updateAction(ZoneStorage $zonestorage, Request $request) |
|
| 147 | { |
|
| 148 | $editForm = $this->createForm(new ZoneStorageType(), $zonestorage, array( |
|
| 149 | 'action' => $this->generateUrl('admin_zonestorage_update', array('slug' => $zonestorage->getSlug())), |
|
| 150 | 'method' => 'PUT', |
|
| 151 | )); |
|
| 152 | if ($editForm->handleRequest($request)->isValid()) { |
|
| 153 | $this->getDoctrine()->getManager()->flush(); |
|
| 154 | $this->addFlash('info', 'gestock.settings.edit_ok'); |
|
| 155 | ||
| 156 | return $this->redirectToRoute('admin_zonestorage_edit', array('slug' => $zonestorage->getSlug())); |
|
| 157 | } |
|
| 158 | $deleteForm = $this->createDeleteForm($zonestorage->getId(), 'admin_zonestorage_delete'); |
|
| 159 | ||
| 160 | return array( |
|
| 161 | 'zonestorage' => $zonestorage, |
|
| 162 | 'edit_form' => $editForm->createView(), |
|
| 163 | 'delete_form' => $deleteForm->createView(), |
|
| 164 | ); |
|
| 165 | } |
|
| 166 | ||
| 167 | /** |
|
| 168 | * Deletes a ZoneStorage entity. |
|
| 169 | * |
|
| 170 | * @Route("/{id}/delete", name="admin_zonestorage_delete", requirements={"id"="\d+"}) |
|
| 171 | * @Method("DELETE") |
|
| 172 | */ |
|
| 173 | public function deleteAction(ZoneStorage $zonestorage, Request $request) |
|
| 174 | { |
|
| 175 | $form = $this->createDeleteForm($zonestorage->getId(), 'admin_zonestorage_delete'); |
|
| 176 | if ($form->handleRequest($request)->isValid()) { |
|
| 177 | $em = $this->getDoctrine()->getManager(); |
|
| 178 | $em->remove($zonestorage); |
|
| 179 | $em->flush(); |
|
| 180 | } |
|
| 181 | ||
| 182 | return $this->redirectToRoute('admin_zonestorage'); |
|
| 183 | } |
|
| 184 | ||
| 185 | /** |
|
| 186 | * Create Delete form |
|
| 187 | * |
|
| 188 | * @param integer $id |
|
| 189 | * @param string $route |
|
| 190 | * @return \Symfony\Component\Form\Form |
|
| 191 | */ |
|
| 192 | protected function createDeleteForm($id, $route) |
|
| 193 | { |
|
| 194 | return $this->createFormBuilder(null, array('attr' => array('id' => 'delete'))) |
|
| 195 | ->setAction($this->generateUrl($route, array('id' => $id))) |
|
| 196 | ->setMethod('DELETE') |
|
| 197 | ->getForm() |
|
| 198 | ; |
|
| 199 | } |
|
| 200 | } |
|
| 201 | ||