Statistiques
This commit is contained in:
parent
bce93cecba
commit
867d8ac713
@ -72,6 +72,8 @@ class course extends common
|
|||||||
|
|
||||||
public static $userHistory = [];
|
public static $userHistory = [];
|
||||||
|
|
||||||
|
public static $userStat = [];
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -978,6 +980,9 @@ class course extends common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$floorTime = 99999999999;
|
||||||
|
$topTime = 0;
|
||||||
|
|
||||||
foreach ($history as $pageId => $times) {
|
foreach ($history as $pageId => $times) {
|
||||||
// Dates de consultation de la page
|
// Dates de consultation de la page
|
||||||
if (is_array($times)) {
|
if (is_array($times)) {
|
||||||
@ -986,18 +991,28 @@ class course extends common
|
|||||||
self::$userHistory[] = [
|
self::$userHistory[] = [
|
||||||
$pages[$pageId]['number'],
|
$pages[$pageId]['number'],
|
||||||
html_entity_decode($pages[$pageId]['title']),
|
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 {
|
} else {
|
||||||
self::$userHistory[] = [
|
self::$userHistory[] = [
|
||||||
$pages[$pageId]['number'],
|
$pages[$pageId]['number'],
|
||||||
html_entity_decode($pages[$pageId]['title']),
|
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
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
|
@ -15,9 +15,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($module::$userHistory): ?>
|
<?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="row textAlignCenter">
|
||||||
<div class="col8">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
@ -29,7 +29,7 @@ $(document).ready((function () {
|
|||||||
locale: 'fr',
|
locale: 'fr',
|
||||||
"columnDefs": [
|
"columnDefs": [
|
||||||
{
|
{
|
||||||
target: 5,
|
target: 6,
|
||||||
orderable: false,
|
orderable: false,
|
||||||
searchable: false
|
searchable: false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user