87 lines
2.6 KiB
PHP
87 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace KupShop\SellerBundle\Controller;
|
|
|
|
use KupShop\GraphQLBundle\EventListener\JsShopRefreshListener;
|
|
use KupShop\KupShopBundle\Routing\TranslatedRoute;
|
|
use KupShop\KupShopBundle\Util\Contexts;
|
|
use KupShop\KupShopBundle\Views\View;
|
|
use KupShop\SellerBundle\Context\SellerContext;
|
|
use KupShop\SellerBundle\View\DetailView;
|
|
use KupShop\SellerBundle\View\ListDetailView;
|
|
use KupShop\SellerBundle\View\ListView;
|
|
use KupShop\SellerBundle\View\MapView;
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\Routing\Annotation\Route;
|
|
|
|
class SellerController extends AbstractController
|
|
{
|
|
/**
|
|
* @Route("/change-seller/{id}/")
|
|
* @Route("/change-seller/{id}/{url}")
|
|
*/
|
|
public function changeSeller(Request $request, int $id, ?string $url = null): RedirectResponse
|
|
{
|
|
$sellerContext = Contexts::get(SellerContext::class);
|
|
$sellerContext->remember((string) $id);
|
|
$sellerContext->activate((string) $id);
|
|
|
|
if (findModule(\Modules::JS_SHOP)) {
|
|
$request->getSession()->set(JsShopRefreshListener::SESSION_NAME, true);
|
|
}
|
|
|
|
return new RedirectResponse(
|
|
$url ?? $request->headers->get('referer', '/')
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @Route("/_focus/sellers-filter/")
|
|
*/
|
|
public function focusSellersFilter(): Response
|
|
{
|
|
return (new View())
|
|
->setTemplate('filter/focus/focus.filter.sellers.tpl')
|
|
->getResponse();
|
|
}
|
|
|
|
/**
|
|
* @TranslatedRoute("/#sellers#/", name="shop_seller_seller_map")
|
|
*/
|
|
public function mapAction(MapView $view): Response
|
|
{
|
|
return $view->getResponse();
|
|
}
|
|
|
|
/**
|
|
* @TranslatedRoute("/#sellers#/list/", name="shop_seller_seller_list")
|
|
*/
|
|
public function listAction(ListView $view): Response
|
|
{
|
|
return $view->getResponse();
|
|
}
|
|
|
|
/**
|
|
* @TranslatedRoute(path="/#sellers#/listdetail/{id_seller}", name="shop_seller_seller_listdetail", requirements={"id_seller": "\d+"})
|
|
*/
|
|
public function listDetailAction(ListDetailView $view, $id_seller): Response
|
|
{
|
|
$view->setIdSeller($id_seller);
|
|
|
|
return $view->getResponse();
|
|
}
|
|
|
|
/**
|
|
* @TranslatedRoute(path="/#sellers#/{id_seller}/{name?}", name="shop_seller_seller_detail", requirements={"id_seller": "\d+"})
|
|
*/
|
|
public function detailAction(DetailView $view, $id_seller): Response
|
|
{
|
|
$view->setIdSeller($id_seller);
|
|
|
|
return $view->getResponse();
|
|
}
|
|
}
|