src/Controller/HomeController.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use App\Repository\UserPlatformRepository;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. use Doctrine\ORM\EntityManagerInterface;
  9. use App\Acme\Bundle\Utility\ViewUtility\UtilityMenusBackend;
  10. use App\Acme\Bundle\Utility\TemplatesUtility\MenusStandard;
  11. use App\Form\SubscriptionForm\UserMultilType;
  12. use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
  13. use App\Entity\UserPlatform;
  14. use App\Entity\TypeOne;
  15. use App\Service\ExcelExporter;
  16. class HomeController extends AbstractController
  17. {
  18.     /**
  19.      * @Route("/", name="app_home")
  20.      */
  21.     public function index(EntityManagerInterface $entityManager): Response
  22.     {
  23.         return $this->redirectToRoute('app_product_back_new', [], Response::HTTP_SEE_OTHER);
  24.     }
  25.     /**
  26.      * @Route("/template-login", name="app_template_login")
  27.      */
  28.     public function templatesLogin(EntityManagerInterface $entityManager): Response
  29.     {
  30.         return $this->render('backView/templates_login.html.twig', [
  31.         ]);
  32.     }
  33.     /**
  34.      * @Route("/template-administration", name="app_template_admin")
  35.      */
  36.     public function templatesAdmin(EntityManagerInterface $entityManager): Response
  37.     {
  38.         /*return $this->render('backView/templates_admin.html.twig', [
  39.         ]);*/
  40.         return $this->render('backView/templates_admin_two.html.twig', [
  41.         ]);
  42.         
  43.     }
  44.     /**
  45.      * @Route("/export-excel", name="app_template_export")
  46.      */
  47.     public function exportToExcel(): Response
  48.     {
  49.         $headers = ['Header 1''Header 2''Header 3'];
  50.         // Simuler des données de la table
  51.         $data = [
  52.             ['Data 1''Data 2''Data 3'],
  53.             ['Data 4''Data 5''Data 6'],
  54.             // Ajoutez vos données ici...
  55.         ];
  56.         // Exporter les données vers un fichier Excel
  57.         ExcelExporter::exportTableToExcel($headers$data'exported_data.xlsx');
  58.         
  59.         return new Response();
  60.     }
  61.      
  62.     /**
  63.      * @Route("/access-denied", name="app_home_access_denied")
  64.      */
  65.     public function accesDenied(EntityManagerInterface $entityManager): Response
  66.     {
  67.         return $this->render('security/error403.html.twig', [
  68.         
  69.         ]);
  70.     }
  71. }