twigify platform usage

This commit is contained in:
Spine
2023-02-03 11:13:46 +01:00
parent cd47d7a4e3
commit c3a8fb47ef
3 changed files with 69 additions and 47 deletions
+5 -47
View File
@@ -4,51 +4,9 @@ if (!$Viewer->permitted('site_debug')) {
error(403);
}
View::show_header('OS and Browser Usage');
$stats = new Gazelle\Stats\Users;
?>
<div class="header">
<h2>OS Usage</h2>
</div>
<table width="100%">
<tr class="colhead">
<td>OS</td>
<td>Count</td>
</tr>
<?php
$DB->prepared_query("SELECT OperatingSystem, OperatingSystemVersion, COUNT(*) FROM users_sessions WHERE OperatingSystem IS NOT NULL GROUP BY OperatingSystem, OperatingSystemVersion ORDER BY COUNT(*) DESC");
while (list($OperatingSystem, $OperatingSystemVersion, $Count) = $DB->fetch_record(0, 'OperatingSystem', 1, 'OperatingSystemVersion')) {
?>
<tr>
<td><?=$OperatingSystem?> <?=$OperatingSystemVersion?></td>
<td><?=$Count?></td>
</tr>
<?php
}
?>
</table>
<div class="header">
<h2>Browser Usage</h2>
</div>
<table width="100%">
<tr class="colhead">
<td>Browser</td>
<td>Count</td>
</tr>
<?php
$DB->prepared_query("SELECT Browser, BrowserVersion, COUNT(*) FROM users_sessions WHERE Browser IS NOT NULL GROUP BY Browser, BrowserVersion ORDER BY COUNT(*) DESC");
while (list($Browser, $BrowserVersion, $Count) = $DB->fetch_record(0, 'Browser', 1, 'BrowserVersion')) {
?>
<tr>
<td><?=$Browser?> <?=$BrowserVersion?></td>
<td><?=$Count?></td>
</tr>
<?php
}
?>
</table>
<?php
View::show_footer();
echo $Twig->render('admin/platform-usage.twig', [
'os_list' => $stats->operatingSystemList(),
'browser_list' => $stats->browserList(),
]);