<?php
namespace App\Horse\Controller;
use App\Network\Service\NetworkHorseService;
use App\Profile\Service\ProfileService;
use Pimcore\Controller\FrontendController;
use Pimcore\Model\DataObject\Horse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
#[Route([
'name' => 'horse_tab_navigation_',
'localizedPaths' => [
'en' => '/{_locale}/horse/tabnav',
'de' => '/{_locale}/horse/tabnav',
'fr' => '/{_locale}/horse/tabnav',
],
])]
class HorseTabNavigationController extends FrontendController
{
#[Route('/{id}/timeline', name: 'timeline')]
public function timeline(Request $request, $id): Response
{
$request->setRequestFormat('text/html');
return $this->renderForm('network/horse/sections/horse_section_timeline.html.twig', [
'user' => $this->getUser(),
'horse' => Horse::getById($id),
]);
}
#[Route('/{id}/auction-history', name: 'auction_history')]
public function auctionHistory(Request $request, $id, NetworkHorseService $networkHorseService): Response
{
$horse = Horse::getById($id);
$auctionHistory = $networkHorseService->getAuctionhistory($horse);
return $this->renderForm('network/horse/sections/horse_section_auction_history.html.twig', [
'horse' => $horse,
'history' => $auctionHistory,
]);
}
#[Route('/{id}/pedigree', name: 'pedigree')]
public function pedigree(Request $request, $id, NetworkHorseService $networkHorseService): Response
{
$horse = Horse::getById($id);
return $this->renderForm('network/horse/sections/horse_section_horse_data.html.twig', [
'horse' => $horse,
]);
}
#[Route('/{id}/achievements', name: 'achievements')]
public function achievements(Request $request, $id, NetworkHorseService $networkHorseService, ProfileService $profileService): Response
{
$horse = Horse::getById($id);
$achievements = $networkHorseService->getAchievements($horse);
$achievementCategories = $networkHorseService->getNeededAchievementCategories($achievements);
return $this->renderForm('network/horse/sections/horse_section_achievements.html.twig', [
'horse' => $horse,
'achievements' => $achievements,
'achievementCategories' => $achievementCategories,
'profile' => $horse->getOwner(),
]);
}
#[Route('/{id}/news', name: 'news')]
public function news(Request $request, $id): Response
{
$request->setRequestFormat('text/html');
return $this->renderForm('network/horse/sections/horse_section_news.html.twig', [
'horse' => Horse::getById($id),
// 'horseEvents' => ['auctions' => $horseAuctions, 'racedays' => $horseRacedays],
]);
}
// horse_section_statistics
#[Route('/{id}/horse-statistics', name: 'horse_statistics')]
public function horseStatistics(Request $request, $id): Response
{
$request->setRequestFormat('text/html');
return $this->renderForm('network/horse/sections/horse_section_statistics.html.twig', [
'horse' => Horse::getById($id),
]);
}
}