| @@ 150-161 (lines=12) @@ | ||
| 147 | */ |
|
| 148 | public function activityDeleteAction(Activity $activity, Request $request) |
|
| 149 | { |
|
| 150 | if ('POST' === $request->getMethod() && $request->request->has('delete')) { |
|
| 151 | ||
| 152 | // Eliminar el departamento de la base de datos |
|
| 153 | $this->getDoctrine()->getManager()->remove($activity); |
|
| 154 | try { |
|
| 155 | $this->getDoctrine()->getManager()->flush(); |
|
| 156 | $this->addFlash('success', $this->get('translator')->trans('alert.deleted', [], 'activity')); |
|
| 157 | } catch (\Exception $e) { |
|
| 158 | $this->addFlash('error', $this->get('translator')->trans('alert.not_deleted', [], 'activity')); |
|
| 159 | } |
|
| 160 | return $this->redirectToRoute('admin_program_training', ['id' => $activity->getTraining()->getId()]); |
|
| 161 | } |
|
| 162 | ||
| 163 | $title = (string) $activity->getName(); |
|
| 164 | ||
| @@ 134-145 (lines=12) @@ | ||
| 131 | */ |
|
| 132 | public function genericDeleteAction(User $element, Request $request) |
|
| 133 | { |
|
| 134 | if ('POST' === $request->getMethod() && $request->request->has('delete')) { |
|
| 135 | ||
| 136 | // Eliminar el departamento de la base de datos |
|
| 137 | $this->getDoctrine()->getManager()->remove($element); |
|
| 138 | try { |
|
| 139 | $this->getDoctrine()->getManager()->flush(); |
|
| 140 | $this->addFlash('success', $this->get('translator')->trans('alert.deleted', [], 'user')); |
|
| 141 | } catch (\Exception $e) { |
|
| 142 | $this->addFlash('error', $this->get('translator')->trans('alert.not_deleted', [], 'user')); |
|
| 143 | } |
|
| 144 | return $this->redirectToRoute('admin_users'); |
|
| 145 | } |
|
| 146 | ||
| 147 | $title = (string) $element; |
|
| 148 | ||
| @@ 128-140 (lines=13) @@ | ||
| 125 | ||
| 126 | $form->handleRequest($request); |
|
| 127 | ||
| 128 | if ($form->isSubmitted() && $form->isValid()) { |
|
| 129 | ||
| 130 | // Guardar el usuario en la base de datos |
|
| 131 | ||
| 132 | // Probar a guardar los cambios |
|
| 133 | try { |
|
| 134 | $this->getDoctrine()->getManager()->flush(); |
|
| 135 | $this->addFlash('success', $this->get('translator')->trans('alert.saved', [], 'student')); |
|
| 136 | return $this->redirectToRoute('admin_group_students', ['id' => $student->getStudentGroup()->getId()]); |
|
| 137 | } catch (\Exception $e) { |
|
| 138 | $this->addFlash('error', $this->get('translator')->trans('alert.not_saved', [], 'student')); |
|
| 139 | } |
|
| 140 | } |
|
| 141 | return $this->render('group/form_student.html.twig', |
|
| 142 | [ |
|
| 143 | 'menu_item' => $this->get('app.menu_builders_chain')->getMenuItemByRouteName('admin_tutor_group'), |
|