$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>"; ?> </div> <div class="mui-panel left bottom"> <!-- Dashboard Panel 2: Number of Visits by Device Brand --> <?php echo "<h3>Number of visits:<span id='showVisits'></span></h3>"; echo "<div class='mui-select' ><select id='brandList'><option value=''>Select a Brand:</option>"; foreach ($visitsByBrand as $row) { $brand = $brandGate->findById($row['device_brand_id']);
?> <html> <body> <h1> Table Gateways Tester </h1> <?php echo '<hr/>'; echo '<h2>Test BrowserTableGateway</h2>'; echo '<h3>Test findAll()</h3>'; $gate = new BrowserTableGateway($dbAdapter); $result = $gate->findAll(); foreach ($result as $row) { echo $row->id . " - " . $row->name . "<br/>"; } echo '<h3>Test findById(3)</h3>'; $result = $gate->findById(3); echo $result->id . " - " . $result->name; echo '<hr/>'; echo '<h2>Test DeviceBrandTableGateway</h2>'; echo '<h3>Test findAllSorted()</h3>'; $gate = new DeviceBrandTableGateway($dbAdapter); $result = $gate->findAllSorted(true); foreach ($result as $row) { echo $row->id . " - " . $row->name . "<br/>"; } echo '<h3>Test findById(11)</h3>'; $result = $gate->findById(11); echo $result->id . " - " . $result->name; // all done close connection $dbAdapter->closeConnection();