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-03 16:59:04 +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-03 16:59:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Déplacement des
|
|
|
|
if (
|
|
|
|
$this->getData(['core', 'dataVersion']) < 1800
|
|
|
|
) {
|
2024-04-04 11:27:48 +02:00
|
|
|
// Déplace les historiques dans les dossiers des esapaces
|
|
|
|
// Parcourir les espaces
|
|
|
|
foreach ($this->getData(['course']) as $courseId => $courseValues) {
|
|
|
|
$data = [];
|
|
|
|
//Parcourir les participants
|
|
|
|
foreach ($this->getData(['user']) as $userId => $userValues) {
|
|
|
|
// Un historique existe pour ce participant
|
|
|
|
$report = $this->getData(['enrolment', $courseId, $userId, 'history']);
|
|
|
|
if ( is_array($report)
|
|
|
|
) {
|
|
|
|
// Ecriture dans un fichier report dans le dossier de l'espace
|
|
|
|
$data = array_merge($data, [$userId => $report]);
|
|
|
|
// Nettoyage du fichier des inscriptions
|
|
|
|
// Ce fichier ne contient que l'id du participant et de la date et de l'id de la dernière page vue
|
2024-04-04 13:14:43 +02:00
|
|
|
$this->deleteData(['enrolment', $courseId, $userId, 'history']);
|
2024-04-04 11:27:48 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
file_put_contents(self::DATA_DIR . $courseId . '/report.json', json_encode(['report' => $data], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), LOCK_EX);
|
|
|
|
}
|
2024-04-03 16:59:04 +02:00
|
|
|
$this->setData(['core', 'dataVersion', 1800]);
|
2024-04-04 11:27:48 +02:00
|
|
|
|
2024-04-03 16:59:04 +02:00
|
|
|
}
|
2024-04-04 11:27:48 +02:00
|
|
|
|
2024-04-03 18:22:05 +02:00
|
|
|
/*
|
|
|
|
$t = $this->getEnrolment('6571b5913e87e', ['pablorodriguez', 'history', 'les-titres-ou-headers']);
|
|
|
|
echo"<pre>";
|
2024-04-03 16:59:04 +02:00
|
|
|
var_dump($t);
|
2024-04-03 18:22:05 +02:00
|
|
|
die();
|
|
|
|
*/
|