<?php
/**
* @version EC-CUBE4系
* @copyright 株式会社 翔 kakeru.co.jp
*
* 2022年08月22日
*
* app/Customize/Controller/TopicsController.php
*
*
* トピックス
*
*
* ≡≡≡┏(^o^)┛
*****************************************************/
namespace Customize\Controller;
use Eccube\Controller\AbstractController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
#use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Customize\Service\TopicsService;
use Symfony\Component\HttpFoundation\Response;
class TopicsController extends AbstractController
{
protected $TopicsService;
public function __construct(TopicsService $TopicsService)
{
$this->TopicsService = $TopicsService;
}
/**
*
* @Route("/topics/", name="topics", methods={"GET"})
* @Template("Topics/index.twig")
*/
public function index(Request $request, $Token = null){
$Topics = $this->TopicsService->GetTopics();
$Topic =$Topics[0];
if ($Dt =$request->get('dt')){
$Topic = $this->TopicsService->GetTopics($Dt);
}
return [
'Topics' => $Topics,
'Topic' => $Topic,
'BreadCrumbs' => [],
];
}
/**
*
* @Route("/files/rss/rss20.xml", name="topics_rss")
* @Template("Topics/Rss.twig")
*/
public function Rss(){
$Topics = $this->TopicsService->GetTopics();
$response = $this->render('Topics/Rss.twig', [
'Topics' => $Topics,
]);
$response->headers->set('Content-Type', 'application/xml; charset=UTF-8');
return $response;
}
}