blob: 1b44e4ad698e39fad2d8d0993e3833937cab03d2 (
plain)
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
|
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\Live\Reports;
use Piwik\Config;
use Piwik\MetricsFormatter;
use Piwik\Piwik;
use Piwik\Plugin\Report;
use Piwik\Plugins\Live\Controller;
use Piwik\Plugins\Live\VisitorLog;
use Piwik\API\Request;
use Piwik\View;
class GetSimpleLastVisitCount extends Base
{
protected function init()
{
parent::init();
$this->widgetTitle = 'Live_RealTimeVisitorCount';
$this->order = 3;
}
public function render()
{
$lastMinutes = Config::getInstance()->General[Controller::SIMPLE_VISIT_COUNT_WIDGET_LAST_MINUTES_CONFIG_KEY];
$lastNData = Request::processRequest('Live.getCounters', array('lastMinutes' => $lastMinutes));
$view = new View('@Live/getSimpleLastVisitCount');
$view->lastMinutes = $lastMinutes;
$view->visitors = MetricsFormatter::getPrettyNumber($lastNData[0]['visitors']);
$view->visits = MetricsFormatter::getPrettyNumber($lastNData[0]['visits']);
$view->actions = MetricsFormatter::getPrettyNumber($lastNData[0]['actions']);
$view->refreshAfterXSecs = Config::getInstance()->General['live_widget_refresh_after_seconds'];
$view->translations = array(
'one_visitor' => Piwik::translate('Live_NbVisitor'),
'visitors' => Piwik::translate('Live_NbVisitors'),
'one_visit' => Piwik::translate('General_OneVisit'),
'visits' => Piwik::translate('General_NVisits'),
'one_action' => Piwik::translate('General_OneAction'),
'actions' => Piwik::translate('VisitsSummary_NbActionsDescription'),
'one_minute' => Piwik::translate('General_OneMinute'),
'minutes' => Piwik::translate('General_NMinutes')
);
return $view->render();
}
}
|