Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

105 lines
4.0KB

  1. <?php
  2. namespace Lc\SovBundle\Controller\Dashboard;
  3. use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
  4. use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
  5. use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
  6. use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
  7. use EasyCorp\Bundle\EasyAdminBundle\Config\UserMenu;
  8. use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
  9. use Lc\SovBundle\Controller\ControllerTrait;
  10. use Lc\SovBundle\Doctrine\EntityManager;
  11. use Symfony\Component\Security\Core\User\UserInterface;
  12. use Symfony\Component\HttpFoundation\Response;
  13. use Symfony\Component\Routing\Annotation\Route;
  14. class DashboardAdminController extends AbstractDashboardController
  15. {
  16. use ControllerTrait;
  17. /**
  18. * @Route("/admin", name="app_admin_dashboard")
  19. */
  20. public function index(): Response
  21. {
  22. return $this->render('@LcSov/adminlte/dashboard.html.twig');
  23. }
  24. public function configureDashboard(): Dashboard
  25. {
  26. return Dashboard::new()
  27. // the name visible to end users
  28. ->setTitle('LA CLIC !')
  29. // the path defined in this method is passed to the Twig asset() function
  30. ->setFaviconPath('assets/img/frontend/favicon-pdl.png')
  31. // the domain used by default is 'messages'
  32. ->setTranslationDomain('admin');
  33. }
  34. public function configureAssets(): Assets
  35. {
  36. $assets = parent::configureAssets();
  37. $assets->addWebpackEncoreEntry('adminlte-plugins');
  38. $assets->addWebpackEncoreEntry('adminlte-index');
  39. $assets->addWebpackEncoreEntry('adminlte-form');
  40. $assets->addWebpackEncoreEntry('adminlte-sort');
  41. $assets->addWebpackEncoreEntry('adminlte-field-collection');
  42. $assets->addWebpackEncoreEntry('adminlte-field-filemanager');
  43. $assets->addWebpackEncoreEntry('adminlte-main');
  44. $assets->addWebpackEncoreEntry('sov-reminder');
  45. return $assets;
  46. }
  47. public function configureUserMenu(UserInterface $user): UserMenu
  48. {
  49. // Usually it's better to call the parent method because that gives you a
  50. // user menu with some menu items already created ("sign out", "exit impersonation", etc.)
  51. // if you prefer to create the user menu from scratch, use: return UserMenu::new()->...
  52. return parent::configureUserMenu($user)
  53. // use the given $user object to get the user name
  54. ->setName($user->getFirstName())
  55. // use this method if you don't want to display the name of the user
  56. //->displayUserName(false)
  57. ->displayUserAvatar(false)
  58. // you can also pass an email address to use gravatar's service
  59. ->setGravatarEmail($user->getEmail())
  60. // you can use any type of menu item, except submenus
  61. ->setMenuItems(
  62. [
  63. //MenuItem::linkToRoute('My Profile', 'fa fa-id-card', '', ['...' => '...']),
  64. MenuItem::linkToLogout('Déconnexion', 'sign-out-alt'),
  65. //MenuItem::linkToLogout('Déconnexion', 'sign-out-alt')
  66. ]
  67. );
  68. }
  69. public function configureCrud(): Crud
  70. {
  71. $crud = Crud::new();
  72. return $crud
  73. ->overrideTemplates(
  74. [
  75. 'layout' => '@LcSov/adminlte/layout.html.twig',
  76. 'main_menu' => '@LcSov/adminlte/block/menu.html.twig',
  77. 'crud/index' => '@LcSov/adminlte/crud/index.html.twig',
  78. 'crud/paginator' => '@LcSov/adminlte/crud/paginator.html.twig',
  79. 'crud/edit' => '@LcSov/adminlte/crud/form.html.twig',
  80. 'crud/new' => '@LcSov/adminlte/crud/form.html.twig',
  81. 'flash_messages' => '@LcSov/adminlte/block/flash_messages.html.twig',
  82. ]
  83. )
  84. ->setFormThemes(
  85. [
  86. '@LcSov/adminlte/crud/form_theme.html.twig',
  87. //'@FOSCKEditor/Form/ckeditor_widget.html.twig'
  88. ]
  89. );
  90. }
  91. }