2012-06-16 16:33:00 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace GergelyPolonkai\FrontBundle\Controller;
|
|
|
|
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
2012-09-03 21:42:49 +02:00
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
2012-06-16 16:33:00 +02:00
|
|
|
|
2012-09-03 21:42:49 +02:00
|
|
|
/**
|
|
|
|
* @Route("/")
|
|
|
|
*/
|
2012-06-16 16:33:00 +02:00
|
|
|
class DefaultController extends Controller
|
|
|
|
{
|
2012-09-03 21:42:49 +02:00
|
|
|
/**
|
|
|
|
* @Route("/", name="GergelyPolonkaiFrontBundle_homepage")
|
|
|
|
* @Template
|
|
|
|
*/
|
|
|
|
public function indexAction()
|
|
|
|
{
|
2012-09-04 13:09:32 +02:00
|
|
|
$query = $this->getDoctrine()->getEntityManager()->createQuery("SELECT p FROM GergelyPolonkaiFrontBundle:Post p ORDER BY p.createdAt DESC");
|
|
|
|
$query->setMaxResults(4);
|
|
|
|
$posts = $query->getResult();
|
|
|
|
|
|
|
|
return array(
|
|
|
|
'posts' => $posts,
|
|
|
|
);
|
2012-09-03 21:42:49 +02:00
|
|
|
}
|
2012-06-18 23:26:40 +02:00
|
|
|
|
2012-09-03 21:42:49 +02:00
|
|
|
/**
|
|
|
|
* @Route("/disclaimer.html", name="GergelyPolonkaiFrontBundle_disclaimer")
|
|
|
|
* @Template
|
|
|
|
*/
|
|
|
|
public function disclaimerAction()
|
|
|
|
{
|
|
|
|
return array();
|
|
|
|
}
|
2012-06-18 23:26:40 +02:00
|
|
|
|
2012-09-03 21:42:49 +02:00
|
|
|
/**
|
2012-09-04 13:09:32 +02:00
|
|
|
* @param string $_format
|
2012-09-03 21:42:49 +02:00
|
|
|
*
|
|
|
|
* @Route("/resume.{_format}", name="GergelyPolonkaiFrontBundle_resume")
|
|
|
|
* @Template
|
|
|
|
*/
|
|
|
|
public function resumeAction($_format)
|
|
|
|
{
|
|
|
|
if ($_format === 'pdf') {
|
|
|
|
return $this
|
|
|
|
->get('io_tcpdf')
|
|
|
|
->quick_pdf(
|
|
|
|
$this->renderView(
|
|
|
|
'GergelyPolonkaiFrontBundle:Default:resume.html.twig',
|
|
|
|
array(
|
|
|
|
'format' => $_format
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return array(
|
|
|
|
'format' => $_format,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2012-06-16 16:33:00 +02:00
|
|
|
}
|