mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
rdv: pages by User
This commit is contained in:
@@ -80,11 +80,10 @@ class CalendarController extends AbstractController
|
||||
|
||||
if ($user instanceof User) {
|
||||
|
||||
// $calendar = $em->getRepository(Calendar::class)
|
||||
// ->findByUser($user)
|
||||
// ;
|
||||
|
||||
// $view = 'ChillCalendarBundle:Calendar:listByUser.html.twig';
|
||||
$calendarItems = $em->getRepository(Calendar::class)
|
||||
->findByUser($user)
|
||||
;
|
||||
$view = 'ChillCalendarBundle:Calendar:listByUser.html.twig';
|
||||
} elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||
$calendarItems = $em->getRepository(Calendar::class)->findBy(
|
||||
['accompanyingPeriod' => $accompanyingPeriod],
|
||||
@@ -174,11 +173,11 @@ class CalendarController extends AbstractController
|
||||
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
||||
|
||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||
$view = 'ChillCalendarBundle:Calendar:showAccompanyingCourse.html.twig';
|
||||
$view = 'ChillCalendarBundle:Calendar:showByAccompanyingCourse.html.twig';
|
||||
}
|
||||
// elseif ($person instanceof Person) {
|
||||
// $view = 'ChillCalendarBundle:Calendar:showPerson.html.twig';
|
||||
// }
|
||||
elseif ($user instanceof User) {
|
||||
$view = 'ChillCalendarBundle:Calendar:showByUser.html.twig';
|
||||
}
|
||||
|
||||
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
|
||||
|
||||
@@ -198,9 +197,9 @@ class CalendarController extends AbstractController
|
||||
}
|
||||
|
||||
return $this->render($view, [
|
||||
//'person' => $person,
|
||||
'accompanyingCourse' => $accompanyingPeriod,
|
||||
'entity' => $entity,
|
||||
'user' => $user
|
||||
//'delete_form' => $deleteForm->createView(),
|
||||
]);
|
||||
}
|
||||
@@ -218,11 +217,11 @@ class CalendarController extends AbstractController
|
||||
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
||||
|
||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||
$view = 'ChillCalendarBundle:Calendar:editAccompanyingCourse.html.twig';
|
||||
$view = 'ChillCalendarBundle:Calendar:editByAccompanyingCourse.html.twig';
|
||||
}
|
||||
elseif ($user instanceof User) {
|
||||
$view = 'ChillCalendarBundle:Calendar:editByUser.html.twig';
|
||||
}
|
||||
// elseif ($person instanceof Person) {
|
||||
// $view = 'ChillCalendarBundle:Calendar:editPerson.html.twig';
|
||||
// }
|
||||
|
||||
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
|
||||
|
||||
@@ -259,6 +258,7 @@ class CalendarController extends AbstractController
|
||||
'form' => $form->createView(),
|
||||
'delete_form' => $deleteForm->createView(),
|
||||
'accompanyingCourse' => $accompanyingPeriod,
|
||||
'user' => $user,
|
||||
'entity_json' => $entity_array
|
||||
]);
|
||||
}
|
||||
@@ -274,11 +274,11 @@ class CalendarController extends AbstractController
|
||||
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
||||
|
||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||
$view = 'ChillCalendarBundle:Calendar:confirm_deleteAccompanyingCourse.html.twig';
|
||||
$view = 'ChillCalendarBundle:Calendar:confirm_deleteByAccompanyingCourse.html.twig';
|
||||
}
|
||||
// elseif ($person instanceof Person) {
|
||||
// $view = 'ChillCalendarBundle:Calendar:confirm_deletePerson.html.twig';
|
||||
// }
|
||||
elseif ($user instanceof User) {
|
||||
$view = 'ChillCalendarBundle:Calendar:confirm_deleteByUser.html.twig';
|
||||
}
|
||||
|
||||
/* @var $entity Calendar */
|
||||
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
|
||||
@@ -324,9 +324,9 @@ class CalendarController extends AbstractController
|
||||
/**
|
||||
* Creates a form to delete a Calendar entity by id.
|
||||
*/
|
||||
private function createDeleteForm(int $id, ?Person $person, ?AccompanyingPeriod $accompanyingPeriod): Form
|
||||
private function createDeleteForm(int $id, ?User $user, ?AccompanyingPeriod $accompanyingPeriod): Form
|
||||
{
|
||||
$params = $this->buildParamsToUrl($person, $accompanyingPeriod);
|
||||
$params = $this->buildParamsToUrl($user, $accompanyingPeriod);
|
||||
$params['id'] = $id;
|
||||
|
||||
return $this->createFormBuilder()
|
||||
@@ -350,7 +350,8 @@ class CalendarController extends AbstractController
|
||||
throw $this->createNotFoundException('User not found');
|
||||
}
|
||||
|
||||
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $user);
|
||||
// TODO Add permission
|
||||
// $this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $user);
|
||||
} elseif ($request->query->has('accompanying_period_id')) {
|
||||
$accompanying_period_id = $request->get('accompanying_period_id');
|
||||
$accompanyingPeriod = $em->getRepository(AccompanyingPeriod::class)->find($accompanying_period_id);
|
||||
|
Reference in New Issue
Block a user