Stats de consultation
This commit is contained in:
parent
30d96fb24c
commit
0fb328980c
@ -466,12 +466,11 @@ class course extends common
|
|||||||
self::$alphabet = array_combine($alphabet, self::$alphabet);
|
self::$alphabet = array_combine($alphabet, self::$alphabet);
|
||||||
self::$alphabet = array_merge(['all' => 'Tout'], self::$alphabet);
|
self::$alphabet = array_merge(['all' => 'Tout'], self::$alphabet);
|
||||||
|
|
||||||
// Statistiques du contenu sélectionné calcul du nombre de pages
|
// Liste des pages contenues dans cet espace et exclure les barres et les pages masquées
|
||||||
$sumPages = 0;
|
$sumPages = 0;
|
||||||
$data = json_decode(file_get_contents(self::DATA_DIR . $courseId . '/page.json'), true);
|
$pages = json_decode(file_get_contents(self::DATA_DIR . $courseId . '/page.json'), true);
|
||||||
|
$pages = $pages ['page'];
|
||||||
// Compter les pages et exclure les barres et les pages masquées
|
foreach ($pages as $pageId => $pageData) {
|
||||||
foreach ($data['page'] as $pageId => $pageData) {
|
|
||||||
if ($pageData['position'] > 0) {
|
if ($pageData['position'] > 0) {
|
||||||
$sumPages++;
|
$sumPages++;
|
||||||
}
|
}
|
||||||
@ -539,7 +538,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']),
|
||||||
$this->getData(['enrolment', $courseId, $userId, 'lastPageView']),
|
$pages[$this->getData(['enrolment', $courseId, $userId, 'lastPageView'])]['title'],
|
||||||
helper::dateUTF8('%d %B %Y - %H:%M', $this->getData(['enrolment', $courseId, $userId, 'datePageView'])),
|
helper::dateUTF8('%d %B %Y - %H:%M', $this->getData(['enrolment', $courseId, $userId, 'datePageView'])),
|
||||||
$this->getData(['user', $userId, 'tags']),
|
$this->getData(['user', $userId, 'tags']),
|
||||||
template::button('userHistory' . $userId, [
|
template::button('userHistory' . $userId, [
|
||||||
@ -950,10 +949,11 @@ class course extends common
|
|||||||
|
|
||||||
$courseId = $this->getUrl(2);
|
$courseId = $this->getUrl(2);
|
||||||
$userId = $this->getUrl(3);
|
$userId = $this->getUrl(3);
|
||||||
$history = $this->getData(['enrolment', $courseId, $userId]);
|
$history = $this->getData(['enrolment', $courseId, $userId, 'history']);
|
||||||
|
|
||||||
|
// Liste des pages contenues dans cet espace et exclure les barres et les pages masquées
|
||||||
$data = json_decode(file_get_contents(self::DATA_DIR . $courseId . '/page.json'), true);
|
$data = json_decode(file_get_contents(self::DATA_DIR . $courseId . '/page.json'), true);
|
||||||
$data = $data['page'];
|
$data = $data['page'];
|
||||||
// Exclure les barres et les pages masquées
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ($data as $pageId => $pageData) {
|
foreach ($data as $pageId => $pageData) {
|
||||||
if ($pageData['position'] > 0) {
|
if ($pageData['position'] > 0) {
|
||||||
@ -966,6 +966,7 @@ class course extends common
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($history as $pageId => $times) {
|
foreach ($history as $pageId => $times) {
|
||||||
|
// Dates de consultation de la page
|
||||||
if (is_array($times)) {
|
if (is_array($times)) {
|
||||||
$d = array();
|
$d = array();
|
||||||
foreach ($times as $time) {
|
foreach ($times as $time) {
|
||||||
@ -973,7 +974,7 @@ class course extends common
|
|||||||
}
|
}
|
||||||
$dates = implode('<br />', $d);
|
$dates = implode('<br />', $d);
|
||||||
} else {
|
} else {
|
||||||
$dates = helper::dateUTF8('%d %B %Y - %H:%M:%S', $history);
|
$dates = helper::dateUTF8('%d %B %Y - %H:%M:%S', $times);
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$userHistory[$pageId] = [
|
self::$userHistory[$pageId] = [
|
||||||
|
@ -17,7 +17,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', 'Titre de la page', 'Consultations'], ['id' => 'dataTables']); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user