mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-14 14:24:24 +00:00
parent
4d02314770
commit
90cbb78621
@ -91,21 +91,21 @@ class EventController extends Controller
|
|||||||
* Finds and displays a Event entity.
|
* Finds and displays a Event entity.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function showAction($id)
|
public function showAction($event_id)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
$entity = $em->getRepository('ChillEventBundle:Event')->find($id);
|
$entity = $em->getRepository('ChillEventBundle:Event')->find($event_id);
|
||||||
|
|
||||||
if (!$entity) {
|
if (!$entity) {
|
||||||
throw $this->createNotFoundException('Unable to find Event entity.');
|
throw $this->createNotFoundException('Unable to find Event entity.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$deleteForm = $this->createDeleteForm($id);
|
$this->denyAccessUnlessGranted('CHILL_EVENT_SEE_DETAILS', $entity,
|
||||||
|
"You are not allowed to see details on this event");
|
||||||
|
|
||||||
return $this->render('ChillEventBundle:Event:show.html.twig', array(
|
return $this->render('ChillEventBundle:Event:show.html.twig', array(
|
||||||
'entity' => $entity,
|
'event' => $entity
|
||||||
'delete_form' => $deleteForm->createView(),
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,13 @@
|
|||||||
|
|
||||||
namespace Chill\EventBundle\Entity;
|
namespace Chill\EventBundle\Entity;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\HasScopeInterface;
|
||||||
|
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event
|
* Event
|
||||||
*/
|
*/
|
||||||
class Event
|
class Event implements HasScopeInterface, HasCenterInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var integer
|
* @var integer
|
||||||
|
@ -3,7 +3,7 @@ event:
|
|||||||
defaults: { _controller: "ChillEventBundle:Event:index" }
|
defaults: { _controller: "ChillEventBundle:Event:index" }
|
||||||
|
|
||||||
event_show:
|
event_show:
|
||||||
path: /{id}/show
|
path: /{event_id}/show
|
||||||
defaults: { _controller: "ChillEventBundle:Event:show" }
|
defaults: { _controller: "ChillEventBundle:Event:show" }
|
||||||
|
|
||||||
event_new:
|
event_new:
|
||||||
|
@ -3,8 +3,17 @@ Name: Nom
|
|||||||
Date: Date
|
Date: Date
|
||||||
Event type : Type d'événement
|
Event type : Type d'événement
|
||||||
See: Voir
|
See: Voir
|
||||||
|
Event: Événement
|
||||||
|
'Event : %label%': Événement "%label%"
|
||||||
|
Participation: Participation
|
||||||
|
Status: Statut
|
||||||
|
Last update: Dernière mise à jour
|
||||||
|
'%count% participations to this event': '{0} Aucun participant à l''événement | {1} Un participant à l''événement | ]1,Inf] %count% participants à l''événement'
|
||||||
|
|
||||||
|
#CRUD
|
||||||
|
Details of an event: Détails d'un événement
|
||||||
|
|
||||||
|
Edit all the participations: Modifier toutes les participations
|
||||||
|
|
||||||
#search
|
#search
|
||||||
Event search: Recherche d'événements
|
Event search: Recherche d'événements
|
||||||
|
@ -22,11 +22,11 @@
|
|||||||
<td>
|
<td>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
{% if is_granted('CHILL_EVENT_SEE_DETAILS', event) %}
|
{# {% if is_granted('CHILL_EVENT_SEE_DETAILS', event) %} #}
|
||||||
<a href="#" class="sc-button btn-action">
|
<a href="{{ path('event_show', { 'event_id' : event.id } ) }}" class="sc-button btn-action">
|
||||||
{{ 'See'|trans }}
|
{{ 'See'|trans }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{# {% endif %} #}
|
||||||
{% if is_granted('CHILL_EVENT_UPDATE', event) %}
|
{% if is_granted('CHILL_EVENT_UPDATE', event) %}
|
||||||
<a href="#" class="sc-button btn-edit">
|
<a href="#" class="sc-button btn-edit">
|
||||||
{{ 'Edit'|trans }}
|
{{ 'Edit'|trans }}
|
||||||
|
@ -1,36 +1,81 @@
|
|||||||
{% extends '::base.html.twig' %}
|
{% extends 'ChillEventBundle::layout.html.twig' %}
|
||||||
|
|
||||||
{% block body -%}
|
{% block title 'Event : %label%'|trans({ '%label%' : event.label } ) %}
|
||||||
<h1>Event</h1>
|
|
||||||
|
{% import 'ChillPersonBundle:Person:macro.html.twig' as person_macro %}
|
||||||
|
|
||||||
|
{% block event_content -%}
|
||||||
|
<h1>{{ 'Details of an event'|trans }}</h1>
|
||||||
|
|
||||||
<table class="record_properties">
|
<table class="record_properties">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Id</th>
|
<th>{{ 'Name'|trans }}</th>
|
||||||
<td>{{ entity.id }}</td>
|
<td>{{ event.label }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Label</th>
|
<th>{{ 'Date'|trans }}</th>
|
||||||
<td>{{ entity.label }}</td>
|
<td>{{ event.date|localizeddate('long', 'none') }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Date</th>
|
<th>{{ 'Event type'|trans }}</th>
|
||||||
<td>{{ entity.date|date('Y-m-d H:i:s') }}</td>
|
<td>{{ event.type.label|localize_translatable_string }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>{{ 'Circle'|trans }}</th>
|
||||||
|
<td>{{ event.circle.name|localize_translatable_string }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('event_edit', { 'id': event.id }) }}" class="sc-button btn-edit">
|
||||||
|
{{ 'Edit'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>{{ 'Participation'|trans }}</h2>
|
||||||
|
{% set count = event.participations|length %}
|
||||||
|
<p>{% transchoice count %}%count% participations to this event{% endtranschoice %}</p>
|
||||||
|
|
||||||
|
{% if count > 0 %}
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{{ 'Person'|trans }}</th>
|
||||||
|
<th>{{ 'Role'|trans }}</th>
|
||||||
|
<th>{{ 'Status'|trans }}</th>
|
||||||
|
<th>{{ 'Last update'|trans }}</th>
|
||||||
|
<th> </th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for participation in event.participations %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ person_macro.render(participation.person) }}</td>
|
||||||
|
<td>{{ participation.role.label|localize_translatable_string }}</td>
|
||||||
|
<td>{{ participation.status.label|localize_translatable_string }}</td>
|
||||||
|
<td>{{ participation.lastUpdate|localizeddate("long", "none") }}</td>
|
||||||
|
<td>
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li>
|
||||||
|
<a href="#" class="sc-button btn-edit">
|
||||||
|
{{ 'Edit'|trans }}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<ul class="record_actions">
|
||||||
|
<li><a href="#" class="sc-button btn-edit">{{ 'Edit all the participations'|trans }}</a></li>
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('event') }}">
|
|
||||||
Back to the list
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('event_edit', { 'id': entity.id }) }}">
|
|
||||||
Edit
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>{{ form(delete_form) }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block layout_wvm_content %}
|
{% block layout_wvm_content %}
|
||||||
{% block event_content %}}<!-- block event content empty -->
|
{% block event_content %}<!-- block event content empty -->
|
||||||
<h1>{{ 'Event' |trans }}</h1>
|
<h1>{{ 'Event' |trans }}</h1>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -8,6 +8,7 @@ use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
|
|||||||
use Chill\MainBundle\Security\ProvideRoleInterface;
|
use Chill\MainBundle\Security\ProvideRoleInterface;
|
||||||
use Chill\EventBundle\Entity\Event;
|
use Chill\EventBundle\Entity\Event;
|
||||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||||
|
use Chill\MainBundle\Entity\User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description of EventVoter
|
* Description of EventVoter
|
||||||
@ -42,12 +43,12 @@ class EventVoter extends AbstractChillVoter implements ProvideRoleInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function isGranted($attribute, $event, $user = null)
|
protected function isGranted($attribute, $event, $user = null)
|
||||||
{
|
{
|
||||||
if (!$user instanceof User) {
|
if (!$user instanceof User) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->helper->userHasAccess($user, $event, $attribute);
|
return $this->authorizationHelper->userHasAccess($user, $event, $attribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRoles()
|
public function getRoles()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user