<?php
namespace App\Controller;
use App\Controller\AppController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class IndexController extends AppController
{
public function index(): Response
{
// if($this->defaultHomePage !== NULL && $this->defaultHomePage !== 'index'){
// return $this->redirectToRoute($this->defaultHomePage);
// }
$check = $this->commonCalls();
if($this->RedirectHandle!==NULL){
return $this->RedirectHandle;
}
if(!$check){
return $check;
}
foreach($this->getData('cards') as $card){
if($card["card_btn_route"]==="tools"){
$this->setData('toolsFlag', true);
$this->Session->set('toolsFlag', true);
}
}
if($this->getUser()!==NULL && $this->getUser()->getId()){
$this->setData('toolsFlag', false);
$resTools = $this->ApiCalls->getProfileTools($this->getUser()->getEmail());
$check = $this->handleDbErrors($resTools);
if($check===FALSE){
$this->setData('tools', $resTools);
}
else{
return $check;
}
}
// var_dump($this->defaultHomePage);
// var_dump($this->getData('cards'));
return $this->render($this->customRenderPath('index/index.html.twig', FALSE),
$this->getData()
);
}
}