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ů.

104 lines
4.1KB

  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. public function index(): Response
  18. {
  19. return $this->render('@LcSov/adminlte/dashboard.html.twig');
  20. }
  21. public function configureDashboard(): Dashboard
  22. {
  23. return Dashboard::new()
  24. // the name visible to end users
  25. ->setTitle('LA CLIC !')
  26. // you can include HTML contents too (e.g. to link to an image)
  27. ->setTitle('<img src="assets/img/'.$this->get('parameter_bag')->get('app.admin.logo').'" width="100px">')
  28. // the path defined in this method is passed to the Twig asset() function
  29. ->setFaviconPath('assets/img/frontend/favicon-pdl.png')
  30. // the domain used by default is 'messages'
  31. ->setTranslationDomain('admin');
  32. }
  33. public function configureAssets(): Assets
  34. {
  35. $assets = parent::configureAssets();
  36. $assets->addWebpackEncoreEntry('adminlte-plugins');
  37. $assets->addWebpackEncoreEntry('adminlte-index');
  38. $assets->addWebpackEncoreEntry('adminlte-form');
  39. $assets->addWebpackEncoreEntry('adminlte-sort');
  40. $assets->addWebpackEncoreEntry('adminlte-field-collection');
  41. $assets->addWebpackEncoreEntry('adminlte-field-filemanager');
  42. $assets->addWebpackEncoreEntry('adminlte-main');
  43. $assets->addWebpackEncoreEntry('sov-reminder');
  44. return $assets;
  45. }
  46. public function configureUserMenu(UserInterface $user): UserMenu
  47. {
  48. // Usually it's better to call the parent method because that gives you a
  49. // user menu with some menu items already created ("sign out", "exit impersonation", etc.)
  50. // if you prefer to create the user menu from scratch, use: return UserMenu::new()->...
  51. return parent::configureUserMenu($user)
  52. // use the given $user object to get the user name
  53. ->setName($user->getFirstName())
  54. // use this method if you don't want to display the name of the user
  55. //->displayUserName(false)
  56. ->displayUserAvatar(false)
  57. // you can also pass an email address to use gravatar's service
  58. ->setGravatarEmail($user->getEmail())
  59. // you can use any type of menu item, except submenus
  60. ->setMenuItems(
  61. [
  62. //MenuItem::linkToRoute('My Profile', 'fa fa-id-card', '', ['...' => '...']),
  63. MenuItem::linkToLogout('Déconnexion', 'sign-out-alt'),
  64. //MenuItem::linkToLogout('Déconnexion', 'sign-out-alt')
  65. ]
  66. );
  67. }
  68. public function configureCrud(): Crud
  69. {
  70. $crud = Crud::new();
  71. return $crud
  72. ->overrideTemplates(
  73. [
  74. 'layout' => '@LcSov/adminlte/layout.html.twig',
  75. 'main_menu' => '@LcSov/adminlte/block/menu.html.twig',
  76. 'crud/index' => '@LcSov/adminlte/crud/index.html.twig',
  77. 'crud/paginator' => '@LcSov/adminlte/crud/paginator.html.twig',
  78. 'crud/edit' => '@LcSov/adminlte/crud/form.html.twig',
  79. 'crud/new' => '@LcSov/adminlte/crud/form.html.twig',
  80. 'flash_messages' => '@LcSov/adminlte/block/flash_messages.html.twig',
  81. ]
  82. )
  83. ->setFormThemes(
  84. [
  85. '@LcSov/adminlte/crud/form_theme.html.twig',
  86. //'@FOSCKEditor/Form/ckeditor_widget.html.twig'
  87. ]
  88. );
  89. }
  90. }