diff options
author | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2008-09-05 03:24:26 +0400 |
---|---|---|
committer | matt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105> | 2008-09-05 03:24:26 +0400 |
commit | 2df5feb0cd4a17f3243dc710aa76320be5f852c5 (patch) | |
tree | e3dbb8c697624c393bfbcc19afcbc23283cb8261 /plugins/VisitTime | |
parent | 911dfd6ec31de47eb05e8a87b535d9bda260265c (diff) |
Refactoring Widget and Menu code (in core and all plugins)
Commit patch by Maciej adding support for multiple lines plotting
Cleaning Date object
+ small other code improvements
Diffstat (limited to 'plugins/VisitTime')
-rw-r--r-- | plugins/VisitTime/Controller.php | 12 | ||||
-rw-r--r-- | plugins/VisitTime/VisitTime.php | 23 |
2 files changed, 15 insertions, 20 deletions
diff --git a/plugins/VisitTime/Controller.php b/plugins/VisitTime/Controller.php index 28e7b5b4c2..5db88b6bdb 100644 --- a/plugins/VisitTime/Controller.php +++ b/plugins/VisitTime/Controller.php @@ -6,22 +6,15 @@ class Piwik_VisitTime_Controller extends Piwik_Controller function index() { $view = new Piwik_View('VisitTime/index.tpl'); - - /* VisitorTime */ $view->dataTableVisitInformationPerLocalTime = $this->getVisitInformationPerLocalTime(true); $view->dataTableVisitInformationPerServerTime = $this->getVisitInformationPerServerTime(true); - echo $view->render(); } - /** - * VisitTime - */ function getVisitInformationPerServerTime( $fetch = false) { $view = Piwik_ViewDataTable::factory( 'graphVerticalBar'); - $view->init( $this->pluginName, __FUNCTION__, - "VisitTime.getVisitInformationPerServerTime" ); + $view->init( $this->pluginName, __FUNCTION__, "VisitTime.getVisitInformationPerServerTime" ); $view->setColumnsToDisplay( array('label','nb_visits') ); $view->setSortedColumn( 0, 'asc' ); @@ -37,8 +30,7 @@ class Piwik_VisitTime_Controller extends Piwik_Controller function getVisitInformationPerLocalTime( $fetch = false) { $view = Piwik_ViewDataTable::factory( 'graphVerticalBar'); - $view->init( $this->pluginName, __FUNCTION__, - "VisitTime.getVisitInformationPerLocalTime" ); + $view->init( $this->pluginName, __FUNCTION__, "VisitTime.getVisitInformationPerLocalTime" ); $view->setColumnsToDisplay( array('label','nb_visits') ); $view->setSortedColumn( 0, 'asc' ); diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php index 5eda49e16b..0160b838c4 100644 --- a/plugins/VisitTime/VisitTime.php +++ b/plugins/VisitTime/VisitTime.php @@ -11,7 +11,6 @@ */ /** - * * @package Piwik_VisitTime */ class Piwik_VisitTime extends Piwik_Plugin @@ -25,26 +24,30 @@ class Piwik_VisitTime extends Piwik_Plugin 'homepage' => 'http://piwik.org/', 'version' => '0.1', ); - return $info; } - - function postLoad() - { - Piwik_AddWidget( 'VisitTime', 'getVisitInformationPerLocalTime', Piwik_Translate('VisitTime_WidgetLocalTime')); - Piwik_AddWidget( 'VisitTime', 'getVisitInformationPerServerTime', Piwik_Translate('VisitTime_WidgetServerTime')); - Piwik_AddMenu('General_Visitors', 'VisitTime_SubmenuTimes', array('module' => 'VisitTime')); - } - function getListHooksRegistered() { $hooks = array( 'ArchiveProcessing_Day.compute' => 'archiveDay', 'ArchiveProcessing_Period.compute' => 'archivePeriod', + 'WidgetsList.add' => 'addWidgets', + 'Menu.add' => 'addMenu', ); return $hooks; } + + function addWidgets() + { + Piwik_AddWidget( 'VisitTime', 'getVisitInformationPerLocalTime', Piwik_Translate('VisitTime_WidgetLocalTime')); + Piwik_AddWidget( 'VisitTime', 'getVisitInformationPerServerTime', Piwik_Translate('VisitTime_WidgetServerTime')); + } + + function addMenu() + { + Piwik_AddMenu('General_Visitors', 'VisitTime_SubmenuTimes', array('module' => 'VisitTime')); + } function archivePeriod( $notification ) { |