From a39985fe620687153656f0cf8e59565e725b6597 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Sat, 25 Nov 2023 15:10:10 +0100 Subject: [PATCH] add and remove all --- core/module/course/course.php | 4 ++-- .../course/view/usersAdd/usersAdd.js.php | 12 ++++++++++-- core/module/course/view/usersAdd/usersAdd.php | 16 +++++++++++++--- .../course/view/usersDelete/usersDelete.js.php | 12 +++++++++--- .../course/view/usersDelete/usersDelete.php | 18 ++++++++++++++---- core/vendor/datatables/french.json | 2 +- 6 files changed, 49 insertions(+), 15 deletions(-) diff --git a/core/module/course/course.php b/core/module/course/course.php index c7d9cac..250b99d 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -658,10 +658,10 @@ class course extends common // Construction du tableau self::$courseUsers[] = [ + template::checkbox($userId, true, '', ['class' => 'checkboxSelect']), $userId, $this->getData(['user', $userId, 'firstname']), $this->getData(['user', $userId, 'lastname']), - template::checkbox($userId, true, '', ['class' => 'checkboxSelect']) ]; } @@ -802,10 +802,10 @@ class course extends common // Construction du tableau self::$courseUsers[] = [ + template::checkbox($userId, true, '', ['class' => 'checkboxSelect']), $userId, $this->getData(['user', $userId, 'firstname']), $this->getData(['user', $userId, 'lastname']), - template::checkbox($userId, true, '', ['class' => 'checkboxSelect']) ]; } diff --git a/core/module/course/view/usersAdd/usersAdd.js.php b/core/module/course/view/usersAdd/usersAdd.js.php index 779c359..c3aa506 100644 --- a/core/module/course/view/usersAdd/usersAdd.js.php +++ b/core/module/course/view/usersAdd/usersAdd.js.php @@ -13,6 +13,15 @@ $(document).ready((function () { + $('#courseUserAddSelectAll').on('click', function() { + $('.checkboxSelect').prop('checked', true); + saveCheckboxState(); + }); + $('#courseUserAddSelectNone').on('click', function() { + $('.checkboxSelect').prop('checked', false); + saveCheckboxState(); + }); + $("#courseFilterGroup, #courseFilterFirstName, #courseFilterLastName").change(function () { saveCheckboxState(); $("#courseUsersAddForm").submit(); @@ -24,7 +33,7 @@ $(document).ready((function () { }, "columnDefs": [ { - target: 3, + target: 0, orderable: false, searchable: false, } @@ -45,7 +54,6 @@ $(document).ready((function () { // Empty local storage after submit $("#courseUsersAddSubmit").on("click", function () { - localStorage.setItem('checkboxState', JSON.stringify({})); }); diff --git a/core/module/course/view/usersAdd/usersAdd.php b/core/module/course/view/usersAdd/usersAdd.php index 04be52f..a9b4980 100644 --- a/core/module/course/view/usersAdd/usersAdd.php +++ b/core/module/course/view/usersAdd/usersAdd.php @@ -7,12 +7,22 @@ 'value' => template::ico('left') ]); ?> - -
+
+ 'Tout' + ]); ?> +
+
+ 'Aucun' + ]); ?> +
+
'Inscrire' ]); ?>
+
- 'dataTables']); ?> + 'dataTables']); ?> diff --git a/core/module/course/view/usersDelete/usersDelete.js.php b/core/module/course/view/usersDelete/usersDelete.js.php index 377a53b..b4048da 100644 --- a/core/module/course/view/usersDelete/usersDelete.js.php +++ b/core/module/course/view/usersDelete/usersDelete.js.php @@ -13,6 +13,14 @@ $(document).ready((function () { + $('#courseUserDeleteSelectAll').on('click', function() { + $('.checkboxSelect').prop('checked', true); + saveCheckboxState(); + }); + $('#courseUserDeleteSelectNone').on('click', function() { + $('.checkboxSelect').prop('checked', false); + saveCheckboxState(); + }); $("#courseFilterGroup, #courseFilterFirstName, #courseFilterLastName").change(function () { saveCheckboxState(); @@ -25,7 +33,7 @@ $(document).ready((function () { }, "columnDefs": [ { - target: 3, + target: 0, orderable: false, searchable: false, } @@ -46,9 +54,7 @@ $(document).ready((function () { // Empty local storage after submit $("#courseUsersDeleteSubmit").on("click", function () { - localStorage.setItem('checkboxState', JSON.stringify({})); - }); // Restore checkbox state on page load diff --git a/core/module/course/view/usersDelete/usersDelete.php b/core/module/course/view/usersDelete/usersDelete.php index 228e431..e303d50 100644 --- a/core/module/course/view/usersDelete/usersDelete.php +++ b/core/module/course/view/usersDelete/usersDelete.php @@ -1,19 +1,29 @@
- 'buttonGrey', 'href' => helper::baseUrl() . 'course/users/' . $this->getUrl(2), 'value' => template::ico('left') ]); ?>
-
-
+
+ 'Tout' + ]); ?> +
+
+ 'Aucun' + ]); ?> +
+
'buttonRed', 'value' => 'Désinscrire' ]); ?>
+
- 'dataTables']); ?> + 'dataTables']); ?> diff --git a/core/vendor/datatables/french.json b/core/vendor/datatables/french.json index bebf30a..52f6508 100644 --- a/core/vendor/datatables/french.json +++ b/core/vendor/datatables/french.json @@ -1,7 +1,7 @@ { "processing": "Traitement en cours...", "search": "Rechercher :", - "lengthMenu": "Afficher _MENU_ éléments", + "lengthMenu": "Éléments par page _MENU_", "info": "Affichage de l'élement _START_ à _END_ sur _TOTAL_ éléments", "infoEmpty": "Affichage de l'élement 0 à 0 sur 0 éléments", "infoFiltered": "(filtré de _MAX_ éléments au total)",