From 103991b2beca4c4dd55334bcba8d68dd7f68ebca Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Sat, 9 Dec 2023 17:51:36 +0100 Subject: [PATCH] userHistory, one event a line --- core/module/course/course.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/core/module/course/course.php b/core/module/course/course.php index 1b69eaa..d0a4376 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -970,20 +970,22 @@ class course extends common if (is_array($times)) { $d = array(); foreach ($times as $time) { - $d[] = helper::dateUTF8('%d %B %Y - %H:%M:%S', $time); + self::$userHistory[] = [ + $pages[$pageId]['number'], + html_entity_decode($pages[$pageId]['title']), + helper::dateUTF8('%d %B %Y %H:%M:%S', $time) + ]; } - $dates = implode('
', $d); } else { - $dates = helper::dateUTF8('%d %B %Y - %H:%M:%S', $times); + self::$userHistory[] = [ + $pages[$pageId]['number'], + html_entity_decode($pages[$pageId]['title']), + helper::dateUTF8('%d %B %Y %H:%M:%S', $times) + ]; } - - self::$userHistory[$pageId] = [ - $pages[$pageId]['number'], - $pages[$pageId]['title'], - $dates, - ]; } + // Valeurs en sortie $this->addOutput([ 'title' => helper::translate('Historique ') . $this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']), @@ -1110,8 +1112,6 @@ class course extends common helper::dateUTF8('%d %B %Y %H:%M:%S', $times) ]; } - - } // Dossier temporaire @@ -1124,7 +1124,7 @@ class course extends common $path = self::FILE_DIR . 'source/export/'; $filename = $path . $courseId . '/' . $userId . '.csv'; $file = fopen($filename, 'w'); - + foreach (self::$userHistory as $keys => $values) { $data = $values; // Écrire la ligne dans le fichier CSV