Release Template files
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
include_once '../objects/stats_user_in_session_row.php';
|
||||
|
||||
class UserGlobalStats
|
||||
{
|
||||
public int $nbSessions = 0;
|
||||
public float $totalDuration = 0.0;
|
||||
|
||||
public string $firstSession = "";
|
||||
public string $lastSession = "";
|
||||
|
||||
public UserStatsInSessionRow $totals;
|
||||
|
||||
public $sessionDebriefRows = array();
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
public function __construct ()
|
||||
{
|
||||
$this->totals = new UserStatsInSessionRow();
|
||||
$this->sessionDebriefRows = array();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
public function setSessionTotals (array $row)
|
||||
{
|
||||
$this->nbSessions = (int)$row['NbSessions'];
|
||||
$this->totalDuration = (float)$row['TotalDuration'];
|
||||
$this->firstSession = $row['MinDate'];
|
||||
$this->lastSession = $row['MaxDate'];
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
public function toArray () : array
|
||||
{
|
||||
return array (
|
||||
"nbSessions" => (int)$this->nbSessions,
|
||||
"totalDuration" => (float)$this->totalDuration ?? 0.0,
|
||||
"firstSessionAsString" => $this->firstSession ?? "",
|
||||
"lastSessionAsString" => $this->lastSession ?? "",
|
||||
"totals" => $this->totals->toArray(),
|
||||
"sessionDebriefRows" => $this->sessionDebriefRows
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user