diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php index 02d97ea..f89a57f 100644 --- a/src/Controller/AdminController.php +++ b/src/Controller/AdminController.php @@ -678,44 +678,48 @@ class AdminController extends AbstractController return $response; } - #[Route('/watchdog', name: 'watchdog')] - #[Route('/watchdog/{type}', name: 'watchdog_type')] - #[Route('/watchdog/{type}/{action}', name: 'watchdog_type_action')] + + #[Route('/watchdog/{type?*}/{id?*}/{action?*}', name: 'watchdog')] public function watchdog( PaginatorInterface $paginator, Request $Request, EntityManagerInterface $EntityManagerInterface, string $type = null, - string $action = null + string $action = null, + string $id = null ): Response { - /** - * @var LogEntryRepository $logEntryRepository - */ - $logEntryRepository = $EntityManagerInterface->getRepository('Gedmo\Loggable\Entity\LogEntry'); $qb = $EntityManagerInterface->createQueryBuilder(); $qbButtons = $EntityManagerInterface->createQueryBuilder(); + $qbButtonsAction = $EntityManagerInterface->createQueryBuilder(); $qb->select('l') ->from('Gedmo\Loggable\Entity\LogEntry', 'l') ->orderBy('l.loggedAt', 'DESC'); $qbButtons->select('DISTINCT l.objectClass') - ->from('Gedmo\Loggable\Entity\LogEntry', 'l') - ->orderBy('l.loggedAt', 'DESC'); + ->from('Gedmo\Loggable\Entity\LogEntry', 'l') + ->orderBy('l.objectClass', 'ASC'); - if (null != $type) { + $qbButtonsAction->select('DISTINCT l.action') + ->from('Gedmo\Loggable\Entity\LogEntry', 'l') + ->orderBy('l.action', 'ASC'); + + + + if (null != $type && '*' != $type) { $qb->where('l.objectClass = :type'); $qb->setParameter('type', 'App\Entity\\' . $type); - $qbButtonsAction = $EntityManagerInterface->createQueryBuilder(); - $qbButtonsAction->select('DISTINCT l.action') - ->from('Gedmo\Loggable\Entity\LogEntry', 'l') - ->orderBy('l.loggedAt', 'DESC'); + } - if (null != $action) { - $qb->andWhere('l.action = :action'); - $qb->setParameter('action', $action); - } + if (null != $action && '*' != $action) { + $qb->andWhere('l.action = :action'); + $qb->setParameter('action', $action); + } + + if (null != $id && '*' != $id) { + $qb->andWhere('l.objectId = :id'); + $qb->setParameter('id', $id); } $pagination = $paginator->paginate( @@ -725,11 +729,13 @@ class AdminController extends AbstractController return $this->render('admin/watchdog.html.twig', [ 'controller_name' => 'AdminController', - 'pagination' => $pagination, - 'buttonsType' => $qbButtons->getQuery()->getResult(), 'type' => $type, - 'buttonsAction' => (($type != null) ? $qbButtonsAction->getQuery()->getResult() : null), 'action' => $action, + 'id' => $id, + 'buttonsType' => $qbButtons->getQuery()->getResult(), + 'buttonsAction' => $qbButtonsAction->getQuery()->getResult(), + 'pagination' => $pagination, + ]); } diff --git a/templates/_cells/historyDisplay.html.twig b/templates/_cells/historyDisplay.html.twig index 4cdd176..9d3c818 100644 --- a/templates/_cells/historyDisplay.html.twig +++ b/templates/_cells/historyDisplay.html.twig @@ -11,7 +11,7 @@ {% endif %}

{% if notype is not defined %} -

{{ i.objectClass }} (# {{ i.objectId }})

+

{{ i.objectClass }} (# {{ i.objectId }}) {% if is_granted('ROLE_ADMIN') %}{% endif %}

{% endif %}

{{ ('title_data_' ~ i.action)|trans }}

diff --git a/templates/admin/watchdog.html.twig b/templates/admin/watchdog.html.twig index 3fa2e68..21025e1 100644 --- a/templates/admin/watchdog.html.twig +++ b/templates/admin/watchdog.html.twig @@ -7,30 +7,39 @@
-

Filtres

-
Type:
- * - {% for t in buttonsType %} - {% set btntype = t.objectClass|replace({'App\\Entity\\': ''}) %} - {{ btntype }} - {% endfor %} +

{% trans %}title_filter{% endtrans %}

+ + {% if id is null or id == '*' %} +
{% trans %}title_type{% endtrans %}:
+ * + {% for t in buttonsType %} + {% set btntype = t.objectClass|replace({'App\\Entity\\': ''}) %} + {{ btntype }} + {% endfor %} + + {% else %} + {% trans %}button_back{% endtrans %} + {% endif %} {% if buttonsAction != null %} -
Action:
- * +
{% trans %}title_actions{% endtrans %}:
+ * {% for a in buttonsAction %} - {{ a.action }} + {{ a.action }} {% endfor %} {% endif %}
+
{% include '_cells/historyDisplay.html.twig' with {'history': pagination} %}
+
{{ knp_pagination_render(pagination) }} -
+
+ {% endblock %} diff --git a/translations/messages+intl-icu.en.yaml b/translations/messages+intl-icu.en.yaml index 39861e0..dc44d94 100644 --- a/translations/messages+intl-icu.en.yaml +++ b/translations/messages+intl-icu.en.yaml @@ -145,6 +145,7 @@ breadcrumb_view: View button_add_comment: Add a comment button_add_group: Add Group button_add: Add +button_back: Back button_cancel: Cancel button_change_password: Change password button_create: Create @@ -692,6 +693,7 @@ title_errorpage_error_message: This page seems to be malfunctioning, please cont title_errorpage_error: Error title_faceImage: Face photo title_field: Fields +title_filter: Filters title_folder_add_directories: List of Directories for adding to a folder title_folder_add_directory: Adding a directory to the folder title_folder_add_documents: Adding a document to the folder diff --git a/translations/messages+intl-icu.fr.yaml b/translations/messages+intl-icu.fr.yaml index 5f92705..f8ca39a 100644 --- a/translations/messages+intl-icu.fr.yaml +++ b/translations/messages+intl-icu.fr.yaml @@ -145,6 +145,7 @@ breadcrumb_view: Voir button_add_comment: Ajouter un commentaire button_add_group: Créer un groupe button_add: Ajouter +button_back: Retour button_cancel: Annuler button_change_password: Changer de mot de passe button_create: Créer @@ -691,6 +692,7 @@ title_errorpage_error_message: Cette page semble mal fonctionner, merci de conta title_errorpage_error: Ouups ! title_faceImage: Photo de Face title_field: Champs +title_filter: Filtre title_folder_add_directories: Liste des fiches pour ajout au dossier title_folder_add_directory: Ajouter une fiche au dossier title_folder_add_documents: Ajouter un document au dossier diff --git a/visionversion.json b/visionversion.json index 9379a31..ed58696 100644 --- a/visionversion.json +++ b/visionversion.json @@ -1,3 +1,3 @@ { - "version": "0.2.8" + "version": "0.2.9" }