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; const ACCESS_TIMER = 1800;
// Numéro de version // Numéro de version
const ZWII_VERSION = '1.0.51'; const ZWII_VERSION = '1.0.52';
// URL autoupdate // URL autoupdate
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/lms/'; 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 // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => helper::translate('Cours'), 'title' => helper::translate('Cours'),
'view' => 'index' 'view' => 'index',
'vendor' => [
'datatables'
]
]); ]);
} }
@ -423,6 +426,7 @@ class course extends common
foreach ($data['page'] as $pageId => $pageData) { foreach ($data['page'] as $pageId => $pageData) {
if ($pageData['position'] > 0) { if ($pageData['position'] > 0) {
$sumPages++; $sumPages++;
$pages[$pageId] = $pageData['title'];
} }
} }
@ -474,7 +478,7 @@ class course extends common
self::$courseUsers[] = [ self::$courseUsers[] = [
$userId, $userId,
$this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']), $this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']),
$pageId, $pages[$pageId],
helper::dateUTF8('%d %B %Y - %H:%M', $maxTime), helper::dateUTF8('%d %B %Y - %H:%M', $maxTime),
template::button('userHistory' . $userId, [ template::button('userHistory' . $userId, [
'href' => helper::baseUrl() . 'course/userHistory/' . $courseId . '/' . $userId, 'href' => helper::baseUrl() . 'course/userHistory/' . $courseId . '/' . $userId,

View File

@ -22,4 +22,31 @@ $(document).ready(function () {
$(location).attr("href", _this.attr("href")); $(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>
</div> </div>
<?php if($module::$courses): ?> <?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 else: ?>
<?php echo template::speech('Aucun Cours'); ?> <?php echo template::speech('Aucun Cours'); ?>
<?php endif; ?> <?php endif; ?>

View File

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

View File

@ -40,7 +40,7 @@
</div> </div>
<?php echo template::formClose(); ?> <?php echo template::formClose(); ?>
<?php if ($module::$courseUsers): ?> <?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 else: ?>
<?php echo template::speech('Aucun inscrit'); ?> <?php echo template::speech('Aucun inscrit'); ?>
<?php endif; ?> <?php endif; ?>

View File

@ -10,7 +10,7 @@
<?php if ($module::$userHistory): ?> <?php if ($module::$userHistory): ?>
<div class="row textAlignCenter"> <div class="row textAlignCenter">
<div class="col8"> <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>
</div> </div>
<?php else: ?> <?php else: ?>