1.8.01
Corrige : - tableau de stats vides affichant une erreur - correction relative au rapport d'un participant Nouvelle fonctionnalité : - Bouton de réinitialisation d'un espace, efface les historiques et les inscriptions, les désinscriptions des participants et par autorité ne suppriment plus les historiques.
This commit is contained in:
parent
37f77b3d50
commit
8c9bc40a02
@ -51,7 +51,7 @@ class common
|
||||
const ACCESS_TIMER = 1800;
|
||||
|
||||
// Numéro de version
|
||||
const ZWII_VERSION = '1.8.00';
|
||||
const ZWII_VERSION = '1.8.01';
|
||||
|
||||
// URL autoupdate
|
||||
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/';
|
||||
|
@ -32,6 +32,7 @@ class course extends common
|
||||
'userReportExport' => self::GROUP_EDITOR, //Fait
|
||||
'backup' => self::GROUP_EDITOR, // Fait
|
||||
'restore' => self::GROUP_EDITOR, //Fait
|
||||
'reset' => self::GROUP_EDITOR,
|
||||
'clone' => self::GROUP_ADMIN,
|
||||
'add' => self::GROUP_ADMIN,
|
||||
'delete' => self::GROUP_ADMIN,
|
||||
@ -690,13 +691,13 @@ class course extends common
|
||||
self::$courseUsers[] = [
|
||||
//$userId,
|
||||
$this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']),
|
||||
isset($pages[$userValue['lastPageView']]['title'])
|
||||
array_key_exists('lastPageView', $userValue) && isset($pages[$userValue['lastPageView']]['title'])
|
||||
? $pages[$userValue['lastPageView']]['title']
|
||||
: '',
|
||||
$userValue['datePageView']
|
||||
array_key_exists('lastPageView', $userValue)
|
||||
? helper::dateUTF8('%d/%m/%Y', $userValue['datePageView'])
|
||||
: '',
|
||||
$userValue['datePageView']
|
||||
array_key_exists('datePageView', $userValue)
|
||||
? helper::dateUTF8('%H:%M', $userValue['datePageView'])
|
||||
: '',
|
||||
$this->getData(['user', $userId, 'tags']),
|
||||
@ -903,6 +904,7 @@ class course extends common
|
||||
|
||||
/**
|
||||
* Désinscription de tous les utilisateurs
|
||||
* Les désinscriptions ne suppriment pas les historiques
|
||||
*/
|
||||
public function usersDelete()
|
||||
{
|
||||
@ -1038,6 +1040,47 @@ class course extends common
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Désincription de tous les utilisateurs hors les éditeurs
|
||||
* Effacement des historiques
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
|
||||
// Contenu sélectionné
|
||||
$courseId = $this->getUrl(2);
|
||||
|
||||
// Accès limité aux admins, à l'auteur ou éditeurs inscrits
|
||||
if (
|
||||
$this->permissionControl(__FUNCTION__, $courseId) === false
|
||||
) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'access' => false
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
// Active l'accueil
|
||||
$_SESSION['ZWII_SITE_CONTENT'] = 'home';
|
||||
|
||||
// Efface les inscriptions
|
||||
$success = $this->setData(['enrolment', $courseId, []]);
|
||||
|
||||
// Efface les rapports
|
||||
if (file_exists(self::DATA_DIR . $courseId . '/report.csv')) {
|
||||
unlink(self::DATA_DIR . $courseId . '/report.csv');
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'course',
|
||||
'notification' => helper::translate('Espace réinitialisé'),
|
||||
'state' => true
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Traitement du changement de langue
|
||||
*/
|
||||
@ -1377,7 +1420,7 @@ class course extends common
|
||||
}
|
||||
|
||||
// Traitement de l'historique
|
||||
$h = $this->getReport($courseId, $userId);
|
||||
$h = $this->getReport($courseId);
|
||||
$h = $h[$userId];
|
||||
|
||||
// Inversion des clés et des valeurs
|
||||
@ -1541,6 +1584,7 @@ class course extends common
|
||||
|
||||
/**
|
||||
* Désinscription d'un participant
|
||||
* La désinscription ne supprime pas les historiques,
|
||||
*/
|
||||
public function unsuscribe()
|
||||
{
|
||||
@ -1890,34 +1934,38 @@ class course extends common
|
||||
*/
|
||||
private function getReport($courseId, $userId = null)
|
||||
{
|
||||
// Remplacez 'chemin/vers/votre/fichier.csv' par le chemin réel de votre fichier CSV
|
||||
$file = fopen(self::DATA_DIR . $courseId . '/report.csv', "r");
|
||||
|
||||
$data = array();
|
||||
$data = [];
|
||||
if (file_exists(self::DATA_DIR . $courseId . '/report.csv')) {
|
||||
// Remplacez 'chemin/vers/votre/fichier.csv' par le chemin réel de votre fichier CSV
|
||||
$file = fopen(self::DATA_DIR . $courseId . '/report.csv', "r");
|
||||
|
||||
// Lire ligne par ligne
|
||||
while (($line = fgetcsv($file, 1000, ";")) !== false) {
|
||||
$name = $line[0];
|
||||
$pageId = $line[1];
|
||||
$timestamp = $line[2];
|
||||
// Filtre userId
|
||||
// if (!is_null($userId) && $name === $userId) {
|
||||
$data = array();
|
||||
|
||||
// Lire ligne par ligne
|
||||
while (($line = fgetcsv($file, 1000, ";")) !== false) {
|
||||
$name = $line[0];
|
||||
$pageId = $line[1];
|
||||
$timestamp = $line[2];
|
||||
// Filtre userId
|
||||
// if (!is_null($userId) && $name === $userId) {
|
||||
// Initialiser le tableau si nécessaire
|
||||
if (!isset($data[$name][$pageId])) {
|
||||
$data[$name][$pageId] = array();
|
||||
}
|
||||
// Ajouter le timestamp
|
||||
$data[$name][$pageId][] = $timestamp;
|
||||
// }
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
// Fermer le fichier
|
||||
fclose($file);
|
||||
// Fermer le fichier
|
||||
fclose($file);
|
||||
|
||||
// Trier les timestamps
|
||||
foreach ($data as &$userData) {
|
||||
foreach ($userData as &$pageData) {
|
||||
sort($pageData);
|
||||
// Trier les timestamps
|
||||
foreach ($data as &$userData) {
|
||||
foreach ($userData as &$pageData) {
|
||||
sort($pageData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,4 +20,15 @@ $(".courseDelete").on("click", function () {
|
||||
return core.confirm(message, function () {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".courseReset").on("click", function () {
|
||||
var _this = $(this);
|
||||
var message = "<?php echo helper::translate('Réinitialiser cet espace ?'); ?>";
|
||||
return core.confirm(message, function () {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
@ -18,6 +18,16 @@
|
||||
]); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getUser('permission', 'course', 'reset') === true): ?>
|
||||
<div class="col2 ">
|
||||
<?php echo template::button('courseManageReset' . $this->getUrl(2), [
|
||||
'class' => 'courseReset buttonRed',
|
||||
'href' => helper::baseUrl() . 'course/reset/' . $this->getUrl(2),
|
||||
'value' => 'Réinitaliser',
|
||||
'ico' => 'cancel'
|
||||
]); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getUser('permission', 'course', 'backup') === true): ?>
|
||||
<div class="col2">
|
||||
<?php echo template::button('courseManageDownload' . $this->getUrl(2), [
|
||||
|
@ -252,7 +252,8 @@ class init extends common
|
||||
'usersDelete' => false,
|
||||
'edit' => false,
|
||||
'backup' => false,
|
||||
'restore' => false
|
||||
'restore' => false,
|
||||
'reset' => false,
|
||||
],
|
||||
'folder' => [
|
||||
'create' => false,
|
||||
@ -348,7 +349,8 @@ class init extends common
|
||||
'usersDelete' => false,
|
||||
'edit' => false,
|
||||
'backup' => false,
|
||||
'restore' => false
|
||||
'restore' => false,
|
||||
'reset' => false,
|
||||
],
|
||||
'folder' => [
|
||||
'create' => false,
|
||||
@ -449,7 +451,8 @@ class init extends common
|
||||
'usersDelete' => false,
|
||||
'edit' => false,
|
||||
'backup' => false,
|
||||
'restore' => false
|
||||
'restore' => false,
|
||||
'reset' => false,
|
||||
],
|
||||
'folder' => [
|
||||
'create' => false,
|
||||
@ -546,7 +549,8 @@ class init extends common
|
||||
'usersDelete' => true,
|
||||
'edit' => true,
|
||||
'backup' => true,
|
||||
'restore' => true
|
||||
'restore' => true,
|
||||
'reset' => true,
|
||||
],
|
||||
'folder' => [
|
||||
'create' => true,
|
||||
|
@ -724,6 +724,7 @@ class user extends common
|
||||
'edit' => $this->getInput('profilEditCourseEdit', helper::FILTER_BOOLEAN),
|
||||
'backup' => $this->getInput('profilEditCourseBackup', helper::FILTER_BOOLEAN),
|
||||
'restore' => $this->getInput('profilEditCourseRestore', helper::FILTER_BOOLEAN),
|
||||
'reset' => $this->getInput('profilEditCourseReset', helper::FILTER_BOOLEAN),
|
||||
]
|
||||
];
|
||||
|
||||
@ -905,7 +906,8 @@ class user extends common
|
||||
|| $this->getInput('profilAddCourseUsersDelete', helper::FILTER_BOOLEAN)
|
||||
|| $this->getInput('profilAddCourseEdit', helper::FILTER_BOOLEAN)
|
||||
|| $this->getInput('profilAddCourseBackup', helper::FILTER_BOOLEAN)
|
||||
|| $this->getInput('profilAddCourseRestore', helper::FILTER_BOOLEAN),
|
||||
|| $this->getInput('profilAddCourseRestore', helper::FILTER_BOOLEAN)
|
||||
|| $this->getInput('profilAddCourseReset', helper::FILTER_BOOLEAN),
|
||||
// La suite
|
||||
'users' => $this->getInput('profilAddCourseUsers', helper::FILTER_BOOLEAN),
|
||||
'userHistory' => $this->getInput('profilAddCourseUserHistory', helper::FILTER_BOOLEAN),
|
||||
@ -917,6 +919,7 @@ class user extends common
|
||||
'edit' => $this->getInput('profilAddCourseEdit', helper::FILTER_BOOLEAN),
|
||||
'backup' => $this->getInput('profilAddCourseBackup', helper::FILTER_BOOLEAN),
|
||||
'restore' => $this->getInput('profilAddCourseRestore', helper::FILTER_BOOLEAN),
|
||||
'reset' => $this->getInput('profilAddCourseReset', helper::FILTER_BOOLEAN),
|
||||
]
|
||||
];
|
||||
|
||||
|
@ -205,6 +205,11 @@
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('profilAddCourseUsersDelete', true, 'Désinscrire en masse'); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('profilAddCourseReset', true, 'Réinitialiser un espace', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'reset']),
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -307,6 +307,11 @@
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'usersDelete']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('profilEditCourseReset', true, 'Réinitialiser un espace', [
|
||||
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'course', 'reset']),
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user