From bb93b1b313134ac16e322a8857de2e468d046666 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sat, 13 Apr 2024 10:05:32 +0200 Subject: [PATCH] User report ok --- core/module/course/course.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/core/module/course/course.php b/core/module/course/course.php index 842ad3b..6ab6d77 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -1169,17 +1169,18 @@ class course extends common } $userId = $this->getUrl(3); - $h = $this->getData(['enrolment', $courseId, $userId, 'history']); + $h = $this->getReport($courseId, $userId); + $h = $h[$userId]; // Inversion des clés et des valeurs - $history = array(); + $report = array(); foreach ($h as $key => $values) { foreach ($values as $value) { - $history[$value] = $key; + $report[$value] = $key; } } - ksort($history); + ksort($report); // Liste des pages contenues dans cet espace et exclure les barres et les pages masquées $p = json_decode(file_get_contents(self::DATA_DIR . $courseId . '/page.json'), true); @@ -1195,7 +1196,7 @@ class course extends common $topTime = 0; $lastView = 0; - foreach ($history as $time => $pageId) { + foreach ($report as $time => $pageId) { if (isset($pages[$pageId]['title'])) { $lastView = ($lastView === 0) ? $time : $lastView; $diff = $time - $lastView; @@ -1376,17 +1377,18 @@ class course extends common } // Traitement de l'historique - $h = $this->getData(['enrolment', $courseId, $userId, 'history']); + $h = $this->getReport($courseId, $userId); + $h = $h[$userId]; // Inversion des clés et des valeurs - $history = array(); + $report = array(); foreach ($h as $key => $values) { foreach ($values as $value) { - $history[$value] = $key; + $report[$value] = $key; } } - ksort($history); + ksort($report); // Liste des pages contenues dans cet espace et exclure les barres et les pages masquées $p = json_decode(file_get_contents(self::DATA_DIR . $courseId . '/page.json'), true); @@ -1400,7 +1402,7 @@ class course extends common $lastView = 0; - foreach ($history as $time => $pageId) { + foreach ($report as $time => $pageId) { if (isset($pages[$pageId]['title'])) { $lastView = ($lastView === 0) ? $time : $lastView; $diff = $time - $lastView;