src/Controller/Kernel/AppController.php line 59

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Kernel;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Request;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. use App\Service\Kernel\UserService;
  8. use App\Service\Kernel\KernelService;
  9. use App\Service\Kernel\MailService;
  10. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  11. /**
  12.  * @Route("/{_locale}/home")
  13.  */
  14. class AppController extends AbstractController
  15. {
  16.     /**
  17.      * @Route("/", name="app_home", methods={"GET"})
  18.      */
  19.     public function home(Request $requestUserService $userServiceSessionInterface $sessionKernelService $kernelserviceMailService $mailservice): Response
  20.     {
  21.         $classname =  explode("\\"get_class($this));
  22.         $arraysize count($classname);
  23.         $attribute str_replace("Controller"""$classname[$arraysize-1]) . ":" str_replace("Action"""__FUNCTION__);
  24.         $this->denyAccessUnlessGranted($attribute);
  25.         
  26.         $showconfig $userService->HasAccess("App:configuration");
  27.         
  28.         $session->set('showfileuploads'$userService->HasAccess("FileUpload:index"));
  29.         
  30.         
  31.         /*if ($session->get('firstpage') == null)
  32.         {
  33.             $organization =  $this->getUser()->getOrganization();
  34.             $loginmail = $kernelservice->getApplicationInfoValue("Kernel.LoginMail", $organization);
  35.             $applicationname = $kernelservice->getApplicationInfoValue("Kernel.Applicationame", $organization);
  36.             
  37.             if($loginmail == true)
  38.             {
  39.                 //$this->get('session')->getFlashBag()->add('error', "firstlogin");
  40.                 $tomail = $kernelservice->getApplicationInfoValue("Kernel.Loginemail", $organization);
  41.                 $mailservice->createMail($tomail, "Login in " . $applicationname, 'login from '. $this->getUser(). ' using ip:'.$request->getClientIp(), null, null, null, $organization);
  42.             }
  43.             
  44.             $session->set('firstpage', 'no');
  45.         }*/
  46.         
  47.                 
  48.         return $this->render('kernel/app/home.html.twig', [
  49.             'showconfig' => $showconfig
  50.         ]);
  51.     }
  52.     
  53.     /**
  54.      * @Route("/innerhome", name="app_innerhome", methods={"GET"})
  55.      */
  56.     public function innerhome(UserService $userService): Response
  57.     {
  58.         $classname =  explode("\\"get_class($this));
  59.         $arraysize count($classname);
  60.         $attribute str_replace("Controller"""$classname[$arraysize-1]) . ":" str_replace("Action"""__FUNCTION__);
  61.         $this->denyAccessUnlessGranted($attribute);
  62.         
  63.         $user $this->getUser();
  64.         $template $user->getUserFunction()->getUiTemplate();
  65.     if ($template != null)
  66.         {
  67.             /*if ($template->getName() == "UITemplate.User")
  68.             {
  69.         return $this->redirectToRoute('user_home', array('id' => $user->getId()));
  70.             }*/
  71.             return $this->redirectToRoute('user_home', array('id' => $user->getId()));
  72.         }
  73.         
  74.         //return $this->redirectToRoute('plant_overview');
  75.         
  76.         return $this->render('kernel/app/innerhome.html.twig', [
  77.             
  78.         ]);
  79.     }
  80.     
  81.     /**
  82.      * @Route("/configuration", name="app_configuration", methods={"GET"})
  83.      */
  84.     public function configuration(UserService $userServiceSessionInterface $session): Response
  85.     {
  86.         $classname =  explode("\\"get_class($this));
  87.         $arraysize count($classname);
  88.         $attribute str_replace("Controller"""$classname[$arraysize-1]) . ":" str_replace("Action"""__FUNCTION__);
  89.         $this->denyAccessUnlessGranted($attribute);
  90.         $session->set('showusers'$userService->HasAccess("User:index"));
  91.         $session->set('showorganizations'$userService->HasAccess("Organization:index"));
  92.         $session->set('showfolders'$userService->HasAccess("Folder:index"));
  93.         $session->set('showsettings'$userService->HasAccess("Setting:index"));
  94.         $session->set('showconfigurablelists'$userService->HasAccess("ConfigurableList:index"));
  95.         $session->set('showuserfunctions'$userService->HasAccess("UserFunction:index"));
  96.         $session->set('showroles'$userService->HasAccess("Role:index"));
  97.         $session->set('showprofiles'$userService->HasAccess("Profile:index"));
  98.         $session->set('showactionprofiles'$userService->HasAccess("ActionProfile:index"));
  99.         $session->set('showsecurityactions'$userService->HasAccess("SecurityAction:index"));
  100.         $session->set('showbatchjobs'$userService->HasAccess("BatchJob:index"));
  101.         //$session->set('showcontacts', $userService->HasAccess("Contact:index"));
  102.         $session->set('showcontacts'$userService->HasAccess("BatchJob:index"));
  103.         //$session->set('showmailings', $userService->HasAccess("Mailing:index"));
  104.         $session->set('showmailings'$userService->HasAccess("BatchJob:index"));
  105.         //$session->set('showcustomization', $userService->HasAccess("CustomizedEntity:index"));
  106.         $session->set('showcustomization'$userService->HasAccess("BatchJob:index"));
  107.         $session->set('showmails'$userService->HasAccess("Mail:index"));
  108.         $session->set('showuserlogs'$userService->HasAccess("UserLog:index"));
  109.         $session->set('showscreenconfigurations'$userService->HasAccess("ScreenConfiguration:index"));
  110.         $session->set('showwidgets'$userService->HasAccess("Widget:index"));
  111.         $session->set('showdocumenttemplategroups'$userService->HasAccess("DocumentTemplateGroup:index"));
  112.         $session->set('showtemplatetypes'$userService->HasAccess("TemplateType:index"));
  113.         $session->set('showintegrationmessages'$userService->HasAccess("IntegrationMessage:index"));
  114.         $session->set('showdestinations'$userService->HasAccess("Destination:index"));
  115.         $session->set('showintegrationexecutions'$userService->HasAccess("IntegrationExecution:index"));
  116.         $session->set('showintegrations'$userService->HasAccess("Integration:index"));
  117.        
  118.         
  119.         
  120.              
  121.         return $this->render('kernel/app/configuration.html.twig', [
  122.             
  123.         ]);
  124.     }
  125. }