コード例 #1
0
function outputBrowser($dbAdapter)
{
    $gateVisits = new VisitTableGateway($dbAdapter);
    $result = $gateVisits->findNumberOfVisits();
    echo '<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp">
          <thead>
            <tr>
              <th class="mdl-data-table__cell--non-numeric">Browser</th>
              <th>Percentage of Visits</th>
            </tr>
          </thead>
          <tbody>';
    foreach ($result as $row) {
        echo '<tr>
              <td class="mdl-data-table__cell--non-numeric">' . $row->name . '</td>
              <td>' . $row->PercentVisits . '</td>
              </tr>';
    }
    echo '</tbody>
            </table>';
}
コード例 #2
0
<?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>";
?>
コード例 #3
0
function outputCountryVisitJanMaySept($dbAdapter)
{
    $gateVisits = new VisitTableGateway($dbAdapter);
    $result = $gateVisits->findCountryVisitsJanMaySept($_GET["countryISO"]);
    $countryInfoArray = [];
    foreach ($result as $row) {
        $countryInfo = new stdClass();
        $countryInfo->countryISO = $row->ISO;
        $countryInfo->countryName = $row->countryName;
        $countryInfo->visitsJan = $row->visitJan;
        $countryInfo->visitsMay = $row->visitMay;
        $countryInfo->visitsSept = $row->visitSept;
        array_push($countryInfoArray, $countryInfo);
    }
    echo json_encode($countryInfoArray);
}