<?php include 'partials/header.php'; require_once 'code/lib/helpers/visits-setup.inc.php'; $browserGate = new BrowserTableGateway($dbAdapter); $visitGate = new VisitTableGateway($dbAdapter); $continentGate = new ContinentTableGateway($dbAdapter); $countryGate = new CountryTableGateway($dbAdapter); $brandGate = new DeviceBrandTableGateway($dbAdapter); $brandResult = $brandGate->findAllSorted(true); $browserResult = $browserGate->findAllSorted(true); $visitsByBrowser = $visitGate->getCountPercentageBy('browser_id'); $visitsByBrand = $visitGate->getCountPercentageBy('device_brand_id'); $continentResult = $continentGate->findAllSorted(true); $dbAdapter->closeConnection(); ?> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <div class="mui-row"> <div class="mui-col-md-6"> <div class="mui-panel left top"> <!-- Dashboard Panel 1: Percentage of Visits by Browser --> <?php echo "<table class='mui-table' id='testtable'><thead><tr><th>Browser</th><th>Percentage of Visits</th></tr></thead><tbody>"; foreach ($visitsByBrowser as $row) { $browser = $browserGate->findById($row['browser_id']); echo "<tr><td>" . $browser->name . "</td><td>" . $row['percentage'] . "%</td></tr>"; } echo "</tbody></table>"; ?>