screens.php 2.04 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
60
61
62
<?php
/*********************************
	WP-Piwik::Stats:Screens
**********************************/

	$aryConf['data'] = $this->call_API(
			'UserSettings.getResolution', 
			$aryConf['params']['period'], 
			$aryConf['params']['date'],
			$aryConf['params']['limit']
	);
	$aryConf['title'] = __('Resolution', 'wp-piwik');
	include('header.php');
	$strValues = '';
	$intCount = 0; $intMore = 0; $intSum = 0;
	foreach ($aryConf['data'] as $key => $aryValues) {
		$intCount++;
		if ($intCount <= 9) $strValues .= '["'.$aryValues['label'].'",'.$aryValues['nb_uniq_visitors'].'],';
		else $intMore += $aryValues['nb_uniq_visitors'];
		$intSum += $aryValues['nb_uniq_visitors'];
	}
	if ($intMore) $strValues .= '["'.__('Others', 'wp-piwik').'",'.$intMore.'],';
	$strValues = substr($strValues, 0, -1);
/***************************************************************************/ ?>
<div class="wp-piwik-graph-wide">
	<div id="wp-piwik_stats_screens_graph" style="height:310px;width:490px"></div>
</div>
<div class="table">
	<table class="widefat wp-piwik-table">
		<thead>
			<tr>
				<th><?php _e('Resolution', 'wp-piwik'); ?></th>
				<th class="n"><?php _e('Unique', 'wp-piwik'); ?></th>
				<th class="n"><?php _e('Percent', 'wp-piwik'); ?></th>
			</tr>
		</thead>
		<tbody>
<?php /************************************************************************/
	foreach ($aryConf['data'] as $aryValues)
		echo '<tr><td>'.
				$aryValues['label'].
			'</td><td class="n">'.
				$aryValues['nb_uniq_visitors'].
			'</td><td class="n">'.
				number_format($aryValues['nb_uniq_visitors']/$intSum*100, 2).
			'%</td></tr>';
	unset($aryTmp);
/***************************************************************************/ ?>
		</tbody>
	</table>
</div>
<script type="text/javascript">
$j.jqplot('wp-piwik_stats_screens_graph', [[<?php echo $strValues; ?>]], {
    seriesDefaults:{renderer:$j.jqplot.PieRenderer, rendererOptions:{sliceMargin:8}},
    legend:{show:true}

});
</script>
<?php /************************************************************************/
	include ('footer.php');

/* EOF */