1.4.16 Les exports des historiques se font dans le dossier de l'espace

This commit is contained in:
Fred Tempez 2024-01-30 18:57:24 +01:00
parent 052f4ac035
commit 9126d2887b

View File

@ -1210,16 +1210,14 @@ class course extends common
// Tri du tableau par défaut par $userId // Tri du tableau par défaut par $userId
ksort($users); ksort($users);
// Dossier temporaire // Dossier d'export
if (is_dir(self::FILE_DIR . 'source/export') === false) { if (is_dir(self::FILE_DIR . 'source/' . $courseId) === false) {
mkdir(self::FILE_DIR . 'source/export'); mkdir(self::FILE_DIR . 'source/' . $courseId);
} }
if (is_dir(self::FILE_DIR . 'source/export/' . $courseId) === false) { if (is_dir(self::FILE_DIR . 'source/' . $courseId . '/export/') === false) {
mkdir(self::FILE_DIR . 'source/export/' . $courseId); mkdir(self::FILE_DIR . 'source/' . $courseId . '/export/');
} }
$path = self::FILE_DIR . 'source/export/'; $filename = self::FILE_DIR . 'source/' . $courseId . '/export/' . '/synthèse' . helper::dateUTF8('%Y%m%d', time()) . '.csv';
$filename = $path . $courseId . '/synthèse' . helper::dateUTF8('%Y%m%d', time()) . '.csv';
foreach ($users as $userId => $userValue) { foreach ($users as $userId => $userValue) {
@ -1330,15 +1328,15 @@ class course extends common
} }
} }
// Dossier temporaire // Dossier d'export
if (is_dir(self::FILE_DIR . 'source/export') === false) { if (is_dir(self::FILE_DIR . 'source/' . $courseId) === false) {
mkdir(self::FILE_DIR . 'source/export'); mkdir(self::FILE_DIR . 'source/' . $courseId);
} }
if (is_dir(self::FILE_DIR . 'source/export/' . $courseId) === false) { if (is_dir(self::FILE_DIR . 'source/' . $courseId . '/export/') === false) {
mkdir(self::FILE_DIR . 'source/export/' . $courseId); mkdir(self::FILE_DIR . 'source/' . $courseId . '/export/');
} }
$path = self::FILE_DIR . 'source/export/'; $filename = self::FILE_DIR . 'source/' . $courseId . '/export/' . $userId . '.csv';
$filename = $path . $courseId . '/' . $userId . '.csv';
$file = fopen($filename, 'w'); $file = fopen($filename, 'w');
foreach (self::$userHistory as $keys => $values) { foreach (self::$userHistory as $keys => $values) {