src/Controller/SubsiteController.php line 94

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Tag;
  4. use App\Entity\Job;
  5. use App\Entity\Post;
  6. use App\Entity\Referentie;
  7. use App\Form\TagType;
  8. use App\Form\TagChildType;
  9. use App\Repository\TagRepository;
  10. use App\Repository\JobRepository;
  11. use App\Repository\PostRepository;
  12. use App\Repository\ReferentieRepository;
  13. use App\Entity\Professional;
  14. use App\Repository\ProfessionalRepository;
  15. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  16. use Symfony\Component\HttpFoundation\Request;
  17. use Symfony\Component\HttpFoundation\Response;
  18. use Symfony\Component\Routing\Annotation\Route;
  19. /**
  20.  * @Route("/subsite")
  21.  */
  22. class SubsiteController extends AbstractController
  23. {
  24.     /**
  25.      * @Route("/{token}", name="subsite_index", methods={"GET"})
  26.      */
  27.     public function index($tokenProfessionalRepository $professionalRepository): Response
  28.     {
  29.        
  30.         $site $professionalRepository->findOneBy(array('token' => $token));
  31.         
  32.         //tag where parent = ..
  33.         // enkel tags die public staan..
  34.        // $realisations = "";
  35.         
  36.         
  37.         return $this->render('subsite/index.html.twig', [
  38.             'site' => $site,
  39.         ]);
  40.         
  41.         
  42.     }
  43.  
  44.     
  45.    
  46.     /**
  47.      * @Route("/{token}/{name}/{pageid}/", name="subsite_page", methods={"GET"})
  48.      */
  49.     public function page($token,$pageid nullProfessionalRepository $professionalRepository): Response
  50.     {
  51.         
  52.         $site $professionalRepository->findOneBy(array('token' => $token));
  53.         
  54.         switch($pageid){
  55.             case "1":
  56.                 $titel $site->getPagina1Titel();
  57.                 $intro $site->getPagina1Intro();
  58.                 $content $site->getPagina1Content();
  59.                 break;
  60.             case "2":
  61.                 $titel $site->getPagina2Titel();
  62.                 $intro $site->getPagina2Intro();
  63.                 $content $site->getPagina2Content();
  64.                 break; 
  65.             case "3":
  66.                 $titel $site->getPagina3Titel();
  67.                 $intro $site->getPagina3Intro();
  68.                 $content $site->getPagina3Content();
  69.                 break;
  70.             case "4":
  71.                 $titel $site->getPagina4Titel();
  72.                 $intro $site->getPagina4Intro();
  73.                 $content $site->getPagina4Content();
  74.                 break;
  75.             case "5":
  76.                 $titel $site->getPagina5Titel();
  77.                 $intro $site->getPagina5Intro();
  78.                 $content $site->getPagina5Content();
  79.                 break;
  80.             case "6":
  81.                 $titel $site->getPagina6Titel();
  82.                 $intro $site->getPagina6Intro();
  83.                 $content $site->getPagina6Content();
  84.                 break;
  85.             
  86.         }
  87.         
  88.         return $this->render('subsite/page.html.twig', [
  89.             'site' => $site,
  90.             'titel' => $titel,
  91.             'intro' => $intro,
  92.             'content' => $content,
  93.             
  94.         ]);
  95.         
  96.         
  97.     }
  98.     
  99.     /**
  100.      * @Route("/{token}/contact/", name="subsite_contact", methods={"GET"})
  101.      */
  102.     public function contact($tokenProfessionalRepository $professionalRepository): Response
  103.     {
  104.         
  105.         $site $professionalRepository->findOneBy(array('token' => $token));
  106.         
  107.          
  108.         
  109.         return $this->render('subsite/contact.html.twig', [
  110.             'site' => $site,
  111.            
  112.         ]);
  113.         
  114.         
  115.     }
  116.     
  117.     /**
  118.      * @Route("/{token}/jobs/", name="subsite_jobs", methods={"GET"})
  119.      */
  120.     public function jobs($tokenProfessionalRepository $professionalRepository): Response
  121.     {
  122.         
  123.         $site $professionalRepository->findOneBy(array('token' => $token));
  124.         
  125.          
  126.         
  127.         return $this->render('subsite/jobs.html.twig', [
  128.             'site' => $site,
  129.             
  130.         ]);
  131.         
  132.         
  133.     }
  134.     
  135.     
  136.     
  137.     /**
  138.      * @Route("/job/{{id}", name="subsite_job", methods={"GET"})
  139.      */
  140.     public function job($idJobRepository $jobrepo): Response
  141.     {
  142.         
  143.         $job $jobrepo->findOneBy(array('id' => $id));
  144.         
  145.         
  146.         $site $job->getProfessional();
  147.         
  148.         return $this->render('subsite/job.html.twig', [
  149.             'job' => $job,
  150.             'site' => $site,
  151.         ]);
  152.         
  153.         
  154.     }
  155.     
  156.     
  157.     
  158.     
  159.     
  160.     /**
  161.      * @Route("/{token}/blog/", name="subsite_blog", methods={"GET"})
  162.      */
  163.     public function blog($tokenProfessionalRepository $professionalRepositoryPostRepository $postRepository): Response
  164.     {
  165.         
  166.         $site $professionalRepository->findOneBy(array('token' => $token));
  167.         
  168.         
  169.         if($site->getToonVepablog()){
  170.             $posts $postRepository->findBy(array('online' => 'true'), array('datum' => 'DESC'));
  171.             
  172.         }else{
  173.             $posts $postRepository->findBy(array('Professional' => $site->getId(),'online' => 'true'), array('datum' => 'DESC'));
  174.             
  175.         }
  176.         
  177.         
  178.         return $this->render('subsite/posts.html.twig', [
  179.             'site' => $site,
  180.             'posts' => $posts,
  181.             
  182.         ]);
  183.         
  184.         
  185.     }
  186.     
  187.     
  188.     /**
  189.      * @Route("/post/{{id}/site/{token}", name="subsite_post", methods={"GET"})
  190.      */
  191.     public function post($id$tokenProfessionalRepository $professionalRepositoryPostRepository $postrepo): Response
  192.     {
  193.         
  194.         $post $postrepo->findOneBy(array('id' => $id));
  195.         
  196.         
  197.         //$site = $post->getProfessional();
  198.         $site $professionalRepository->findOneBy(array('token' => $token));
  199.         
  200.         
  201.         
  202.         
  203.         return $this->render('subsite/post.html.twig', [
  204.             'post' => $post,
  205.             'site' => $site,
  206.         ]);
  207.         
  208.         
  209.     }
  210.     
  211.     
  212.     
  213.     
  214.     
  215.     
  216.     
  217.     /**
  218.      * @Route("/{token}/interventieaanvraag/", name="subsite_interventieaanvraag", methods={"GET"})
  219.      */
  220.     public function interventieaanvraag($tokenProfessionalRepository $professionalRepository): Response
  221.     {
  222.         
  223.         $site $professionalRepository->findOneBy(array('token' => $token));
  224.         
  225.         
  226.         
  227.         return $this->render('subsite/interventieaanvraag.html.twig', [
  228.             'site' => $site,
  229.             
  230.         ]);
  231.         
  232.         
  233.     }
  234.     
  235.     
  236.     
  237.     
  238.     /**
  239.      * @Route("/{token}/realisaties/", name="subsite_realisaties", methods={"GET"})
  240.      */
  241.     public function realisaties($tokenProfessionalRepository $professionalRepository): Response
  242.     {
  243.         
  244.         $site $professionalRepository->findOneBy(array('token' => $token));
  245.         
  246.         
  247.         return $this->render('subsite/realisaties.html.twig', [
  248.             'site' => $site,
  249.             
  250.         ]);
  251.         
  252.         
  253.     }
  254.     
  255.     /**
  256.      * @Route("/realisatie/{{id}", name="subsite_realisatie", methods={"GET"})
  257.      */
  258.     public function realisatie($idReferentieRepository $realisatierepository): Response
  259.     {
  260.         
  261.         $realisatie $realisatierepository->findOneBy(array('id' => $id));
  262.         
  263.         
  264.         $site $realisatie->getProfessional();
  265.         
  266.         return $this->render('subsite/realisatie.html.twig', [
  267.             'realisatie' => $realisatie,
  268.             'site' => $site,
  269.         ]);
  270.         
  271.         
  272.     }
  273.     
  274.     
  275.     
  276.     
  277.     
  278.     
  279.     
  280.     
  281.     
  282.     
  283. }