<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Customize\Controller;
use Eccube\Controller\AbstractController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Routing\Annotation\Route;
use Customize\Repository\SchoolRepository;
use Customize\Entity\School;
class TopController extends AbstractController
{
/**
* @var SchoolRepository
*/
protected $schoolRepository;
/**
* CustomizeTopController constructor.
*
* @param SchoolRepository $schoolRepository
*/
public function __construct(
SchoolRepository $schoolRepository
) {
$this->schoolRepository = $schoolRepository;
}
/**
* @Route("/", name="homepage", methods={"GET"})
* @Template("index.twig")
*/
public function index()
{
$storeMeasuringFlag = false;
$schoolMeasuringFlag = false;
$onlineFlag = false;
$Customer = $this->getUser();
$school = null;
if(is_object($Customer)){
$school = $Customer->getSchool();
if($school){
$storeMeasuringFlag = $school->getStoreMeasuringFlag();
$schoolMeasuringFlag = $school->getSchoolMeasuringFlag();
$onlineFlag = $school->getOnlineFlag();
}
}
if($schoolMeasuringFlag == true){
$case = 1;
}elseif ($storeMeasuringFlag == true){
$case = 2;
}elseif ($onlineFlag == true){
$case = 3;
}else{
$case = 4;
}
return $this->render('index.twig',
array(
'case' => $case,
'School' => $school
)
);
}
}