mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 09:35:28 +00:00
init symfony framework #14
This commit is contained in:
parent
3c233fcfad
commit
380377b27c
114 changed files with 11525 additions and 10998 deletions
0
src/Controller/.gitignore
vendored
Normal file
0
src/Controller/.gitignore
vendored
Normal file
20
src/Controller/HomeController.php
Normal file
20
src/Controller/HomeController.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class HomeController extends AbstractController
|
||||
{
|
||||
#[Route(
|
||||
'/{_locale}/',
|
||||
name: 'home_index'
|
||||
)]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
return $this->render('default/home/index.html.twig');
|
||||
}
|
||||
}
|
||||
67
src/Controller/PageController.php
Normal file
67
src/Controller/PageController.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class PageController extends AbstractController
|
||||
{
|
||||
#[Route(
|
||||
'/{_locale}/page/submit',
|
||||
name: 'page_submit'
|
||||
)]
|
||||
public function submit(): Response
|
||||
{
|
||||
return $this->render('default/page/submit.html.twig', [
|
||||
// @TODO
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route(
|
||||
'/{_locale}/page/stars',
|
||||
name: 'page_stars'
|
||||
)]
|
||||
public function stars(): Response
|
||||
{
|
||||
// @TODO
|
||||
}
|
||||
|
||||
#[Route(
|
||||
'/{_locale}/page/views',
|
||||
name: 'page_views'
|
||||
)]
|
||||
public function views(): Response
|
||||
{
|
||||
// @TODO
|
||||
}
|
||||
|
||||
#[Route(
|
||||
'/{_locale}/page/downloads',
|
||||
name: 'page_downloads'
|
||||
)]
|
||||
public function downloads(): Response
|
||||
{
|
||||
// @TODO
|
||||
}
|
||||
|
||||
#[Route(
|
||||
'/{_locale}/page/comments',
|
||||
name: 'page_comments'
|
||||
)]
|
||||
public function comments(): Response
|
||||
{
|
||||
// @TODO
|
||||
}
|
||||
|
||||
#[Route(
|
||||
'/{_locale}/page/editions',
|
||||
name: 'page_editions'
|
||||
)]
|
||||
public function editions(): Response
|
||||
{
|
||||
// @TODO
|
||||
}
|
||||
}
|
||||
76
src/Controller/ProfileController.php
Normal file
76
src/Controller/ProfileController.php
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
use App\Service\User;
|
||||
|
||||
class ProfileController extends AbstractController
|
||||
{
|
||||
#[Route(
|
||||
'/{_locale}/profile',
|
||||
name: 'profile_index'
|
||||
)]
|
||||
public function index(Request $request, User $user): Response
|
||||
{
|
||||
return $this->render(
|
||||
'default/profile/index.html.twig',
|
||||
[
|
||||
'user' => $user->init($request->getClientIp())
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[Route(
|
||||
'/{_locale}/profile/setting',
|
||||
name: 'profile_setting'
|
||||
)]
|
||||
public function setting(): Response
|
||||
{
|
||||
// @TODO
|
||||
return $this->render(
|
||||
'default/profile/setting.html.twig'
|
||||
);
|
||||
}
|
||||
|
||||
public function module(string $route = ''): Response
|
||||
{
|
||||
return $this->render(
|
||||
'default/profile/module.html.twig',
|
||||
[
|
||||
'route' => $route,
|
||||
'stars' => 0,
|
||||
'views' => 0,
|
||||
'comments' => 0,
|
||||
'downloads' => 0,
|
||||
'editions' => 0,
|
||||
'identicon' => $this->_getIdenticon(
|
||||
'@TODO',
|
||||
17,
|
||||
[
|
||||
'backgroundColor' => 'rgba(255, 255, 255, 0)',
|
||||
]
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
private function _getIdenticon(
|
||||
mixed $id,
|
||||
int $size,
|
||||
array $style,
|
||||
string $format = 'webp') : string
|
||||
{
|
||||
$identicon = new \Jdenticon\Identicon();
|
||||
|
||||
$identicon->setValue($id);
|
||||
$identicon->setSize($size);
|
||||
$identicon->setStyle($style);
|
||||
|
||||
return $identicon->getImageDataUri($format);
|
||||
}
|
||||
}
|
||||
31
src/Controller/SearchController.php
Normal file
31
src/Controller/SearchController.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class SearchController extends AbstractController
|
||||
{
|
||||
#[Route(
|
||||
'/{_locale}/search',
|
||||
name: 'search_index'
|
||||
)]
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$query = $request->query->get('query');
|
||||
|
||||
return $this->render('default/search/index.html.twig', [
|
||||
'query' => $query
|
||||
]);
|
||||
}
|
||||
|
||||
public function module(string $query = ''): Response
|
||||
{
|
||||
return $this->render('default/search/module.html.twig', [
|
||||
'query' => $query,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue