diff options
Diffstat (limited to 'plugins/Live')
-rw-r--r-- | plugins/Live/API.php | 5 | ||||
-rw-r--r-- | plugins/Live/Reports/GetSimpleLastVisitCount.php | 13 | ||||
-rw-r--r-- | plugins/Live/Visitor.php | 7 |
3 files changed, 15 insertions, 10 deletions
diff --git a/plugins/Live/API.php b/plugins/Live/API.php index 67f7d46cd4..935762c79d 100644 --- a/plugins/Live/API.php +++ b/plugins/Live/API.php @@ -15,7 +15,7 @@ use Piwik\DataTable; use Piwik\DataTable\Row; use Piwik\Date; use Piwik\Db; -use Piwik\MetricsFormatter; +use Piwik\Metrics\Formatter; use Piwik\Period\Range; use Piwik\Period; use Piwik\Piwik; @@ -346,7 +346,8 @@ class API extends \Piwik\Plugin\API round($pageGenerationTimeTotal / $result['totalPageViews'], $precision = 2); } - $result['totalVisitDurationPretty'] = MetricsFormatter::getPrettyTimeFromSeconds($result['totalVisitDuration']); + $formatter = new Formatter(); + $result['totalVisitDurationPretty'] = $formatter->getPrettyTimeFromSeconds($result['totalVisitDuration']); // use requested visits for first/last visit info $rows = $visits->getRows(); diff --git a/plugins/Live/Reports/GetSimpleLastVisitCount.php b/plugins/Live/Reports/GetSimpleLastVisitCount.php index 1b44e4ad69..34ba773fa9 100644 --- a/plugins/Live/Reports/GetSimpleLastVisitCount.php +++ b/plugins/Live/Reports/GetSimpleLastVisitCount.php @@ -9,7 +9,7 @@ namespace Piwik\Plugins\Live\Reports; use Piwik\Config; -use Piwik\MetricsFormatter; +use Piwik\Metrics\Formatter; use Piwik\Piwik; use Piwik\Plugin\Report; use Piwik\Plugins\Live\Controller; @@ -32,11 +32,13 @@ class GetSimpleLastVisitCount extends Base $lastNData = Request::processRequest('Live.getCounters', array('lastMinutes' => $lastMinutes)); + $formatter = new Formatter(); + $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->visitors = $formatter->getPrettyNumber($lastNData[0]['visitors']); + $view->visits = $formatter->getPrettyNumber($lastNData[0]['visits']); + $view->actions = $formatter->getPrettyNumber($lastNData[0]['actions']); $view->refreshAfterXSecs = Config::getInstance()->General['live_widget_refresh_after_seconds']; $view->translations = array( 'one_visitor' => Piwik::translate('Live_NbVisitor'), @@ -51,5 +53,4 @@ class GetSimpleLastVisitCount extends Base return $view->render(); } - -} +}
\ No newline at end of file diff --git a/plugins/Live/Visitor.php b/plugins/Live/Visitor.php index 27873ec2a1..c7c8a13e6d 100644 --- a/plugins/Live/Visitor.php +++ b/plugins/Live/Visitor.php @@ -13,6 +13,7 @@ use Piwik\DataAccess\LogAggregator; use Piwik\DataTable\Filter\ColumnDelete; use Piwik\Date; use Piwik\Db; +use Piwik\Metrics\Formatter; use Piwik\Network\IPUtils; use Piwik\Piwik; use Piwik\Plugins\CustomVariables\CustomVariables; @@ -282,6 +283,8 @@ class Visitor implements VisitorInterface "; $actionDetails = Db::fetchAll($sql, array($idVisit)); + $formatter = new Formatter(); + foreach ($actionDetails as $actionIdx => &$actionDetail) { $actionDetail =& $actionDetails[$actionIdx]; $customVariablesPage = array(); @@ -327,7 +330,7 @@ class Visitor implements VisitorInterface $actionDetail['eventValue'] = round($actionDetail['custom_float'], self::EVENT_VALUE_PRECISION); } } elseif ($actionDetail['custom_float'] > 0) { - $actionDetail['generationTime'] = \Piwik\MetricsFormatter::getPrettyTimeFromSeconds($actionDetail['custom_float'] / 1000); + $actionDetail['generationTime'] = $formatter->getPrettyTimeFromSeconds($actionDetail['custom_float'] / 1000); } unset($actionDetail['custom_float']); @@ -343,7 +346,7 @@ class Visitor implements VisitorInterface // Set the time spent for this action (which is the timeSpentRef of the next action) if (isset($actionDetails[$actionIdx + 1])) { $actionDetail['timeSpent'] = $actionDetails[$actionIdx + 1]['timeSpentRef']; - $actionDetail['timeSpentPretty'] = \Piwik\MetricsFormatter::getPrettyTimeFromSeconds($actionDetail['timeSpent']); + $actionDetail['timeSpentPretty'] = $formatter->getPrettyTimeFromSeconds($actionDetail['timeSpent']); } unset($actionDetails[$actionIdx]['timeSpentRef']); // not needed after timeSpent is added |