app/Customize/Controller/TopController.php line 22

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.ec-cube.co.jp/
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Customize\Controller;
  13. use Eccube\Controller\AbstractController;
  14. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  15. use Symfony\Component\Routing\Annotation\Route;
  16. use Customize\Repository\SchoolRepository;
  17. use Customize\Entity\School;
  18. class TopController extends AbstractController
  19. {
  20.     /**
  21.      * @var SchoolRepository
  22.      */
  23.     protected $schoolRepository;
  24.     /**
  25.      * CustomizeTopController constructor.
  26.      *
  27.      * @param SchoolRepository $schoolRepository
  28.      */
  29.     public function __construct(
  30.         SchoolRepository $schoolRepository
  31.     ) {
  32.         $this->schoolRepository $schoolRepository;
  33.     }    
  34.     /**
  35.      * @Route("/", name="homepage", methods={"GET"})
  36.      * @Template("index.twig")
  37.      */
  38.     public function index()
  39.     {
  40.         $storeMeasuringFlag false;
  41.         $schoolMeasuringFlag false;
  42.         $onlineFlag false;
  43.         $Customer $this->getUser();
  44.         $school null;
  45.         if(is_object($Customer)){
  46.             $school $Customer->getSchool();
  47.             if($school){
  48.                 $storeMeasuringFlag $school->getStoreMeasuringFlag();
  49.                 $schoolMeasuringFlag $school->getSchoolMeasuringFlag();
  50.                 $onlineFlag $school->getOnlineFlag();
  51.             }
  52.         }
  53.         if($schoolMeasuringFlag == true){
  54.             $case 1;
  55.         }elseif ($storeMeasuringFlag == true){
  56.             $case 2;
  57.         }elseif ($onlineFlag == true){
  58.             $case 3;
  59.         }else{
  60.             $case 4;
  61.         }
  62.         return $this->render('index.twig',
  63.             array(
  64.                 'case' => $case,
  65.                 'School' => $school
  66.             )
  67.         );
  68.     }
  69. }