2023-09-05 15:21:01 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2024-03-07 17:47:54 +01:00
|
|
|
* Mises à jour suivant les versions de ZwiiCampus
|
2023-09-05 15:21:01 +02:00
|
|
|
*/
|
2024-03-07 17:47:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
$this->getData(['core', 'dataVersion']) < 1700
|
|
|
|
) {
|
|
|
|
// Supprime la variable path des profils, seul l'accès à l'espace et autorisé.
|
|
|
|
foreach (['1', '2'] as $group) {
|
2024-04-11 15:46:42 +02:00
|
|
|
foreach (array_keys($this->getData(['profil', $group])) as $profil) {
|
2024-03-07 17:47:54 +01:00
|
|
|
if (is_null($this->getData(['profil', $group, $profil, 'folder', 'path'])) === false) {
|
|
|
|
$path = $this->getData(['profil', $group, $profil, 'folder', 'path']);
|
|
|
|
$this->setData(['profil', $group, $profil, 'folder', 'homePath', $path]);
|
|
|
|
$this->setData(['profil', $group, $profil, 'folder', 'coursePath', $path]);
|
|
|
|
$this->deleteData(['profil', $group, $profil, 'folder', 'path']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->setData(['core', 'dataVersion', 1700]);
|
2024-04-11 07:55:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
$this->getData(['core', 'dataVersion']) < 1800
|
|
|
|
) {
|
2024-04-11 15:46:42 +02:00
|
|
|
// Parcourir la structure pour écrire dans les fichiers CSV
|
|
|
|
foreach ($this->getData(['enrolment']) as $courseId => $users) {
|
|
|
|
$filename = self::DATA_DIR . $courseId . '/report.csv';
|
|
|
|
$fp = fopen($filename, 'w');
|
|
|
|
foreach ($users as $userId => $userData) {
|
2024-04-12 09:52:39 +02:00
|
|
|
$history = array_key_exists('history', $userData) ? $userData['history'] : null;
|
|
|
|
|
|
|
|
if (is_array($history)) {
|
|
|
|
foreach ($history as $pageId => $timestamps) {
|
|
|
|
foreach ($timestamps as $timestamp) {
|
|
|
|
fputcsv($fp, [$userId, $pageId, $timestamp], ';');
|
|
|
|
}
|
2024-04-11 07:58:26 +02:00
|
|
|
}
|
|
|
|
}
|
2024-04-12 21:22:57 +02:00
|
|
|
$this->deleteData(['enrolment', $courseId, $userId, 'history']);
|
2024-04-11 07:58:26 +02:00
|
|
|
}
|
2024-04-11 15:46:42 +02:00
|
|
|
fclose($fp);
|
|
|
|
}
|
2024-04-12 21:22:57 +02:00
|
|
|
$this->setData(['core', 'dataVersion', 1800]);
|
2024-03-07 17:47:54 +01:00
|
|
|
}
|