# see https://symfony.com/doc/current/reference/configuration/framework.html | # see https://symfony.com/doc/current/reference/configuration/framework.html | ||||
lc_sov: | lc_sov: | ||||
homepage_route: 'app_homepage' | |||||
homepage_route: 'app_homepage' | |||||
login_redirection: | |||||
redirect_referer: false | |||||
roles_redirection: | |||||
- { role: "ROLE_ADMIN", redirect: "admin_dashboard" } | |||||
- { role: "ROLE_ANIMATOR", redirect: "admin_dashboard_animator" } | |||||
- { role: "ROLE_SUPER_ADMIN", redirect: "admin_dashboard" } |
path: /admin | path: /admin | ||||
controller: App\Controller\Admin\DashboardController::index | controller: App\Controller\Admin\DashboardController::index | ||||
admin_dashboard_animator: | |||||
path: /admin-animator | |||||
controller: App\Controller\Admin\DashboardAnimatorController::index | |||||
app_homepage: | app_homepage: | ||||
path: / | path: / | ||||
controller: App\Controller\Frontend\DefaultController:home | controller: App\Controller\Frontend\DefaultController:home |
<?php | |||||
namespace App\Controller\Admin; | |||||
use App\Entity\CollectifData; | |||||
use App\Entity\Common\TaxRate; | |||||
use App\Entity\Configuration; | |||||
use App\Entity\IndividualData; | |||||
use App\Entity\Site\Page; | |||||
use App\Entity\Territory; | |||||
use App\Entity\Thematic; | |||||
use App\Entity\User\GroupUser; | |||||
use App\Entity\User\User; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Assets; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem; | |||||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | |||||
use Lc\SovBundle\Controller\Admin\DashboardController as SovDashboardController; | |||||
use Symfony\Component\HttpFoundation\Response; | |||||
class DashboardAnimatorController extends SovDashboardController | |||||
{ | |||||
private $adminUrlGenerator; | |||||
public function __construct(AdminUrlGenerator $adminUrlGenerator) | |||||
{ | |||||
$this->adminUrlGenerator = $adminUrlGenerator; | |||||
} | |||||
public function configureMenuItems(): iterable | |||||
{ | |||||
$urlCreate = $this->adminUrlGenerator | |||||
->setController(CollectifDataCrudController::class) | |||||
->setAction('new') | |||||
->generateUrl(); | |||||
yield MenuItem::linkToDashboard('dashboard', 'circle'); | |||||
yield MenuItem::subMenu('account', 'user') | |||||
->setSubItems( | |||||
[ | |||||
MenuItem::linkToRoute('account_profile', '', 'sov_admin_account_profile'), | |||||
MenuItem::linkToRoute('account_password', '', 'sov_admin_account_password'), | |||||
] | |||||
); | |||||
yield MenuItem::linkToUrl('data_collectif_create', '', $urlCreate); | |||||
} | |||||
} |
namespace App\Controller\Admin; | namespace App\Controller\Admin; | ||||
use App\Entity\CollectifData; | |||||
use App\Entity\Common\TaxRate; | use App\Entity\Common\TaxRate; | ||||
use App\Entity\Configuration; | use App\Entity\Configuration; | ||||
use App\Entity\IndividualData; | use App\Entity\IndividualData; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Assets; | use EasyCorp\Bundle\EasyAdminBundle\Config\Assets; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; | use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem; | use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | |||||
use Lc\SovBundle\Controller\Admin\DashboardController as SovDashboardController; | use Lc\SovBundle\Controller\Admin\DashboardController as SovDashboardController; | ||||
class DashboardController extends SovDashboardController | class DashboardController extends SovDashboardController | ||||
{ | { | ||||
const ROLE_ADMIN = "ROLE_ADMIN"; | |||||
const ROLE_SUPER_ADMIN = "ROLE_SUPER_ADMIN"; | |||||
private $adminUrlGenerator; | |||||
public function __construct(AdminUrlGenerator $adminUrlGenerator) | |||||
{ | |||||
$this->adminUrlGenerator = $adminUrlGenerator; | |||||
} | |||||
public function configureMenuItems(): iterable | public function configureMenuItems(): iterable | ||||
{ | { | ||||
$urlCreate = $this->adminUrlGenerator | |||||
->setController(CollectifDataCrudController::class) | |||||
->setAction('new') | |||||
->generateUrl(); | |||||
yield MenuItem::linkToDashboard('dashboard', 'circle'); | yield MenuItem::linkToDashboard('dashboard', 'circle'); | ||||
yield MenuItem::linkToCrud('page', 'copy', Page::class); | |||||
yield MenuItem::subMenu('account', 'user')->setSubItems( | |||||
[ | |||||
MenuItem::linkToRoute('account_profile', '', 'sov_admin_account_profile'), | |||||
MenuItem::linkToRoute('account_password', '', 'sov_admin_account_password'), | |||||
] | |||||
); | |||||
yield MenuItem::subMenu('user', 'user')->setSubItems( | |||||
yield MenuItem::subMenu('account', 'user') | |||||
->setSubItems( | |||||
[ | |||||
MenuItem::linkToRoute('account_profile', '', 'sov_admin_account_profile'), | |||||
MenuItem::linkToRoute('account_password', '', 'sov_admin_account_password'), | |||||
] | |||||
); | |||||
yield MenuItem::subMenu('user', 'user') | |||||
->setPermission(self::ROLE_ADMIN) | |||||
->setSubItems( | |||||
[ | [ | ||||
MenuItem::linkToCrud('user_index', '', User::class), | |||||
MenuItem::linkToCrud('user_index', '', User::class), | |||||
] | ] | ||||
); | |||||
yield MenuItem::subMenu('data_individual', 'user')->setSubItems( | |||||
); | |||||
yield MenuItem::subMenu('data_individual', 'user') | |||||
->setPermission(self::ROLE_ADMIN) | |||||
->setSubItems( | |||||
[ | [ | ||||
MenuItem::linkToCrud('data_individual_validate', '', IndividualData::class), | |||||
MenuItem::linkToCrud('data_individual_waiting', '', IndividualData::class), | |||||
MenuItem::linkToCrud('data_individual_validate', '', IndividualData::class), | |||||
MenuItem::linkToCrud('data_individual_waiting', '', IndividualData::class), | |||||
] | ] | ||||
); | |||||
yield MenuItem::subMenu('data_collectif', 'user')->setSubItems( | |||||
); | |||||
yield MenuItem::subMenu('data_collectif', 'user') | |||||
->setPermission(self::ROLE_ADMIN) | |||||
->setSubItems( | |||||
[ | [ | ||||
MenuItem::linkToCrud('data_collectif_validate', '', IndividualData::class), | |||||
MenuItem::linkToCrud('data_collectif_waiting', '', IndividualData::class), | |||||
MenuItem::linkToCrud('data_collectif_validate', '', CollectifData::class), | |||||
MenuItem::linkToCrud('data_collectif_waiting', '', CollectifData::class), | |||||
] | ] | ||||
); | |||||
yield MenuItem::linkToCrud('thematic', 'copy', Thematic::class); | |||||
yield MenuItem::linkToCrud('territory', 'copy', Territory::class); | |||||
yield MenuItem::linkToCrud('configuration', 'copy', Configuration::class); | |||||
); | |||||
yield MenuItem::linkToCrud('thematic', 'copy', Thematic::class) | |||||
->setPermission(self::ROLE_ADMIN); | |||||
yield MenuItem::linkToCrud('territory', 'copy', Territory::class) | |||||
->setPermission(self::ROLE_SUPER_ADMIN); | |||||
yield MenuItem::linkToCrud('configuration', 'copy', Configuration::class) | |||||
->setPermission(self::ROLE_SUPER_ADMIN); | |||||
yield MenuItem::linkToCrud('page', 'copy', Page::class) | |||||
->setPermission(self::ROLE_ADMIN); | |||||
} | } | ||||
} | } |
SessionInterface $session, | SessionInterface $session, | ||||
RequestStack $request, | RequestStack $request, | ||||
EntityManager $em, | EntityManager $em, | ||||
Environment $twig, | |||||
TranslatorAdmin $translatorAdmin, | TranslatorAdmin $translatorAdmin, | ||||
Environment $twig, | |||||
UserPasswordEncoderInterface $passwordEncoder, | UserPasswordEncoderInterface $passwordEncoder, | ||||
EntityManager $entityManager, | EntityManager $entityManager, | ||||
MailerInterface $mailerInterface | MailerInterface $mailerInterface | ||||
$this->entityManager = $entityManager; | $this->entityManager = $entityManager; | ||||
$this->mailerInterface = $mailerInterface; | $this->mailerInterface = $mailerInterface; | ||||
parent::__construct($session, $request, $em, $twig, $translatorAdmin); | |||||
parent::__construct($session, $request, $em, $translatorAdmin ,$twig); | |||||
} | } | ||||
public static function getEntityFqcn(): string | public static function getEntityFqcn(): string |
$this->projectsInspiring = new ArrayCollection(); | $this->projectsInspiring = new ArrayCollection(); | ||||
} | } | ||||
public function __toString() | |||||
{ | |||||
return $this->nbParticipant; | |||||
} | |||||
public function getId(): ?int | public function getId(): ?int | ||||
{ | { | ||||
return $this->id; | return $this->id; |
data_collectif: Formulaire collectif | data_collectif: Formulaire collectif | ||||
data_collectif_validate: Données validées | data_collectif_validate: Données validées | ||||
data_collectif_waiting: Données en attente de validation | data_collectif_waiting: Données en attente de validation | ||||
data_collectif_create: Formulaire collectif | |||||
territory: Territoires | territory: Territoires | ||||
thematic: Thématiques | thematic: Thématiques | ||||
configuration: Configuration question Intro | configuration: Configuration question Intro |