mise en place de la gestion des signataires

This commit is contained in:
afornerot 2019-05-09 14:10:23 +02:00
parent 86d6932d0b
commit 8e634842b3
5 changed files with 139 additions and 3 deletions

View File

@ -131,6 +131,52 @@ class NoticeController extends Controller
return $this->redirectToRoute($this->labelroute); return $this->redirectToRoute($this->labelroute);
} }
public function usersAction($id)
{
$notice = $this->getData($id);
return $this->render($this->labelentity.':users.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'notice' => $notice,
]);
}
public function usersdeleteAction($id,$userid)
{
$notice = $this->getData($id);
$em = $this->getDoctrine()->getManager();
$user = $em->getRepository("CadolesCoreBundle:User")->find($userid);
$notice->removeUser($user);
$em->flush();
return $this->render($this->labelentity.':users.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'notice' => $notice,
]);
}
public function usersdeleteallAction($id)
{
$notice = $this->getData($id);
$em = $this->getDoctrine()->getManager();
foreach($notice->getUsers() as $user) {
$notice->removeUser($user);
}
$em->flush();
return $this->render($this->labelentity.':users.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'notice' => $notice,
]);
}
public function havereadAction(Request $request) public function havereadAction(Request $request)
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();

View File

@ -148,6 +148,18 @@ cadoles_portal_config_notice_delete:
path: /config/notice/delete/{id} path: /config/notice/delete/{id}
defaults: { _controller: CadolesPortalBundle:Notice:delete } defaults: { _controller: CadolesPortalBundle:Notice:delete }
cadoles_portal_config_notice_users:
path: /config/notice/users/{id}
defaults: { _controller: CadolesPortalBundle:Notice:users }
cadoles_portal_config_notice_users_delete:
path: /config/notice/users/{id}/delete/{userid}
defaults: { _controller: CadolesPortalBundle:Notice:usersdelete }
cadoles_portal_config_notice_users_deleteall:
path: /config/notice/users/{id}/deleteall
defaults: { _controller: CadolesPortalBundle:Notice:usersdeleteall }
cadoles_portal_user_notice_haveread: cadoles_portal_user_notice_haveread:
path: /user/notice/haveread path: /user/notice/haveread
defaults: { _controller: CadolesPortalBundle:Notice:haveread } defaults: { _controller: CadolesPortalBundle:Notice:haveread }

View File

@ -29,6 +29,10 @@
<a href="{{ path('cadoles_portal_config_notice_update', { id: notice.id }) }}"> <a href="{{ path('cadoles_portal_config_notice_update', { id: notice.id }) }}">
{{ notice.title }} {{ notice.title }}
</a> </a>
<a style="float:right;" href="{{ path('cadoles_portal_config_notice_users', { id: notice.id }) }}" title="Signataires">
<i class='fa fa-users fa-1x'></i>
</a>
</div> </div>
<input type="hidden" name="notice_item[id][]" value="{{ notice.id }}" /> <input type="hidden" name="notice_item[id][]" value="{{ notice.id }}" />

View File

@ -0,0 +1,71 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{% set color = app.session.get('color') %}
<h1>
Gestion des Signataires de Chartes
</h1>
<div class="row">
<div class="col-md-12">
<p>
<a href="{{ path('cadoles_portal_config_notice_users_deleteall',{id:notice.id }) }}" class="btn btn-danger">Supprimer toutes les signatures</a>
<a class="btn btn-default" href={{ path('cadoles_portal_config_notice') }}>Annuler</a>
</p>
<div id="list" class="panel-group">
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
<thead>
<tr>
<th width="100px" class="no-sort">Action</th>
<th width="70px" class="no-sort">Avatar</th>
<th>Login</th>
<th>Nom</th>
<th>Prénom</th>
</tr>
</thead>
{% for user in notice.users %}
{% set colorbody = "background-color: #" ~ color['main'] %}
<tr>
<td>
<a href="{{ path('cadoles_portal_config_notice_users_delete',{id:notice.id,userid:user.id}) }}" data-method='delete'><i class='fa fa-trash fa-fw fa-2x'></i></a>
</td>
<td><img src="/{{ alias }}/uploads/avatar/{{ user.avatar }}" class="avatar" style="margin:auto;display:block;"></td>
<td>{{ user.username }}</td>
<td>{{ user.lastname }}</td>
<td>{{ user.firstname }}</td>
</tr>
<div
{% endfor %}
</table>
</div>
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
table = $('#dataTables').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false } ],
responsive: true,
iDisplayLength: 100,
order: [[ 2, "asc" ]],
drawCallback: function(settings) {
$("a[data-method='delete']").click(function(){
if( !confirm('Êtes-vous sûr de vouloir supprimer ce calendrier ?')) {
return false;
}
});
}
});
});
{% endblock %}

View File

@ -1,14 +1,12 @@
> Rendre l'alias paramétrage par genconfig > Rendre l'alias paramétrage par genconfig
> Ne pas supprimer/modifier les icons système > Ne pas supprimer/modifier les icons système
> Annonces pouvant $etre masquées par les utilisateurs > Annonces pouvant être masquées par les utilisateurs
> Gestion des signataires de charte
> Calendrier export ICS > Calendrier export ICS
> Pages duplicable > Pages duplicable
> Icone utilisateur > Icone utilisateur
> Déplacement de widget vers une autre page du meme user > Déplacement de widget vers une autre page du meme user
> Annonces dans pages spécifique
> widget ToDo > widget ToDo
> widget rss > widget rss
@ -17,5 +15,10 @@
> Améliorer la selection des users avec droits d'écriture sur blog / calendar > Améliorer la selection des users avec droits d'écriture sur blog / calendar
> Ajouter notion de user avec droits d'écriture sur page > Ajouter notion de user avec droits d'écriture sur page
> Widgets Envole
> Items Envole
> Synchronisation posh-profil à revoir