Statistiques

This commit is contained in:
Fred Tempez 2023-12-09 23:35:21 +01:00
parent bce93cecba
commit 867d8ac713
3 changed files with 35 additions and 5 deletions

View File

@ -72,6 +72,8 @@ class course extends common
public static $userHistory = [];
public static $userStat = [];
public function index()
{
@ -978,6 +980,9 @@ class course extends common
}
}
$floorTime = 99999999999;
$topTime = 0;
foreach ($history as $pageId => $times) {
// Dates de consultation de la page
if (is_array($times)) {
@ -986,18 +991,28 @@ class course extends common
self::$userHistory[] = [
$pages[$pageId]['number'],
html_entity_decode($pages[$pageId]['title']),
helper::dateUTF8('%d %B %Y %H:%M:%S', $time)
helper::dateUTF8('%d %B %Y %H:%M', $time)
];
$floorTime = $floorTime < $time ? $floorTime : $time;
$TopTime = $TopTime > $time ? $TopTime : $time;
}
} else {
self::$userHistory[] = [
$pages[$pageId]['number'],
html_entity_decode($pages[$pageId]['title']),
helper::dateUTF8('%d %B %Y %H:%M:%S', $times)
helper::dateUTF8('%d %B %Y %H:%M', $times)
];
$floorTime = $floorTime < $times ? $floorTime : $times;
$topTime = $topTime > $times ?$topTime : $times;
}
}
self::$userStat['floor'] = helper::dateUTF8('%d %B %Y %H:%M',$floorTime);
self::$userStat['top'] = helper::dateUTF8('%d %B %Y %H:%M',$topTime);
$d = $topTime - $floorTime;
$d_hours = floor($d / 3600);
$d_minutes = floor(($d % 3600) / 60);
self::$userStat['time'] = $d_hours . ' heures, ' . $d_minutes . ' minutes ' ;
// Valeurs en sortie
$this->addOutput([

View File

@ -15,9 +15,24 @@
</div>
</div>
<?php if ($module::$userHistory): ?>
<div class="row">
<div class="col4 offset2">
<?php if ($this->getData(['course', $this->getUrl(2), 'access']) === self::COURSE_ACCESS_DATE): ?>
<p>Espace ouvert le :
<?php echo helper::dateUTF8('%d %B %Y %H:%M', $this->getData(['course', $this->getUrl(2), 'openingDate'])); ?></p
<p>Espace fermé le :
<?php echo helper::dateUTF8('%d %B %Y %H:%M', $this->getData(['course', $this->getUrl(2), 'closingDate'])); ?></p>
<?php endif;?>
</div>
<div class="col4">
<p>Commencé le : <?php echo $module::$userStat['floor'];?></p>
<p>Terminé le : <?php echo $module::$userStat['top'];?></p>
<p>Temps passé : <?php echo $module::$userStat['time'];?></p>
</div>
</div>
<div class="row textAlignCenter">
<div class="col8">
<?php echo template::table([1, 6, 5], $module::$userHistory, ['Ordre', 'Page', 'Consultation'], ['id' => 'dataTables']); ?>
<?php echo template::table([1, 6, 5], $module::$userHistory, ['Ordre', 'Page', 'Consultation'], ['id' => 'dataTables']);?>
</div>
</div>
<?php else: ?>

View File

@ -29,7 +29,7 @@ $(document).ready((function () {
locale: 'fr',
"columnDefs": [
{
target: 5,
target: 6,
orderable: false,
searchable: false
}