Switch to new civility_class naming
Cleanup
//Fetch doctrine
$doctrine = $this->getDoctrine();
//Fetch doctrine
$doctrine = $this->getDoctrine();
- //Set section
- $section = $this->translator->trans('Libre Air users');
+ //With admin role
+ if ($this->isGranted('ROLE_ADMIN')) {
+ //Set section
+ $section = $this->translator->trans('Libre Air users');
- //Set description
- $this->context['description'] = $this->translator->trans('Libre Air user list');
+ //Set description
+ $this->context['description'] = $this->translator->trans('Libre Air user list');
+ //Without admin role
+ } else {
+ //Set section
+ $section = $this->translator->trans('Libre Air organizers');
+
+ //Set description
+ $this->context['description'] = $this->translator->trans('Libre Air organizers list');
+ }
//Set keywords
$this->context['keywords'] = [
//Set keywords
$this->context['keywords'] = [
+ //With admin role
+ if ($this->isGranted('ROLE_ADMIN')) {
+ //Display all users
+ $this->context['groups'] = $users;
- if (!$this->isGranted('ROLE_ADMIN')) {
- //Remove users
- unset($users[$this->translator->trans('User')]);
+ } else {
+ //Only display senior organizers
+ $this->context['users'] = $users[$this->translator->trans('Senior')];
$locations = $doctrine->getRepository(Location::class)->findTranslatedSortedByPeriod($this->translator, $period);
//Render the view
$locations = $doctrine->getRepository(Location::class)->findTranslatedSortedByPeriod($this->translator, $period);
//Render the view
- return $this->render('@RapsysAir/user/index.html.twig', ['title' => $title, 'section' => $section, 'users' => $users, 'locations' => $locations]+$this->context);
+ return $this->render('@RapsysAir/user/index.html.twig', ['title' => $title, 'section' => $section, 'locations' => $locations]+$this->context);
//Set the form attribute
'attr' => [ 'class' => 'col' ],
//Set civility class
//Set the form attribute
'attr' => [ 'class' => 'col' ],
//Set civility class
- 'class_civility' => Civility::class,
+ 'civility_class' => Civility::class,
//Disable mail
'mail' => $this->isGranted('ROLE_ADMIN'),
//Disable password
//Disable mail
'mail' => $this->isGranted('ROLE_ADMIN'),
//Disable password
}
//Create SnippetType form
}
//Create SnippetType form
- #$form = $this->createForm('Rapsys\AirBundle\Form\SnippetType', $snippet, [
$form = $this->container->get('form.factory')->createNamed('snipped_'.$request->getLocale().'_'.$locationId, 'Rapsys\AirBundle\Form\SnippetType', $snippet, [
//Set the action
$form = $this->container->get('form.factory')->createNamed('snipped_'.$request->getLocale().'_'.$locationId, 'Rapsys\AirBundle\Form\SnippetType', $snippet, [
//Set the action
- //TODO: voir si on peut pas faire sauter ça ici
'action' =>
!empty($snippet->getId()) ?
$this->generateUrl('rapsys_air_snippet_edit', ['id' => $snippet->getId()]) :
$this->generateUrl('rapsys_air_snippet_add', ['location' => $locationId]),
'action' =>
!empty($snippet->getId()) ?
$this->generateUrl('rapsys_air_snippet_edit', ['id' => $snippet->getId()]) :
$this->generateUrl('rapsys_air_snippet_add', ['location' => $locationId]),
- #'action' => $this->generateUrl('rapsys_air_snippet_add'),
- 'attr' => [],
- //Set csrf_token_id
- //TODO: would maybe need a signature field
- //'csrf_token_id' => $request->getLocale().'_'.$id.'_'.$locationId
- #return $this->container->get('form.factory')->create($type, $data, $options);
- #public function createNamed($name, $type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = []);
//Add form to context
$this->context['forms']['snippets'][$locationId] = $form->createView();
//Add form to context
$this->context['forms']['snippets'][$locationId] = $form->createView();