diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-06-13 03:52:49 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-06-16 12:11:03 +0400 |
commit | 6be9fb2002a0a7da79af55e3263f23c5addfa79c (patch) | |
tree | b867f08bc0bd2a042e9606146bedce18d85d8460 /plugins/VisitTime | |
parent | d8f110aca03ff8c73811a141631f12a7a1ddc16f (diff) |
Continuing the great cleanup. It looks like archiveProcessor will have to go (and merge with Archive)
Moving Transitions logic from plugin class to API
Cleaning up some separation of concerns
NOTE: I'm breaking the Multisites API here, removing the _evolution. we should re-fix it...
Diffstat (limited to 'plugins/VisitTime')
-rw-r--r-- | plugins/VisitTime/API.php | 21 | ||||
-rw-r--r-- | plugins/VisitTime/Controller.php | 2 |
2 files changed, 12 insertions, 11 deletions
diff --git a/plugins/VisitTime/API.php b/plugins/VisitTime/API.php index 65952ba24d..807b399869 100644 --- a/plugins/VisitTime/API.php +++ b/plugins/VisitTime/API.php @@ -64,24 +64,25 @@ class Piwik_VisitTime_API { Piwik::checkUserHasViewAccess($idSite); - // disabled for multiple sites/dates - if (Piwik_Archive::isMultipleSites($idSite)) { - throw new Exception("VisitTime.getByDayOfWeek does not support multiple sites."); - } - - if (Piwik_Archive::isMultiplePeriod($date, $period)) { - throw new Exception("VisitTime.getByDayOfWeek does not support multiple dates."); - } - // metrics to query $metrics = Piwik_Archive::getVisitsMetricNames(); unset($metrics[Piwik_Archive::INDEX_MAX_ACTIONS]); // get metric data for every day within the supplied period - $oPeriod = Piwik_Archive::makePeriodFromQueryParams(Piwik_Site::getTimezoneFor($idSite), $period, $date); + $oPeriod = Piwik_Period::makePeriodFromQueryParams(Piwik_Site::getTimezoneFor($idSite), $period, $date); $dateRange = $oPeriod->getDateStart()->toString() . ',' . $oPeriod->getDateEnd()->toString(); $archive = Piwik_Archive::build($idSite, 'day', $dateRange, $segment); + + // disabled for multiple sites/dates + if ( count( $archive->getParams()->getIdSites() ) > 1) { + throw new Exception("VisitTime.getByDayOfWeek does not support multiple sites."); + } + + if ( count ($archive->getParams()->getPeriods() ) > 1) { + throw new Exception("VisitTime.getByDayOfWeek does not support multiple dates."); + } + $dataTable = $archive->getDataTableFromNumeric($metrics); // if there's no data for this report, don't bother w/ anything else diff --git a/plugins/VisitTime/Controller.php b/plugins/VisitTime/Controller.php index 9c2fce1087..778f3a6f0e 100644 --- a/plugins/VisitTime/Controller.php +++ b/plugins/VisitTime/Controller.php @@ -73,7 +73,7 @@ class Piwik_VisitTime_Controller extends Piwik_Controller $period = Piwik_Common::getRequestVar('period'); // create a period instance - $oPeriod = Piwik_Archive::makePeriodFromQueryParams(Piwik_Site::getTimezoneFor($idSite), $period, $date); + $oPeriod = Piwik_Period::makePeriodFromQueryParams(Piwik_Site::getTimezoneFor($idSite), $period, $date); // set the footer message using the period start & end date $start = $oPeriod->getDateStart()->toString(); |