forked from ZwiiCMS-Team/ZwiiCampus
Datatables dans course user et users
This commit is contained in:
parent
b1f1d1b54d
commit
03050aa1e2
@ -139,7 +139,8 @@ class common
|
|||||||
'tippy',
|
'tippy',
|
||||||
'zwiico',
|
'zwiico',
|
||||||
'imagemap',
|
'imagemap',
|
||||||
'simplelightbox'
|
'simplelightbox',
|
||||||
|
'datatables'
|
||||||
],
|
],
|
||||||
'view' => ''
|
'view' => ''
|
||||||
];
|
];
|
||||||
|
@ -413,14 +413,16 @@ class course extends common
|
|||||||
// Statistiques du cours sélectionné calcul du nombre de pages
|
// Statistiques du cours sélectionné calcul du nombre de pages
|
||||||
$currentSite = self::$siteContent;
|
$currentSite = self::$siteContent;
|
||||||
$this->initDB('page', $courseId);
|
$this->initDB('page', $courseId);
|
||||||
$sumPages = count($this->getData(['page']));
|
$sumPages = count($this->getHierarchy(null, false)); // Supprimer les barres
|
||||||
self::$siteContent = $currentSite;
|
self::$siteContent = $currentSite;
|
||||||
|
|
||||||
// Liste des inscrits dans le cours sélectionné.
|
// Liste des inscrits dans le cours sélectionné.
|
||||||
$users = $this->getData(['enrolment', $courseId]);
|
$users = $this->getData(['enrolment', $courseId]);
|
||||||
|
// Tri du tableau par défaut par $userId
|
||||||
ksort($users);
|
ksort($users);
|
||||||
foreach ($users as $userId => $userValue) {
|
foreach ($users as $userId => $userValue) {
|
||||||
$history = $userValue['history'];
|
$history = $userValue['history'];
|
||||||
|
|
||||||
$maxTime = max($history);
|
$maxTime = max($history);
|
||||||
$pageId = array_search($maxTime, $history);
|
$pageId = array_search($maxTime, $history);
|
||||||
// Filtres
|
// Filtres
|
||||||
@ -457,7 +459,8 @@ class course extends common
|
|||||||
$this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']),
|
$this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']),
|
||||||
$pageId,
|
$pageId,
|
||||||
helper::dateUTF8('%d %B %Y - %H:%M', $maxTime),
|
helper::dateUTF8('%d %B %Y - %H:%M', $maxTime),
|
||||||
round(($viewPages * 100)/ $sumPages, 1) . ' %',
|
//round(($viewPages * 100)/ $sumPages, 1) . ' %',
|
||||||
|
$viewPages . ' / ' . $sumPages,
|
||||||
template::button('userDelete' . $userId, [
|
template::button('userDelete' . $userId, [
|
||||||
'class' => 'userDelete buttonRed',
|
'class' => 'userDelete buttonRed',
|
||||||
'href' => helper::baseUrl() . 'course/userDelete/' . $courseId . '/' . $userId,
|
'href' => helper::baseUrl() . 'course/userDelete/' . $courseId . '/' . $userId,
|
||||||
@ -471,7 +474,10 @@ class course extends common
|
|||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'title' => sprintf(helper::translate('Inscrits dans le cours %s'), $this->getData(['course', $courseId, 'title'])),
|
'title' => sprintf(helper::translate('Inscrits dans le cours %s'), $this->getData(['course', $courseId, 'title'])),
|
||||||
'view' => 'user'
|
'view' => 'user',
|
||||||
|
'vendor' => [
|
||||||
|
'datatables'
|
||||||
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,4 +28,30 @@ $(document).ready((function () {
|
|||||||
}))
|
}))
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
$('#dataTables').DataTable({
|
||||||
|
language: {
|
||||||
|
processing: "Traitement en cours...",
|
||||||
|
search: "Rechercher :",
|
||||||
|
lengthMenu: "Afficher _MENU_ éléments",
|
||||||
|
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)",
|
||||||
|
infoPostFix: "",
|
||||||
|
loadingRecords: "Chargement en cours...",
|
||||||
|
zeroRecords: "Aucun élément à afficher",
|
||||||
|
emptyTable: "Aucune donnée disponible dans le tableau",
|
||||||
|
paginate: {
|
||||||
|
first: "Premier",
|
||||||
|
previous: "Précédent",
|
||||||
|
next: "Suivant",
|
||||||
|
last: "Dernier"
|
||||||
|
},
|
||||||
|
aria: {
|
||||||
|
sortAscending: ": activer pour trier la colonne par ordre croissant",
|
||||||
|
sortDescending: ": activer pour trier la colonne par ordre décroissant"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}));
|
}));
|
@ -18,12 +18,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php echo template::formOpen('courseFilterUserForm'); ?>
|
<?php echo template::formOpen('courseFilterUserForm'); ?>
|
||||||
<div class="row">
|
|
||||||
<div class="col12">
|
|
||||||
<div class="block">
|
|
||||||
<h4>
|
|
||||||
<?php echo helper::translate('Filtres'); ?>
|
|
||||||
</h4>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php echo template::select('courseFilterGroup', $module::$courseGroups, [
|
<?php echo template::select('courseFilterGroup', $module::$courseGroups, [
|
||||||
@ -44,12 +38,9 @@
|
|||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</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', '']); ?>
|
<?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 else: ?>
|
<?php else: ?>
|
||||||
<?php echo template::speech('Aucun inscrit'); ?>
|
<?php echo template::speech('Aucun inscrit'); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
@ -18,7 +18,34 @@ $(document).ready((function () {
|
|||||||
$(location).attr("href", _this.attr("href"))
|
$(location).attr("href", _this.attr("href"))
|
||||||
}))
|
}))
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$("#userFilterGroup, #userFilterFirstName, #userFilterLastName").change(function () {
|
$("#userFilterGroup, #userFilterFirstName, #userFilterLastName").change(function () {
|
||||||
$("#userFilterUserForm").submit();
|
$("#userFilterUserForm").submit();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#dataTables').DataTable({
|
||||||
|
language: {
|
||||||
|
processing: "Traitement en cours...",
|
||||||
|
search: "Rechercher :",
|
||||||
|
lengthMenu: "Afficher _MENU_ éléments",
|
||||||
|
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)",
|
||||||
|
infoPostFix: "",
|
||||||
|
loadingRecords: "Chargement en cours...",
|
||||||
|
zeroRecords: "Aucun élément à afficher",
|
||||||
|
emptyTable: "Aucune donnée disponible dans le tableau",
|
||||||
|
paginate: {
|
||||||
|
first: "Premier",
|
||||||
|
previous: "Précédent",
|
||||||
|
next: "Suivant",
|
||||||
|
last: "Dernier"
|
||||||
|
},
|
||||||
|
aria: {
|
||||||
|
sortAscending: ": activer pour trier la colonne par ordre croissant",
|
||||||
|
sortDescending: ": activer pour trier la colonne par ordre décroissant"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
}));
|
}));
|
@ -39,12 +39,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php echo template::formOpen('userFilterUserForm'); ?>
|
<?php echo template::formOpen('userFilterUserForm'); ?>
|
||||||
<div class="row">
|
|
||||||
<div class="col12">
|
|
||||||
<div class="block">
|
|
||||||
<h4>
|
|
||||||
<?php echo helper::translate('Filtres'); ?>
|
|
||||||
</h4>
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col3">
|
<div class="col3">
|
||||||
<?php echo template::select('userFilterGroup', $module::$courseGroups, [
|
<?php echo template::select('userFilterGroup', $module::$courseGroups, [
|
||||||
@ -65,8 +59,5 @@
|
|||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php echo template::formClose(); ?>
|
<?php echo template::formClose(); ?>
|
||||||
<?php echo template::table([2, 2 , 3, 3, 1, 1], $module::$users, ['Identifiant', 'Nom', 'Groupe', 'Profil', '', '']); ?>
|
<?php echo template::table([2, 2, 3, 3, 1, 1], $module::$users, ['Identifiant', 'Nom', 'Groupe', 'Profil', '', ''], ['id' => 'dataTables']); ?>
|
15
core/vendor/datatables/datatables.min.css
vendored
Normal file
15
core/vendor/datatables/datatables.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
26
core/vendor/datatables/datatables.min.js
vendored
Normal file
26
core/vendor/datatables/datatables.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
core/vendor/datatables/inc.json
vendored
Normal file
4
core/vendor/datatables/inc.json
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[
|
||||||
|
"datatables.min.js",
|
||||||
|
"datatables.min.css"
|
||||||
|
]
|
8
core/vendor/imagemap/image-map.min.js
vendored
8
core/vendor/imagemap/image-map.min.js
vendored
@ -1,8 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2018, Travis Clarke (https://www.travismclarke.com/)
|
|
||||||
*
|
|
||||||
* This source code is licensed under the Apache-2.0 license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],t):e.ImageMap=t(e.$)}(this,function(e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function o(e){return i(e)||a(e)||u()}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}}function a(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function c(e,t){return new s(e,t)}e=e&&e.hasOwnProperty("default")?e.default:e;var d="resize",f="load",l="complete",s=function(){function e(n,r){t(this,e),this.selector=n instanceof Array?n:o(document.querySelectorAll(n)),document.readyState!==l?window.addEventListener(f,this.update.bind(this)):this.update(),window.addEventListener(d,this.debounce(this.update,r).bind(this))}return r(e,[{key:"update",value:function(){var e=this;this.selector.forEach(function(t){if(void 0!==t.getAttribute("usemap")){t.cloneNode().addEventListener(f,e.handleImageLoad(t.offsetWidth,t.offsetHeight))}})}},{key:"debounce",value:function(e){var t,n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500;return function(){for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];window.clearTimeout(t),t=window.setTimeout(function(t){return e.apply(t,i)},r,n)}}},{key:"handleImageLoad",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(r){var i=r.target.width,a=r.target.height,u=t/100,c=n/100,d=r.target.getAttribute("usemap").replace(/^#/,"")
|
|
||||||
;o(document.querySelectorAll(e.genAreaSelector(d))).forEach(function(e){var t=e.dataset.coords=e.dataset.coords||e.getAttribute("coords"),n=t.split(",");e.setAttribute("coords",""+n.map(function(e,t){return t%2==0?+(n[t]/i*100*u):+(n[t]/a*100*c)}))})}}}],[{key:"genAreaSelector",value:function(e){return'map[name="'.concat(e,'"] area')}}]),e}();return void 0!==e&&e.fn&&(e.fn.imageMap=function(e){return new s(this.toArray(),e)}),c.VERSION="1.1.5",c});
|
|
4
core/vendor/imagemap/inc.json
vendored
4
core/vendor/imagemap/inc.json
vendored
@ -1,4 +0,0 @@
|
|||||||
[
|
|
||||||
"image-map.min.js",
|
|
||||||
"init.js"
|
|
||||||
]
|
|
6
core/vendor/imagemap/init.js
vendored
6
core/vendor/imagemap/init.js
vendored
@ -1,6 +0,0 @@
|
|||||||
/**
|
|
||||||
* Initialisation du redimensionner de mapf
|
|
||||||
*/
|
|
||||||
$(function() {
|
|
||||||
$('img[usemap]').imageMap();
|
|
||||||
});
|
|
2
core/vendor/imagemap/read.me
vendored
2
core/vendor/imagemap/read.me
vendored
@ -1,2 +0,0 @@
|
|||||||
Article https://blog.travismclarke.com/project/imagemap/
|
|
||||||
Générateur : https://www.image-map.net/
|
|
Loading…
Reference in New Issue
Block a user