From 6a72676c7c93a4dc63c1b03bfb0a6de98d8d10af Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Thu, 11 Apr 2024 07:58:26 +0200 Subject: [PATCH] update to test --- core/include/update.inc.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/core/include/update.inc.php b/core/include/update.inc.php index f701c18..48c6ca8 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -44,8 +44,19 @@ if ( } } // Stocke le rapport en CSV - $file = fopen(self::DATA_DIR . $courseId . '/report.csv', 'a+'); - fputcsv($file, [$data], ';'); + $file = fopen(self::DATA_DIR . $courseId . '/report.csv', 'w'); + + // Parcourir les données + foreach ($data as $name => $userData) { + foreach ($userData as $pageId => $timestamps) { + foreach ($timestamps as $timestamp) { + // Écrire chaque ligne dans le fichier CSV + fputcsv($file, array($name, $pageId, $timestamp), ';'); + } + } + } + + // Fermer le fichier fclose($file); } //$this->setData(['core', 'dataVersion', 1800]);