<?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\ProductTagRepository;
use Symfony\Component\Filesystem\Filesystem;
class HelpController extends AbstractController
{
/**
* @var ProductTagRepository
*/
protected $productTagRepository;
/**
* HelpController constructor.
*/
public function __construct(ProductTagRepository $productTagRepository)
{
$this->productTagRepository = $productTagRepository;
}
/**
* 特定商取引法.
*
* @Route("/help/tradelaw", name="help_tradelaw", methods={"GET"})
* @Template("Help/tradelaw.twig")
*/
public function tradelaw()
{
return [];
}
/**
* ご利用ガイド.
*
* @Route("/guide", name="help_guide", methods={"GET"})
*/
public function guide()
{
$fs = new Filesystem();
$school_id = $this->getUser()->getSchool()->getSchoolId();
$templatePath = $this->getParameter('eccube_theme_front_dir');
$guidFileRelPath = 'Help/School/guide'.$school_id.'.twig';
$guideFilePath = $templatePath.'/'.$guidFileRelPath;
if (!$fs->exists($guideFilePath)) {
$guideFilePath = $templatePath.'/Help/guide.twig';
$guidFileRelPath = 'Help/guide.twig';
}
return $this->render($guidFileRelPath, array(
'school_id' => $school_id,
'show_necessity' => $this->productTagRepository->isNecessityExist()
));
}
/**
* ご利用ガイド(兄弟).
*
* @Route("/guide/brother/{school_id}", name="help_guide_brother", methods={"GET"}, requirements={"school_id" = "\d+"})
*/
public function guide_brother($school_id)
{
$fs = new Filesystem();
$templatePath = $this->getParameter('eccube_theme_front_dir');
$guidFileRelPath = 'Help/School/guide'.$school_id.'.twig';
$guideFilePath = $templatePath.'/'.$guidFileRelPath;
if (!$fs->exists($guideFilePath)) {
$guideFilePath = $templatePath.'/Help/guide.twig';
$guidFileRelPath = 'Help/guide.twig';
}
return $this->render($guidFileRelPath, array(
'school_id' => $school_id,
'show_necessity' => $this->productTagRepository->isNecessityExist()
));
}
/**
* 当サイトについて.
*
* @Route("/help/about", name="help_about", methods={"GET"})
* @Template("Help/about.twig")
*/
public function about()
{
return [];
}
/**
* プライバシーポリシー.
*
* @Route("/help/privacy", name="help_privacy", methods={"GET"})
* @Template("Help/privacy.twig")
*/
public function privacy()
{
return [];
}
/**
* 利用規約.
*
* @Route("/help/agreement", name="help_agreement", methods={"GET"})
* @Template("Help/agreement.twig")
*/
public function agreement()
{
return [];
}
}