forked from ZwiiCMS-Team/ZwiiCampus
1.8.00 initialise avec la création des bases dans les espaces WIP
This commit is contained in:
parent
e8e4f98be0
commit
5dc51a62ce
@ -51,7 +51,7 @@ class common
|
|||||||
const ACCESS_TIMER = 1800;
|
const ACCESS_TIMER = 1800;
|
||||||
|
|
||||||
// Numéro de version
|
// Numéro de version
|
||||||
const ZWII_VERSION = '1.7.09';
|
const ZWII_VERSION = '1.8.00';
|
||||||
|
|
||||||
// URL autoupdate
|
// URL autoupdate
|
||||||
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/';
|
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/';
|
||||||
@ -224,7 +224,6 @@ class common
|
|||||||
'user' => '',
|
'user' => '',
|
||||||
'language' => '',
|
'language' => '',
|
||||||
'profil' => '',
|
'profil' => '',
|
||||||
'enrolment' => '',
|
|
||||||
'category' => '',
|
'category' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -232,6 +231,7 @@ class common
|
|||||||
'page' => '',
|
'page' => '',
|
||||||
'module' => '',
|
'module' => '',
|
||||||
'theme' => '',
|
'theme' => '',
|
||||||
|
'enrolment' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $fontsWebSafe = [
|
public static $fontsWebSafe = [
|
||||||
@ -598,6 +598,10 @@ class common
|
|||||||
return file_put_contents(self::DATA_DIR . $path . '/content/' . $page . '.html', $value);
|
return file_put_contents(self::DATA_DIR . $path . '/content/' . $page . '.html', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getEnrolment($courseId, $keys =[]) {
|
||||||
|
$data = json_decode(file_get_contents(self::DATA_DIR . $courseId .'.json'), true);
|
||||||
|
return $data[$keys[0]];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,7 +10,7 @@ if (
|
|||||||
) {
|
) {
|
||||||
// Supprime la variable path des profils, seul l'accès à l'espace et autorisé.
|
// Supprime la variable path des profils, seul l'accès à l'espace et autorisé.
|
||||||
foreach (['1', '2'] as $group) {
|
foreach (['1', '2'] as $group) {
|
||||||
foreach ( array_keys($this->getData(['profil', $group])) as $profil) {
|
foreach (array_keys($this->getData(['profil', $group])) as $profil) {
|
||||||
if (is_null($this->getData(['profil', $group, $profil, 'folder', 'path'])) === false) {
|
if (is_null($this->getData(['profil', $group, $profil, 'folder', 'path'])) === false) {
|
||||||
$path = $this->getData(['profil', $group, $profil, 'folder', 'path']);
|
$path = $this->getData(['profil', $group, $profil, 'folder', 'path']);
|
||||||
$this->setData(['profil', $group, $profil, 'folder', 'homePath', $path]);
|
$this->setData(['profil', $group, $profil, 'folder', 'homePath', $path]);
|
||||||
@ -21,3 +21,28 @@ if (
|
|||||||
}
|
}
|
||||||
$this->setData(['core', 'dataVersion', 1700]);
|
$this->setData(['core', 'dataVersion', 1700]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Déplacement des
|
||||||
|
if (
|
||||||
|
$this->getData(['core', 'dataVersion']) < 1800
|
||||||
|
) {
|
||||||
|
|
||||||
|
// Déplace les incriptions dans les cours
|
||||||
|
if (file_exists(self::DATA_DIR . 'enrolment.json')) {
|
||||||
|
$old_enrolment = json_decode(file_get_contents(self::DATA_DIR . 'enrolment.json'), true);
|
||||||
|
$old_enrolment = $old_enrolment['enrolment'];
|
||||||
|
foreach ($this->getData(['course']) as $courseId => $courseValues) {
|
||||||
|
if (array_key_exists($courseId, $old_enrolment)) {
|
||||||
|
file_put_contents(self::DATA_DIR . $courseId . '/enrolment.json', json_encode(['enrolment' => [$courseId => $old_enrolment[$courseId]]], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), LOCK_EX);
|
||||||
|
} else {
|
||||||
|
// Création d'une structure vide
|
||||||
|
file_put_contents(self::DATA_DIR . $courseId . '/enrolment.json', json_encode(['enrolment' => [$courseId => []]], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), LOCK_EX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unlink(self::DATA_DIR . 'enrolment.json');
|
||||||
|
$this->setData(['core', 'dataVersion', 1800]);
|
||||||
|
}
|
||||||
|
$t = $this->getEnrolment(['65d749713a217']);
|
||||||
|
var_dump($t);
|
||||||
|
dei();
|
Loading…
Reference in New Issue
Block a user