Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@gmail.com>2015-02-13 22:13:11 +0300
committerThomas Steur <thomas.steur@gmail.com>2015-02-13 22:13:11 +0300
commit10a528b3d6ff3dc3269f9d5d408caea1e52d3ed4 (patch)
treec4cacde4b4c245de853420c78124ac1a769ecef1 /plugins/VisitTime/API.php
parent806bedba1a43d7d78b687d1d23a6b861a2b70035 (diff)
refs #4633 rename segment filter to segment, fixed a bug re visitTime and extracted code into a filter
Diffstat (limited to 'plugins/VisitTime/API.php')
-rw-r--r--plugins/VisitTime/API.php22
1 files changed, 2 insertions, 20 deletions
diff --git a/plugins/VisitTime/API.php b/plugins/VisitTime/API.php
index c78534c193..928e8c95f3 100644
--- a/plugins/VisitTime/API.php
+++ b/plugins/VisitTime/API.php
@@ -52,30 +52,12 @@ class API extends \Piwik\Plugin\API
$table = $this->getDataTable(Archiver::SERVER_TIME_RECORD_NAME, $idSite, $period, $date, $segment);
$timezone = Site::getTimezoneFor($idSite);
-
- $range = Range::parseDateRange($date);
-
- if (!empty($range[2])) {
- $endDate = Date::factory($range[2]);
- } else if (!empty($range[1])) {
- $endDate = Date::factory($range[1]);
- } else {
- $endDate = Date::factory($date);
- }
-
- $table->filter('AddSegmentValue', array(function ($label) use ($timezone, $endDate) {
- $hour = str_pad($label, 2, 0, STR_PAD_LEFT);
- $time = $hour . ':00:00';
-
- $dateInTimezone = $endDate->setTime($time)->setTimezone($timezone);
- $hourInTz = $dateInTimezone->getHourInUTC();
-
- return $hourInTz;
- }));
+ $table->filter('Piwik\Plugins\VisitTime\DataTable\Filter\AddSegmentByLabelInUTC', array($timezone, $period, $date));
if ($hideFutureHoursWhenToday) {
$table = $this->removeHoursInFuture($table, $idSite, $period, $date);
}
+
return $table;
}