forked from ZwiiCMS-Team/ZwiiCampus
Statistiques nombre de pages vues okay
This commit is contained in:
parent
1cac48fd10
commit
d5d001d2b4
@ -393,7 +393,7 @@ class common
|
||||
setcookie('ZWII_UI', self::$i18nUI, time() + 3600, helper::baseUrl(false, false), '', false, false);
|
||||
setcookie('ZWII_SITE_CONTENT', self::$siteContent, time() + 3600, helper::baseUrl(false, false), '', false, false);
|
||||
setlocale(LC_ALL, self::$i18nUI);
|
||||
|
||||
|
||||
// Construit la liste des pages parents/enfants
|
||||
if ($this->hierarchy['all'] === []) {
|
||||
$this->buildHierarchy();
|
||||
@ -622,6 +622,7 @@ class common
|
||||
'dir' => self::DATA_DIR . $path . '/',
|
||||
'backup' => file_exists('site/data/.backup')
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -704,7 +705,6 @@ class common
|
||||
|
||||
/**
|
||||
* Fonction pour construire le tableau des pages
|
||||
* Appelée par le core uniquement
|
||||
*/
|
||||
|
||||
private function buildHierarchy()
|
||||
@ -1395,7 +1395,7 @@ class common
|
||||
public function saveLog($message = '')
|
||||
{
|
||||
// Journalisation
|
||||
$dataLog = helper::dateUTF8('%Y %m %d', time(), self::$i18nUI) . ' - ' . helper::dateUTF8('%H:%M', time(), self::$i18nUI);
|
||||
$dataLog = helper::dateUTF8('%Y %m %d', time(), self::$i18nUI) . ' - ' . helper::dateUTF8('%H:%M', time(), self::$i18nUI);
|
||||
$dataLog .= helper::getIp($this->getData(['config', 'connect', 'anonymousIp'])) . ';';
|
||||
$dataLog .= empty($this->getUser('id')) ? 'visitor;' : $this->getUser('id') . ';';
|
||||
$dataLog .= $message ? $this->getUrl() . ';' . $message : $this->getUrl();
|
||||
|
@ -419,8 +419,9 @@ class course extends common
|
||||
// Statistiques du cours sélectionné calcul du nombre de pages
|
||||
$sumPages = 0;
|
||||
$data = json_decode(file_get_contents(self::DATA_DIR . $courseId . '/page.json'), true);
|
||||
// Exclure les barres et les pages masquées
|
||||
foreach ($data['page'] as $pageId => $pageData) {
|
||||
if ($pageData['block'] !== 'bar') {
|
||||
if ($pageData['position'] > 0) {
|
||||
$sumPages++;
|
||||
}
|
||||
}
|
||||
@ -471,7 +472,8 @@ class course extends common
|
||||
|
||||
// Construction du tableau
|
||||
self::$courseUsers[] = [
|
||||
$userId,
|
||||
//$userId,
|
||||
$viewPages . '=' . $sumPages,
|
||||
$this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']),
|
||||
$pageId,
|
||||
helper::dateUTF8('%d %B %Y - %H:%M', $maxTime),
|
||||
@ -673,10 +675,12 @@ class course extends common
|
||||
$userId = $this->getUrl(3);
|
||||
$history = $this->getData(['enrolment', $courseId, $userId]);
|
||||
$pages = json_decode(file_get_contents(self::DATA_DIR . $courseId . '/page.json'), true);
|
||||
$pages = $pages ['page'];
|
||||
|
||||
foreach ($history['history'] as $pageId => $time) {
|
||||
self::$userHistory[$pageId] = [
|
||||
helper::dateUTF8('%d %B %Y - %H:%M:%S', $time),
|
||||
$pages['page'][$pageId]['title'],
|
||||
$pages[$pageId]['title'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
<?php if ($module::$userHistory): ?>
|
||||
<div class="row textAlignCenter">
|
||||
<div class="col8">
|
||||
<?php echo template::table([6, 6], $module::$userHistory, ['Dernière consultation de cette page', 'Titre de la page'], ['id' => 'dataTables']); ?>
|
||||
<?php echo template::table([1, 6, 5], $module::$userHistory, ['Ordre', 'Titre de la page', 'Dernière consultation de cette page'], ['id' => 'dataTables']); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
|
Loading…
Reference in New Issue
Block a user