v52 bette datatables

This commit is contained in:
Fred Tempez 2023-10-21 13:55:14 +02:00
parent d3e6ca52d5
commit 052280f728
7 changed files with 38 additions and 6 deletions

View File

@ -50,7 +50,7 @@ class common
const ACCESS_TIMER = 1800;
// Numéro de version
const ZWII_VERSION = '1.0.51';
const ZWII_VERSION = '1.0.52';
// URL autoupdate
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/lms/';

View File

@ -108,7 +108,10 @@ class course extends common
// Valeurs en sortie
$this->addOutput([
'title' => helper::translate('Cours'),
'view' => 'index'
'view' => 'index',
'vendor' => [
'datatables'
]
]);
}
@ -423,6 +426,7 @@ class course extends common
foreach ($data['page'] as $pageId => $pageData) {
if ($pageData['position'] > 0) {
$sumPages++;
$pages[$pageId] = $pageData['title'];
}
}
@ -474,7 +478,7 @@ class course extends common
self::$courseUsers[] = [
$userId,
$this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']),
$pageId,
$pages[$pageId],
helper::dateUTF8('%d %B %Y - %H:%M', $maxTime),
template::button('userHistory' . $userId, [
'href' => helper::baseUrl() . 'course/userHistory/' . $courseId . '/' . $userId,

View File

@ -22,4 +22,31 @@ $(document).ready(function () {
$(location).attr("href", _this.attr("href"));
});
});
$('#dataTables').DataTable({
language: {
url: "core/vendor/datatables/french.json"
},
"columnDefs": [
{
target: 3,
orderable: false,
searchable: false
},
{
target: 4,
orderable: false,
searchable: false
},
{
target: 5,
orderable: false,
searchable: false
},
{
target: 6,
orderable: false,
searchable: false
}
]
});
});

View File

@ -22,7 +22,7 @@
</div>
</div>
<?php if($module::$courses): ?>
<?php echo template::table([2, 2, 2, 3, 1, 1, 1], $module::$courses, ['Titre court', 'Auteur', 'Description', 'Lien direct', '', '', '']); ?>
<?php echo template::table([2, 2, 2, 3, 1, 1, 1], $module::$courses, ['Titre court', 'Auteur', 'Description', 'Lien direct', '', '', ''], ['id' => 'dataTables']); ?>
<?php else: ?>
<?php echo template::speech('Aucun Cours'); ?>
<?php endif; ?>

View File

@ -35,6 +35,7 @@ $(document).ready((function () {
"columnDefs": [
{
target: 5,
orderable: false,
searchable: false
}
]

View File

@ -40,7 +40,7 @@
</div>
<?php echo template::formClose(); ?>
<?php if ($module::$courseUsers): ?>
<?php echo template::table([2, 3, 3, 2, 1, 1], $module::$courseUsers, ['Id', 'Nom Prénom', 'Id dernière page', 'Date - Heure', 'Progression', ''], ['id' => 'dataTables']); ?>
<?php echo template::table([2, 3, 3, 2, 1, 1], $module::$courseUsers, ['Id', 'Nom Prénom', 'Dernière page vue', 'Date - Heure', 'Progression', ''], ['id' => 'dataTables']); ?>
<?php else: ?>
<?php echo template::speech('Aucun inscrit'); ?>
<?php endif; ?>

View File

@ -10,7 +10,7 @@
<?php if ($module::$userHistory): ?>
<div class="row textAlignCenter">
<div class="col8">
<?php echo template::table([1, 6, 5], $module::$userHistory, ['Ordre', 'Titre de la page', 'Dernière consultation de cette page'], ['id' => 'dataTables']); ?>
<?php echo template::table([1, 6, 5], $module::$userHistory, ['Ordre', 'Dernière consultation de cette page', 'Titre de la page'], ['id' => 'dataTables']); ?>
</div>
</div>
<?php else: ?>