overview.php 2.5 KB
Newer Older
root's avatar
root committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php 
/*********************************
	WP-Piwik::Stats:Overview
**********************************/

	$aryConf['data'] = $this->call_API(
		'VisitsSummary.get',
		$aryConf['params']['period'],
		$aryConf['params']['date'],
		$aryConf['params']['limit']
	);
	$aryConf['title'] = __('Overview', 'wp-piwik');
	if (!isset($aryConf['inline']) || $aryConf['inline'] != true)
		include('header.php');
	if ($aryConf['params']['date'] == 'last30') {
		$aryTmp = array(
			'bounce_count' => 0,
			'max_actions' => 0,
			'nb_actions' => 0,
			'nb_uniq_visitors' => 0,
			'nb_visits' => 0,
			'nb_visits_converted' => 0,
			'sum_visit_length' => 0
		);
		foreach ($aryConf['data'] as $aryDay) 
			foreach ($aryDay as $strKey => $strValue)
				if ($strKey != 'max_actions')
					$aryTmp[$strKey] += $strValue;
				elseif ($aryTmp['max_actions'] < $strValue)
					$aryTmp['max_actions'] = $strValue;
		$aryConf['data'] = $aryTmp;
	}
/***************************************************************************/ ?>
<div class="table">
	<table class="widefat">
		<tbody>
<?php /************************************************************************/
	$strTime = 
		floor($aryConf['data']['sum_visit_length']/3600).'h '.
		floor(($aryConf['data']['sum_visit_length'] % 3600)/60).'m '.
		floor(($aryConf['data']['sum_visit_length'] % 3600) % 60).'s';
	echo '<tr><td>'.__('Visitors', 'wp-piwik').':</td><td>'.$aryConf['data']['nb_visits'].'</td></tr>';
	echo '<tr><td>'.__('Unique visitors', 'wp-piwik').':</td><td>'.$aryConf['data']['nb_uniq_visitors'].'</td></tr>';
	echo '<tr><td>'.__('Page views', 'wp-piwik').':</td><td>'.$aryConf['data']['nb_actions'].'</td></tr>';
	echo '<tr><td>'.__('Max. page views in one visit', 'wp-piwik').':</td><td>'.$aryConf['data']['max_actions'].'</td></tr>';
	echo '<tr><td>'.__('Total time spent by visitors', 'wp-piwik').':</td><td>'.$strTime.'</td></tr>';
	echo '<tr><td>'.__('Bounce count', 'wp-piwik').':</td><td>'.$aryConf['data']['bounce_count'].'</td></tr>';
	if (get_option('wp-piwik_piwiklink', 0)) 
		echo '<tr><td>'.__('Shortcut', 'wp-piwik').':</td><td><a href="'.get_option('wp-piwik_url').'">Piwik</a>'.(isset($aryConf['inline']) && $aryConf['inline']?' - <a href="?page=wp-piwik/wp-piwik.php">WP-Piwik</a>':'').'</td></tr>';

/***************************************************************************/ ?>
		</tbody>
	</table>
</div>
<?php /************************************************************************/
	if (!isset($aryConf['inline']) || isset($aryConf['inline']) != true)
		include ('footer.php');

/* EOF */