The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ

Added skeleton for news editing

Signed-off-by: Gergely POLONKAI (W00d5t0ck) <polesz@w00d5t0ck.info>
master
Gergely POLONKAI (W00d5t0ck) 10 years ago
parent 9069918dc4
commit f6acfae76d
  1. 62
      src/KekRozsak/AdminBundle/Controller/NewsController.php
  2. 32
      src/KekRozsak/AdminBundle/Resources/views/News/list.html.twig
  3. 3
      src/KekRozsak/AdminBundle/Resources/views/News/listHelp.html.twig

@ -0,0 +1,62 @@
<?php
namespace KekRozsak\AdminBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
use JMS\DiExtraBundle\Annotation as DI;
/**
* @Route("/admin")
*/
class NewsController extends Controller
{
/**
* The ACL object ID for the News class
*
* @const string OBJECT_ID
*/
const OBJECT_ID = 'newsClass';
/**
* The FQCN of the News class
*
* @const string OBJECT_FQCN
*/
const OBJECT_FQCN = 'KekRozsak\\FrontBundle\\Entity\\News';
/**
* @var Symfony\Component\Security\Core\SecurityContext $securityContext
*
* @DI\Inject("security.context")
*/
private $securityContext;
/**
* @Route("/hirek/", name="KekRozsakAdminBundle_newsList")
* @Template
*/
public function listAction()
{
$objectIdentity = new ObjectIdentity(self::OBJECT_ID, self::OBJECT_FQCN);
if ($this->securityContext->isGranted('OWNER', $objectIdentity) === false) {
throw new AccessDeniedException('Nincs jogosultságod a hírszerkesztéshez!');
}
$news = $this->getDoctrine()->getRepository('KekRozsakFrontBundle:News')->findAll();
return array(
'news' => $news,
);
}
/**
* @Route("/sugo/hirek", name="KekRozsakAdminBundle_newsListHelp")
* @Template
*/
public function listHelpAction()
{
return array();
}
}

@ -0,0 +1,32 @@
{# vim: ft=htmljinja
#}
{% extends 'KekRozsakFrontBundle:Default:main_template.html.twig' %}
{% block content %}
<h3>Adminisztráció - Hírek</h3>
<table>
<thead>
<tr>
<td></td>
<td>Írta</td>
<td>Dátum</td>
<td>Cím</td>
</tr>
</thead>
<tbody>
{% for item in news %}
<tr>
<td>
{% if item.public %}[Publikus ikon]{% else %}[Nem publikus ikon]{% endif %}
{% if item.sticky %}[Ragadós ikon]{% else %}[Nem ragadós ikon]{% endif %}
{% if item.draft %}[Vázlat ikon]{% else %}[Publikált ikon]{% endif %}
</td>
<td>{{ item.createdBy.displayName }}</td>
<td>{{ item.createdAt|date('Y-m-d') }}</td>
<td>{{ item.title }}</td>
<td>[Törlés ikon]</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock content %}

@ -0,0 +1,3 @@
{# vim: ft=htmljinja
#}
<p>Kattints a hír címére a szerkesztéshez!</p>
Loading…
Cancel
Save