/**
     * Add tab for general statistics
     */
    protected function addTabForGeneralStatistics()
    {
        $User = $this->FrontendSharedList->getUser();
        $Stats = DB::getInstance()->query('
			SELECT
				SUM(1) as num,
				SUM(distance) as dist_sum,
				SUM(s) as time_sum
			FROM `' . PREFIX . 'training`
			WHERE `accountid`="' . $User['id'] . '"
			GROUP BY `accountid`
			LIMIT 1
		')->fetch();
        $Content = '
			<table class="fullwidth">
				<tbody>
					<tr>
						<td class="b">' . __('Total distance:') . '</td>
						<td>' . Distance::format($Stats['dist_sum']) . '</td>
						<td class="b">' . __('Number of activities:') . '</td>
						<td>' . $Stats['num'] . 'x</td>
						<td class="b">' . __('Registered since:') . '</td>
						<td>' . date('d.m.Y', $User['registerdate']) . '</td>
					</tr>
					<tr>
						<td class="b">' . __('Total duration:') . '</td>
						<td>' . Duration::format($Stats['time_sum']) . '</td>
						<td class="b">' . __('First activity:') . '</td>
						<td>' . date('d.m.Y', START_TIME) . '</td>
						<td class="b">' . __('Last login:'******'</td>
						<td>' . date('d.m.Y', $User['lastaction']) . '</td>
					</tr>
				</tbody>
			</table>';
        $this->StatisticTabs->addTab(__('General statistics'), 'statistics-general', $Content);
    }
Esempio n. 2
0
 */
if (isset($_GET['view'])) {
    if ($_GET['view'] == 'monthkm') {
        $_GET['type'] = 'month';
        include 'window.plotSumData.shared.php';
        exit;
    } elseif ($_GET['view'] == 'weekkm') {
        $_GET['type'] = 'week';
        include 'window.plotSumData.shared.php';
        exit;
    }
}
require '../inc/class.Frontend.php';
require '../inc/class.FrontendShared.php';
require '../inc/class.FrontendSharedList.php';
$Frontend = new FrontendSharedList();
if (!Request::isAjax()) {
    if ($Frontend->userAllowsStatistics()) {
        echo '<div class="panel" style="width:960px;margin:5px auto;">';
        $Frontend->displayGeneralStatistics();
        echo '</div>';
    }
    echo '<div id="data-browser" class="panel" style="width:960px;margin:5px auto;">';
    echo '<div id="' . DATA_BROWSER_SHARED_ID . '">';
}
$Frontend->displaySharedView();
if (!Request::isAjax()) {
    echo '</div>';
    echo '</div>';
    echo '<div id="statistics-inner" class="panel" style="width:960px;margin:5px auto;">
	<div class="panel-content">