src\Controller\PageController.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Controller\AppController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. class PageController extends AppController
  7. {
  8.     
  9.     protected $templateName FALSE;    
  10.     
  11.     public function index($pageName$ID null): Response
  12.     {   
  13.   
  14.         
  15.         
  16.         
  17.         $check $this->commonCalls();
  18.         if(!$check){
  19.             return $check;
  20.         }
  21.         if($this->RedirectHandle!==NULL){
  22.             return $this->RedirectHandle;
  23.         }
  24.         
  25.         $this->setData('pageName'$pageName);
  26.         if($this->getUser()!==NULL && $this->getUser()->getId()){
  27.             
  28. //            $resFooter = $this->ApiCalls->getFooter($this->getUser()->getEmail());
  29. //            $check = $this->handleDbErrors($resFooter);
  30. //            if($check===FALSE){
  31. //                $this->parseFooterData($resFooter);            
  32. //                $this->setData('footer', $this->commonItems["footerItems"]);
  33. //            }
  34. //            else{
  35. //                return $check;
  36. //            }
  37.             
  38. //           
  39.                         
  40.             $resTools $this->ApiCalls->getProfileTools($this->getUser()->getEmail());
  41.             $check $this->handleDbErrors($resTools);
  42.             if($check===FALSE){
  43.                 $this->setData('tools'$resTools);
  44.             }
  45.             else{
  46.                 return $check;
  47.             }
  48.             
  49.                         
  50.             
  51.             
  52.         }
  53.         else{            
  54. //            $resHomeMenu = $this->ApiCalls->getHomeNav(NULL);
  55. //            $this->setData('mainMenu', $resHomeMenu);
  56.             
  57. //            $resFooter = $this->ApiCalls->getFooter(NULL);
  58. //            $this->parseFooterData($resFooter);            
  59. //            $this->setData('footer', $this->commonItems["footerItems"]);
  60.             
  61. //            $pageText = $this->ApiCalls->getPageText($pageName, NULL);
  62. //            $this->setData('pageText', $pageText);
  63.             
  64.         }
  65.                
  66.         $this->Breadcrumbs->setPageName($pageName);
  67.         $this->Breadcrumbs->setIsGeneric(TRUE);
  68.         $this->setData('breadcrumbsData'$this->Breadcrumbs->get());
  69.         $pageText $this->getData('pageText');
  70.        
  71.         
  72.         if($pageText && isset($pageText[0]) && isset($pageText[0]["pageType"])){
  73.             switch($pageText[0]["pageType"]){
  74.                 case 1:
  75. //                    echo 'm1';
  76.                     $this->templateName 'page/generic-page1.html.twig';
  77.                     break;
  78.                 case 2:
  79. //                    echo 'm2';
  80.                     $this->templateName 'page/generic-page2.html.twig';
  81.                     break;                
  82.                 case 3:
  83. //                    echo 'm3';
  84.                     $this->templateName 'page/generic-page3.html.twig';
  85.                     break;
  86.                 default:
  87. //                    echo 'm4';
  88.                     $response = new Response();
  89.                     $response->setStatusCode('404');
  90.                     return $response;
  91.             }
  92.         }   
  93.         
  94.               
  95.         
  96.         
  97.         if($this->templateName){
  98.             return $this->render($this->customRenderPath($this->templateNameFALSE), 
  99.                 $this->getData()
  100.             );
  101.         }
  102.         else{
  103.             $response = new Response();
  104.             $response->setStatusCode('404');
  105.             return $response;
  106.         }
  107.        
  108.     }
  109.     
  110.     
  111.     
  112. }