Ordre okay

This commit is contained in:
Fred Tempez 2023-10-21 12:06:28 +02:00
parent d5d001d2b4
commit 2414ce072d

View File

@ -674,11 +674,23 @@ 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]);
$pages = 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);
$pages = $pages ['page']; $data = $data ['page'];
// Exclure les barres et les pages masquées
$count = 0;
foreach ($data as $pageId => $pageData) {
if ($pageData['position'] > 0) {
$count++;
$pages[$pageId] = [
'number' => $count,
'title' => $pageData['title'],
];
}
}
foreach ($history['history'] as $pageId => $time) { foreach ($history['history'] as $pageId => $time) {
self::$userHistory[$pageId] = [ self::$userHistory[$pageId] = [
$pages[$pageId]['number'],
helper::dateUTF8('%d %B %Y - %H:%M:%S', $time), helper::dateUTF8('%d %B %Y - %H:%M:%S', $time),
$pages[$pageId]['title'], $pages[$pageId]['title'],
]; ];