src/Controller/BrowseController.php line 89

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Basketitem;
  4. use App\Entity\Chilidocument;
  5. use App\Entity\Whishlist;
  6. use App\Service\ChiliServiceRest;
  7. use App\Service\ChiliServiceSoap;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. use Symfony\Component\HttpFoundation\Response;
  10. use Symfony\Component\Routing\Annotation\Route;
  11. class BrowseController extends AbstractController
  12. {
  13.     /**
  14.      * @Route("/Produkter", name="browse_level0")
  15.      */
  16.     public function browselevel0(): Response
  17.     {
  18.         $folders $this->getDoctrine()->getRepository(Chilidocument::class)->findBy(['mother' => config_chili_basefolder'is_folder' => true'is_active' => true],['sortorder' => 'asc']);
  19.         $files $this->getDoctrine()->getRepository(Chilidocument::class)->findBy(['mother' => config_chili_basefolder'is_folder' => false'is_active' => true],['sortorder' => 'asc']);
  20.         $whishlist $this->getDoctrine()->getRepository(Whishlist::class)->findBy(['user' => $this->getUser()]);
  21.         return $this->render('theme_' config_theme '/browse_levelX.html.twig', [
  22.             'theme' => config_theme,
  23.             'level' => '',
  24.             'files' => $files,
  25.             'folders' => $folders,
  26.             'whishlist' => $whishlist,
  27.         ]);
  28.     }
  29.     /**
  30.      * @Route("/Produkter/{level1}", name="browse_level1")
  31.      */
  32.     public function browselevel1($level1): Response
  33.     {
  34.         $folders $this->getDoctrine()->getRepository(Chilidocument::class)->findBy(['mother' => config_chili_basefolder '/' $level1'is_folder' => true'is_active' => true],['sortorder' => 'asc']);
  35.         $files $this->getDoctrine()->getRepository(Chilidocument::class)->findBy(['mother' => config_chili_basefolder '/' $level1'is_folder' => false'is_active' => true],['sortorder' => 'asc']);
  36.         $whishlist $this->getDoctrine()->getRepository(Whishlist::class)->findBy(['user' => $this->getUser()]);
  37.         return $this->render('theme_' config_theme '/browse_levelX.html.twig', [
  38.             'theme' => config_theme,
  39.             'level' => $level1,
  40.             'files' => $files,
  41.             'folders' => $folders,
  42.             'whishlist' => $whishlist,
  43.         ]);
  44.     }
  45.     /**
  46.      * @Route("/Produkter/{level1}/{level2}", name="browse_level2")
  47.      */
  48.     public function browselevel2($level1,$level2): Response
  49.     {
  50.         $folders $this->getDoctrine()->getRepository(Chilidocument::class)->findBy(['mother' => config_chili_basefolder '/' $level1 '/' $level2'is_folder' => true'is_active' => true],['sortorder' => 'asc']);
  51.         $files $this->getDoctrine()->getRepository(Chilidocument::class)->findBy(['mother' => config_chili_basefolder '/' $level1 '/' $level2'is_folder' => false'is_active' => true],['sortorder' => 'asc']);
  52.         $whishlist $this->getDoctrine()->getRepository(Whishlist::class)->findBy(['user' => $this->getUser()]);
  53.         return $this->render('theme_' config_theme '/browse_levelX.html.twig', [
  54.             'theme' => config_theme,
  55.             'level' => $level1 '/' $level2,
  56.             'files' => $files,
  57.             'folders' => $folders,
  58.             'whishlist' => $whishlist,
  59.         ]);
  60.     }
  61.     /**
  62.      * @Route("/Produkt/{id}/frombasket", name="edit_product_from_basket")
  63.      */
  64.     public function edit_product_from_basket($idChiliServiceSoap $chiliServiceSoap)
  65.     {
  66.         $basket_item $this->getDoctrine()->getRepository(Basketitem::class)->findOneBy(['id' => $id]);
  67.         $id $basket_item->getChilidocument()->getId();
  68.         $url config_chili_server '/CHILI/' config_chili_environment '/editor_html.aspx?doc=&apiKey=' $chiliServiceSoap->GetApiKey() . '&fullWS=false&initialUserView=user&allowWorkspaceAdministration=false&maxImageQuality=highest';
  69.         return $this->render('theme_' config_theme '/editproduct.html.twig', [
  70.             'url' => $url,
  71.             'docxml' => $basket_item->getChiliXml(),
  72.             'docid' => $id,
  73.         ]);
  74.     }
  75.     /**
  76.      * @Route("/Produkt/{id}", name="edit_product")
  77.      */
  78.     public function edit_product($idChiliServiceSoap $chiliServiceSoap)
  79.     {
  80.         $url config_chili_server '/CHILI/' config_chili_environment '/editor_html.aspx?doc=&apiKey=' $chiliServiceSoap->GetApiKey() . '&fullWS=false&initialUserView=user&allowWorkspaceAdministration=false&maxImageQuality=highest';
  81.         $chilidocument $this->getDoctrine()->getRepository(Chilidocument::class)->find($id);
  82.         return $this->render('theme_' config_theme '/editproduct.html.twig', [
  83.             'url' => $url,
  84.             'docxml' => $chilidocument->getDocxml(),
  85.             'docid' => $id,
  86.         ]);
  87.     }
  88. }