diff options
Diffstat (limited to 'plugins/VisitTime/VisitTime.php')
-rw-r--r-- | plugins/VisitTime/VisitTime.php | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php index 510a7f7ffd..d565a3fb91 100644 --- a/plugins/VisitTime/VisitTime.php +++ b/plugins/VisitTime/VisitTime.php @@ -19,10 +19,11 @@ class Piwik_VisitTime extends Piwik_Plugin public function getInformation() { $info = array( - 'description' => Piwik_Translate('VisitTime_PluginDescription'), + 'name' => 'Visits Time', + 'description' => 'Reports the Local and Server time. Server time information can be useful to schedule a maintenance on the Website.', 'author' => 'Piwik', - 'author_homepage' => 'http://piwik.org/', - 'version' => Piwik_Version::VERSION, + 'homepage' => 'http://piwik.org/', + 'version' => '0.1', ); return $info; } @@ -34,7 +35,6 @@ class Piwik_VisitTime extends Piwik_Plugin 'ArchiveProcessing_Period.compute' => 'archivePeriod', 'WidgetsList.add' => 'addWidgets', 'Menu.add' => 'addMenu', - 'Goals.getAvailableGoalSegments' => 'addGoalSegments', ); return $hooks; } @@ -47,20 +47,9 @@ class Piwik_VisitTime extends Piwik_Plugin function addMenu() { - Piwik_AddMenu('General_Visitors', 'VisitTime_SubmenuTimes', array('module' => 'VisitTime', 'action' => 'index')); + Piwik_AddMenu('General_Visitors', 'VisitTime_SubmenuTimes', array('module' => 'VisitTime')); } - function addGoalSegments( $notification ) - { - $segments =& $notification->getNotificationObject(); - $segments[] = array( - 'group' => Piwik_Translate('VisitTime_ColumnServerTime'), - 'name' => Piwik_Translate('VisitTime_ColumnServerTime'), - 'module' => 'VisitTime', - 'action' => 'getVisitInformationPerServerTime', - ); - } - function archivePeriod( $notification ) { $archiveProcessing = $notification->getNotificationObject(); @@ -84,37 +73,16 @@ class Piwik_VisitTime extends Piwik_Plugin $labelSQL = "HOUR(visitor_localtime)"; $this->interestByLocalTime = $archiveProcessing->getArrayInterestForLabel($labelSQL); - $labelSQL = "HOUR(visit_last_action_time)"; + $labelSQL = "HOUR(visit_first_action_time)"; $this->interestByServerTime = $archiveProcessing->getArrayInterestForLabel($labelSQL); - $this->interestByServerTime = $this->convertServerTimeToLocalTimezone($this->interestByServerTime, $archiveProcessing); - } - - protected function convertServerTimeToLocalTimezone($interestByServerTime, $archiveProcessing) - { - $date = Piwik_Date::factory($archiveProcessing->getStartDatetimeUTC())->toString(); - $timezone = $archiveProcessing->site->getTimezone(); - $visitsByHourTz = array(); - foreach($interestByServerTime as $hour => $stats) - { - $datetime = $date . ' '.$hour.':00:00'; - $hourInTz = (int)Piwik_Date::factory($datetime, $timezone)->toString('H'); - $visitsByHourTz[$hourInTz] = $stats; - } - return $visitsByHourTz; } protected function archiveDayAggregateGoals($archiveProcessing) { $query = $archiveProcessing->queryConversionsBySingleSegment("HOUR(server_time)"); - $goalByServerTime = array(); while($row = $query->fetch()) { - $goalByServerTime[$row['label']][$row['idgoal']] = $archiveProcessing->getGoalRowFromQueryRow($row); - } - $goalByServerTime = $this->convertServerTimeToLocalTimezone($goalByServerTime, $archiveProcessing); - foreach($goalByServerTime as $hour => $goals) - { - $this->interestByServerTime[$hour][Piwik_Archive::INDEX_GOALS] = $goals; + $this->interestByServerTime[$row['label']][Piwik_Archive::INDEX_GOALS][$row['idgoal']] = $archiveProcessing->getGoalRowFromQueryRow($row); } $archiveProcessing->enrichConversionsByLabelArray($this->interestByServerTime); } |