src\Controller\CoursesController.php line 93

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 CoursesController extends AppController
  7. {
  8.     
  9.     public function index($id NULL$idType NULL): Response
  10.     {
  11.         $check $this->commonCalls();
  12.         if(!$check){
  13.             return $check;
  14.         }  
  15.         if($this->RedirectHandle!==NULL){
  16.             return $this->RedirectHandle;
  17.         }
  18.         
  19.         $email NULL;
  20.         if($this->getUser()){
  21.             $email $this->getUser()->getEmail();
  22.         }
  23.         
  24.         
  25.         $this->Breadcrumbs->setGroupName('courses');       
  26.         $this->setData('breadcrumbsData'$this->Breadcrumbs->get());
  27.                 
  28.         return $this->render('courses/categories.html.twig',                    
  29.             $this->getData()
  30.         );
  31.     }
  32.     
  33.     public function courseList($id NULL$idType NULL): Response
  34.     {
  35.         
  36.         $check $this->commonCalls();
  37.         if(!$check){
  38.             return $check;
  39.         }
  40.         
  41. //        $this->search();        
  42.         if(!$this->getData('search')){       
  43.             if($id==NULL){
  44.                 $courseCats $this->ApiCalls->getCourses('courseList');
  45.                 $this->setData('courseCats'$courseCats);
  46.             }
  47.             else{
  48.                 switch ($idType){
  49.                     case 'optionGroupID':
  50.                         $courseCats $this->ApiCalls->getCourses('courseList'$id);      
  51.                         $this->setData('optiongroupID'$id);
  52.                         break;
  53.                     case 'catID':
  54.                         $courseCats $this->ApiCalls->getCourses('courseList'NULL$id);
  55.                         $this->setData('courseCats'$courseCats);                        
  56.                         break;
  57.                     case 'locationID':
  58.                         $courseCats $this->ApiCalls->getCourses('courseList'NULLNULL$id);
  59.                         $this->setData('courseCats'$courseCats);
  60.                         break;
  61.                     case 'providerID':
  62.                         $courseCats $this->ApiCalls->getCourses('courseList'NULLNULLNULL$id);
  63.                         $this->setData('courseCats'$courseCats);
  64.                         break;
  65.                 }
  66.             }
  67.         }
  68.         $this->setData('cards'NULL);
  69.         
  70.         $email NULL;
  71.         if($this->getUser()){
  72.             $email $this->getUser()->getEmail();
  73.         }
  74.         $resTools $this->ApiCalls->getProfileTools($email);
  75.             $check $this->handleDbErrors($resTools);
  76.             if($check===FALSE){           
  77.                 $this->setData('tools'$resTools);
  78.             }
  79.             else{
  80.                 return $check;
  81.             }
  82.         
  83.         $this->Breadcrumbs->setGroupName('courses');       
  84.         $this->setData('breadcrumbsData'$this->Breadcrumbs->get());
  85.            
  86.         
  87.         return $this->render('courses/index.html.twig',                    
  88.             $this->getData()
  89.         );
  90.     }
  91.     
  92.     public function options(){
  93.         $check $this->commonCalls();
  94.         if(!$check){
  95.             return $check;
  96.         }
  97.         
  98.         $courseCats $this->ApiCalls->getCourses('options');
  99.         if($this->handleDbErrors($courseCats)===FALSE){
  100.             $this->setData('optionGroups'$courseCats);
  101.         }
  102.         
  103.         $this->Breadcrumbs->setGroupName('courses');       
  104.         $this->setData('breadcrumbsData'$this->Breadcrumbs->get());
  105.         
  106.         $this->search();        
  107.         if(!$this->getData('search')){
  108.             if($this->handleDbErrors($courseCats)===FALSE){
  109.                 $this->setData('courseCats'$courseCats);
  110.             }
  111.         }
  112.         
  113.         $email NULL;
  114.         if($this->getUser()){
  115.             $email $this->getUser()->getEmail();
  116.         }
  117.         $resTools $this->ApiCalls->getProfileTools($email);
  118.             $check $this->handleDbErrors($resTools);
  119.             if($check===FALSE){           
  120.                 $this->setData('tools'$resTools);
  121.             }
  122.             else{
  123.                 return $check;
  124.             }
  125.         
  126.         return $this->render('courses/options.html.twig',                    
  127.             $this->getData()
  128.         );
  129.     }
  130. }