diff options
-rw-r--r-- | core/ViewDataTable.php | 56 | ||||
-rw-r--r-- | core/ViewDataTable/Config.php | 10 | ||||
-rw-r--r-- | plugins/DBStats/DBStats.php | 95 | ||||
-rw-r--r-- | plugins/Live/Live.php | 19 | ||||
-rw-r--r-- | plugins/Referrers/Referrers.php | 27 | ||||
-rw-r--r-- | plugins/UserSettings/UserSettings.php | 24 | ||||
-rw-r--r-- | plugins/VisitTime/VisitTime.php | 28 | ||||
-rw-r--r-- | plugins/VisitorInterest/VisitorInterest.php | 22 |
8 files changed, 188 insertions, 93 deletions
diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php index a628f20b3a..e77b19f0b2 100644 --- a/core/ViewDataTable.php +++ b/core/ViewDataTable.php @@ -59,6 +59,13 @@ class ViewDataTable private static $reportPropertiesCache = null; /** + * Cache for getDefaultViewTypeForReports result. + * + * @var array + */ + private static $defaultViewType = null; + + /** * Returns a Piwik_ViewDataTable_* object. * By default it will return a ViewDataTable_Html * If there is a viewDataTable parameter in the URL, a ViewDataTable of this 'viewDataTable' type will be returned. @@ -79,11 +86,11 @@ class ViewDataTable $controllerAction = $apiAction; } - $defaultReportProperties = self::getDefaultPropertiesForReport($apiAction); + $defaultViewType = self::getDefaultViewTypeForReport($apiAction); + $defaultReportProperties = static::getDefaultPropertiesForReport($apiAction); - if (!$forceDefault - && !empty($defaultReportProperties['default_view_type'])) { - $defaultType = $defaultReportProperties['default_view_type']; + if (!$forceDefault && !empty($defaultViewType)) { + $defaultType = $defaultViewType; } $type = Common::getRequestVar('viewDataTable', $defaultType ? : 'table', 'string'); @@ -208,6 +215,47 @@ class ViewDataTable } /** + * Returns the default viewDataTable ID to use when determining which visualization to use. + * + * @param string $apiAction + */ + private static function getDefaultViewTypeForReport($apiAction) + { + $defaultViewTypes = self::getDefaultViewTypeForReports(); + return isset($defaultViewTypes[$apiAction]) ? $defaultViewTypes[$apiAction] : array(); + } + + /** + * Returns a list of default viewDataTables ID to use when determining which visualization to use for multiple + * reports. + */ + private static function getDefaultViewTypeForReports() + { + if (null === self::$defaultViewType) { + self::$defaultViewType = array(); + /** + * This event is triggered to gather the default view types for each available report. By default a table + * is used. If you define your own report, you may want to subscribe to this event to define another + * Visualization that should be used by default to display your report. For instance a Pie, a Bar or a + * Cloud. + * + * Example: + * ``` + * public function getDefaultViewTypeForReports(&$defaultViewTypes) + * { + * $defaultViewTypes['Referrers.getSocials'] = HtmlTable::ID; + * $defaultViewTypes['Referrers.getUrlsForSocial'] = Pie::ID; + * ) + * } + * ``` + */ + Piwik::postEvent('Visualization.getDefaultViewTypeForReports', array(&self::$defaultViewType)); + } + + return self::$defaultViewType; + } + + /** * Returns the list of display properties for all available reports. * * @return array diff --git a/core/ViewDataTable/Config.php b/core/ViewDataTable/Config.php index dbbe4103a1..d82bbfb2c6 100644 --- a/core/ViewDataTable/Config.php +++ b/core/ViewDataTable/Config.php @@ -67,16 +67,6 @@ class Config ); /** - * The default viewDataTable ID to use when determining which visualization to use. - * This property is only valid for reports whose properties are determined by the - * Visualization.getReportDisplayProperties event. When manually creating ViewDataTables, - * setting this property will have no effect. - * - * Default value: 'table' - */ - public $default_view_type = 'table'; - - /** * Controls what footer icons are displayed on the bottom left of the DataTable view. * The value of this property must be an array of footer icon groups. Footer icon groups * have set of properties, including an array of arrays describing footer icons. See diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php index be12d261fa..493cdfbd2c 100644 --- a/plugins/DBStats/DBStats.php +++ b/plugins/DBStats/DBStats.php @@ -16,6 +16,8 @@ use Piwik\Date; use Piwik\Menu\MenuAdmin; use Piwik\Option; use Piwik\Piwik; +use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; +use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Pie; use Piwik\ScheduledTask; use Piwik\ScheduledTime\Weekly; @@ -33,10 +35,11 @@ class DBStats extends \Piwik\Plugin public function getListHooksRegistered() { return array( - 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', - 'Menu.Admin.addItems' => 'addMenu', - 'TaskScheduler.getScheduledTasks' => 'getScheduledTasks', - 'Visualization.getReportDisplayProperties' => 'getReportDisplayProperties', + 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', + 'Menu.Admin.addItems' => 'addMenu', + 'TaskScheduler.getScheduledTasks' => 'getScheduledTasks', + 'Visualization.getReportDisplayProperties' => 'getReportDisplayProperties', + 'Visualization.getDefaultViewTypeForReports' => 'getDefaultViewTypeForReports' ); } @@ -88,24 +91,45 @@ class DBStats extends \Piwik\Plugin return Option::get(self::TIME_OF_LAST_TASK_RUN_OPTION); } + public function getDefaultViewTypeForReports(&$defaultViewTypes) + { + $defaultViewTypes['DBStats.getDatabaseUsageSummary'] = Pie::ID; + $defaultViewTypes['DBStats.getTrackerDataSummary'] = HtmlTable::ID; + $defaultViewTypes['DBStats.getMetricDataSummary'] = HtmlTable::ID; + $defaultViewTypes['DBStats.getMetricDataSummaryByYear'] = HtmlTable::ID; + $defaultViewTypes['DBStats.getReportDataSummary'] = HtmlTable::ID; + $defaultViewTypes['DBStats.getReportDataSummaryByYear'] = HtmlTable::ID; + $defaultViewTypes['DBStats.getIndividualReportsSummary'] = HtmlTable::ID; + $defaultViewTypes['DBStats.getIndividualMetricsSummary'] = HtmlTable::ID; + $defaultViewTypes['DBStats.getAdminDataSummary'] = HtmlTable::ID; + } + public function getReportDisplayProperties(&$properties) { - $properties['DBStats.getDatabaseUsageSummary'] = $this->getDisplayPropertiesForGetDatabaseUsageSummary(); - $properties['DBStats.getTrackerDataSummary'] = $this->getDisplayPropertiesForGetTrackerDataSummary(); - $properties['DBStats.getMetricDataSummary'] = $this->getDisplayPropertiesForGetMetricDataSummary(); - $properties['DBStats.getMetricDataSummaryByYear'] = $this->getDisplayPropertiesForGetMetricDataSummaryByYear(); - $properties['DBStats.getReportDataSummary'] = $this->getDisplayPropertiesForGetReportDataSummary(); - $properties['DBStats.getReportDataSummaryByYear'] = $this->getDisplayPropertiesForGetReportDataSummaryByYear(); - $properties['DBStats.getIndividualReportsSummary'] = $this->getDisplayPropertiesForGetIndividualReportsSummary(); - $properties['DBStats.getIndividualMetricsSummary'] = $this->getDisplayPropertiesForGetIndividualMetricsSummary(); - $properties['DBStats.getAdminDataSummary'] = $this->getDisplayPropertiesForGetAdminDataSummary(); + $properties['DBStats.getDatabaseUsageSummary'] = $this->getDisplayPropertiesForGetDatabaseUsageSummary('DBStats.getDatabaseUsageSummary'); + $properties['DBStats.getTrackerDataSummary'] = $this->getDisplayPropertiesForGetTrackerDataSummary('DBStats.getTrackerDataSummary'); + $properties['DBStats.getMetricDataSummary'] = $this->getDisplayPropertiesForGetMetricDataSummary('DBStats.getMetricDataSummary'); + $properties['DBStats.getMetricDataSummaryByYear'] = $this->getDisplayPropertiesForGetMetricDataSummaryByYear('DBStats.getMetricDataSummaryByYear'); + $properties['DBStats.getReportDataSummary'] = $this->getDisplayPropertiesForGetReportDataSummary('DBStats.getReportDataSummary'); + $properties['DBStats.getReportDataSummaryByYear'] = $this->getDisplayPropertiesForGetReportDataSummaryByYear('DBStats.getReportDataSummaryByYear'); + $properties['DBStats.getIndividualReportsSummary'] = $this->getDisplayPropertiesForGetIndividualReportsSummary('DBStats.getIndividualReportsSummary'); + $properties['DBStats.getIndividualMetricsSummary'] = $this->getDisplayPropertiesForGetIndividualMetricsSummary('DBStats.getIndividualMetricsSummary'); + $properties['DBStats.getAdminDataSummary'] = $this->getDisplayPropertiesForGetAdminDataSummary('DBStats.getAdminDataSummary'); + } + + private function getDefaultViewTypeForApiAction($apiAction) + { + $defaultTypes = array(); + $this->getDefaultViewTypeForReports($defaultTypes); + + return $defaultTypes[$apiAction]; } - private function getDisplayPropertiesForGetDatabaseUsageSummary() + private function getDisplayPropertiesForGetDatabaseUsageSummary($apiAction) { - $result = array('default_view_type' => 'graphPie'); + $result = array(); $this->addBaseDisplayProperties($result); - $this->addPresentationFilters($result, $addTotalSizeColumn = true, $addPercentColumn = true); + $this->addPresentationFilters($result, $apiAction, $addTotalSizeColumn = true, $addPercentColumn = true); $result['show_offset_information'] = false; $result['show_pagination_control'] = false; @@ -130,11 +154,11 @@ class DBStats extends \Piwik\Plugin return $result; } - private function getDisplayPropertiesForGetTrackerDataSummary() + private function getDisplayPropertiesForGetTrackerDataSummary($apiAction) { $result = array(); $this->addBaseDisplayProperties($result); - $this->addPresentationFilters($result); + $this->addPresentationFilters($result, $apiAction); $result['filter_sort_order'] = 'asc'; $result['show_offset_information'] = false; @@ -143,11 +167,11 @@ class DBStats extends \Piwik\Plugin return $result; } - private function getDisplayPropertiesForGetMetricDataSummary() + private function getDisplayPropertiesForGetMetricDataSummary($apiAction) { $result = array(); $this->addBaseDisplayProperties($result); - $this->addPresentationFilters($result); + $this->addPresentationFilters($result, $apiAction); $result['title'] = Piwik::translate('DBStats_MetricTables'); $result['related_reports'] = array( @@ -157,11 +181,11 @@ class DBStats extends \Piwik\Plugin return $result; } - private function getDisplayPropertiesForGetMetricDataSummaryByYear() + private function getDisplayPropertiesForGetMetricDataSummaryByYear($apiAction) { $result = array(); $this->addBaseDisplayProperties($result); - $this->addPresentationFilters($result); + $this->addPresentationFilters($result, $apiAction); $result['translations']['label'] = Piwik::translate('CoreHome_PeriodYear'); $result['title'] = Piwik::translate('DBStats_MetricDataByYear'); @@ -172,11 +196,11 @@ class DBStats extends \Piwik\Plugin return $result; } - private function getDisplayPropertiesForGetReportDataSummary() + private function getDisplayPropertiesForGetReportDataSummary($apiAction) { $result = array(); $this->addBaseDisplayProperties($result); - $this->addPresentationFilters($result); + $this->addPresentationFilters($result, $apiAction); $result['title'] = Piwik::translate('DBStats_ReportTables'); $result['related_reports'] = array( @@ -186,11 +210,11 @@ class DBStats extends \Piwik\Plugin return $result; } - private function getDisplayPropertiesForGetReportDataSummaryByYear() + private function getDisplayPropertiesForGetReportDataSummaryByYear($apiAction) { $result = array(); $this->addBaseDisplayProperties($result); - $this->addPresentationFilters($result); + $this->addPresentationFilters($result, $apiAction); $result['translations']['label'] = Piwik::translate('CoreHome_PeriodYear'); $result['title'] = Piwik::translate('DBStats_ReportDataByYear'); @@ -201,11 +225,11 @@ class DBStats extends \Piwik\Plugin return $result; } - private function getDisplayPropertiesForGetIndividualReportsSummary() + private function getDisplayPropertiesForGetIndividualReportsSummary($apiAction) { $result = array(); $this->addBaseDisplayProperties($result); - $viewDataTable = $this->addPresentationFilters($result, $addTotalSizeColumn = false, $addPercentColumn = false, + $viewDataTable = $this->addPresentationFilters($result, $apiAction, $addTotalSizeColumn = false, $addPercentColumn = false, $sizeColumns = array('estimated_size')); $result['filter_sort_order'] = 'asc'; @@ -221,11 +245,11 @@ class DBStats extends \Piwik\Plugin return $result; } - private function getDisplayPropertiesForGetIndividualMetricsSummary() + private function getDisplayPropertiesForGetIndividualMetricsSummary($apiAction) { $result = array(); $this->addBaseDisplayProperties($result); - $this->addPresentationFilters($result, $addTotalSizeColumn = false, $addPercentColumn = false, + $this->addPresentationFilters($result, $apiAction, $addTotalSizeColumn = false, $addPercentColumn = false, $sizeColumns = array('estimated_size')); $result['filter_sort_order'] = 'asc'; @@ -236,11 +260,11 @@ class DBStats extends \Piwik\Plugin return $result; } - private function getDisplayPropertiesForGetAdminDataSummary() + private function getDisplayPropertiesForGetAdminDataSummary($apiAction) { $result = array(); $this->addBaseDisplayProperties($result); - $this->addPresentationFilters($result); + $this->addPresentationFilters($result, $apiAction); $result['filter_sort_order'] = 'asc'; $result['show_offset_information'] = false; @@ -273,7 +297,7 @@ class DBStats extends \Piwik\Plugin ); } - private function addPresentationFilters(&$properties, $addTotalSizeColumn = true, $addPercentColumn = false, + private function addPresentationFilters(&$properties, $apiAction, $addTotalSizeColumn = true, $addPercentColumn = false, $sizeColumns = array('data_size', 'index_size')) { // add total_size column @@ -290,8 +314,9 @@ class DBStats extends \Piwik\Plugin $runPrettySizeFilterBeforeGeneric = false; - $viewDataTable = empty($properties['default_view_type']) ? 'table' : $properties['default_view_type']; - $viewDataTable = Common::getRequestVar('viewDataTable', $viewDataTable); + $defaultViewType = $this->getDefaultViewTypeForApiAction($apiAction); + $viewDataTable = empty($defaultViewType) ? 'table' : $defaultViewType; + $viewDataTable = Common::getRequestVar('viewDataTable', $viewDataTable); if ($viewDataTable == 'table') { // add summary row only if displaying a table diff --git a/plugins/Live/Live.php b/plugins/Live/Live.php index 753ac229eb..8ce54aad8b 100644 --- a/plugins/Live/Live.php +++ b/plugins/Live/Live.php @@ -29,12 +29,13 @@ class Live extends \Piwik\Plugin public function getListHooksRegistered() { return array( - 'AssetManager.getJavaScriptFiles' => 'getJsFiles', - 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', - 'WidgetsList.addWidgets' => 'addWidget', - 'Menu.Reporting.addItems' => 'addMenu', - 'Visualization.getReportDisplayProperties' => 'getReportDisplayProperties', - 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys', + 'AssetManager.getJavaScriptFiles' => 'getJsFiles', + 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', + 'WidgetsList.addWidgets' => 'addWidget', + 'Menu.Reporting.addItems' => 'addMenu', + 'Visualization.getReportDisplayProperties' => 'getReportDisplayProperties', + 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys', + 'Visualization.getDefaultViewTypeForReports' => 'getDefaultViewTypeForReports' ); } @@ -78,10 +79,14 @@ class Live extends \Piwik\Plugin $properties['Live.getLastVisitsDetails'] = $this->getDisplayPropertiesForGetLastVisitsDetails(); } + public function getDefaultViewTypeForReports(&$defaultViewTypes) + { + $defaultViewTypes['Live.getLastVisitsDetails'] = VisitorLog::ID; + } + private function getDisplayPropertiesForGetLastVisitsDetails() { return array( - 'default_view_type' => VisitorLog::ID, 'disable_generic_filters' => true, 'enable_sort' => false, 'filter_sort_column' => 'idVisit', diff --git a/plugins/Referrers/Referrers.php b/plugins/Referrers/Referrers.php index e2714706eb..25c3ffaf04 100644 --- a/plugins/Referrers/Referrers.php +++ b/plugins/Referrers/Referrers.php @@ -14,6 +14,8 @@ use Piwik\ArchiveProcessor; use Piwik\Common; use Piwik\Menu\MenuMain; use Piwik\Piwik; +use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable\AllColumns; +use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Pie; use Piwik\SettingsPiwik; use Piwik\WidgetsList; @@ -33,14 +35,15 @@ class Referrers extends \Piwik\Plugin public function getListHooksRegistered() { $hooks = array( - 'ArchiveProcessor.Day.compute' => 'archiveDay', - 'ArchiveProcessor.Period.compute' => 'archivePeriod', - 'WidgetsList.addWidgets' => 'addWidgets', - 'Menu.Reporting.addItems' => 'addMenus', - 'Goals.getReportsWithGoalMetrics' => 'getReportsWithGoalMetrics', - 'API.getReportMetadata' => 'getReportMetadata', - 'API.getSegmentsMetadata' => 'getSegmentsMetadata', - 'Visualization.getReportDisplayProperties' => 'getReportDisplayProperties', + 'ArchiveProcessor.Day.compute' => 'archiveDay', + 'ArchiveProcessor.Period.compute' => 'archivePeriod', + 'WidgetsList.addWidgets' => 'addWidgets', + 'Menu.Reporting.addItems' => 'addMenus', + 'Goals.getReportsWithGoalMetrics' => 'getReportsWithGoalMetrics', + 'API.getReportMetadata' => 'getReportMetadata', + 'API.getSegmentsMetadata' => 'getSegmentsMetadata', + 'Visualization.getReportDisplayProperties' => 'getReportDisplayProperties', + 'Visualization.getDefaultViewTypeForReports' => 'getDefaultViewTypeForReports' ); return $hooks; } @@ -295,6 +298,12 @@ class Referrers extends \Piwik\Plugin } } + public function getDefaultViewTypeForReports(&$defaultViewTypes) + { + $defaultViewTypes['Referrers.getReferrerType'] = AllColumns::ID; + $defaultViewTypes['Referrers.getSocials'] = Pie::ID; + } + public function getReportDisplayProperties(&$properties) { $properties['Referrers.getReferrerType'] = $this->getDisplayPropertiesForGetReferrerType(); @@ -330,7 +339,6 @@ class Referrers extends \Piwik\Plugin } return array( - 'default_view_type' => 'tableAllColumns', 'show_search' => false, 'show_offset_information' => false, 'show_pagination_control' => false, @@ -436,7 +444,6 @@ class Referrers extends \Piwik\Plugin private function getDisplayPropertiesForGetSocials() { $result = array( - 'default_view_type' => 'graphPie', 'subtable_controller_action' => 'getUrlsForSocial', 'show_exclude_low_population' => false, 'filter_limit' => 10, diff --git a/plugins/UserSettings/UserSettings.php b/plugins/UserSettings/UserSettings.php index 8db1ba1dbf..08a8f6c1ef 100644 --- a/plugins/UserSettings/UserSettings.php +++ b/plugins/UserSettings/UserSettings.php @@ -13,6 +13,7 @@ namespace Piwik\Plugins\UserSettings; use Piwik\ArchiveProcessor; use Piwik\Menu\MenuMain; use Piwik\Piwik; +use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Pie; use Piwik\WidgetsList; /** @@ -165,17 +166,23 @@ class UserSettings extends \Piwik\Plugin public function getListHooksRegistered() { $hooks = array( - 'ArchiveProcessor.Day.compute' => 'archiveDay', - 'ArchiveProcessor.Period.compute' => 'archivePeriod', - 'WidgetsList.addWidgets' => 'addWidgets', - 'Menu.Reporting.addItems' => 'addMenu', - 'API.getReportMetadata' => 'getReportMetadata', - 'API.getSegmentsMetadata' => 'getSegmentsMetadata', - 'Visualization.getReportDisplayProperties' => 'getReportDisplayProperties', + 'ArchiveProcessor.Day.compute' => 'archiveDay', + 'ArchiveProcessor.Period.compute' => 'archivePeriod', + 'WidgetsList.addWidgets' => 'addWidgets', + 'Menu.Reporting.addItems' => 'addMenu', + 'API.getReportMetadata' => 'getReportMetadata', + 'API.getSegmentsMetadata' => 'getSegmentsMetadata', + 'Visualization.getReportDisplayProperties' => 'getReportDisplayProperties', + 'Visualization.getDefaultViewTypeForReports' => 'getDefaultViewTypeForReports' ); return $hooks; } + public function getDefaultViewTypeForReports(&$defaultViewTypes) + { + $defaultViewTypes['UserSettings.getBrowserType'] = Pie::ID; + } + public function getReportDisplayProperties(&$properties) { $properties['UserSettings.getResolution'] = $this->getDisplayPropertiesForGetResolution(); @@ -252,8 +259,7 @@ class UserSettings extends \Piwik\Plugin 'translations' => array('label' => Piwik::translate('UserSettings_ColumnBrowserFamily')), 'show_offset_information' => false, 'show_pagination_control' => false, - 'show_limit_control' => false, - 'default_view_type' => 'graphPie', + 'show_limit_control' => false )); } diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php index 62c3f6fc9f..22130bb948 100644 --- a/plugins/VisitTime/VisitTime.php +++ b/plugins/VisitTime/VisitTime.php @@ -17,6 +17,7 @@ use Piwik\Common; use Piwik\Menu\MenuMain; use Piwik\Period; use Piwik\Piwik; +use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Bar; use Piwik\Site; use Piwik\WidgetsList; @@ -32,14 +33,15 @@ class VisitTime extends \Piwik\Plugin public function getListHooksRegistered() { $hooks = array( - 'ArchiveProcessor.Day.compute' => 'archiveDay', - 'ArchiveProcessor.Period.compute' => 'archivePeriod', - 'WidgetsList.addWidgets' => 'addWidgets', - 'Menu.Reporting.addItems' => 'addMenu', - 'Goals.getReportsWithGoalMetrics' => 'getReportsWithGoalMetrics', - 'API.getReportMetadata' => 'getReportMetadata', - 'API.getSegmentsMetadata' => 'getSegmentsMetadata', - 'Visualization.getReportDisplayProperties' => 'getReportDisplayProperties', + 'ArchiveProcessor.Day.compute' => 'archiveDay', + 'ArchiveProcessor.Period.compute' => 'archivePeriod', + 'WidgetsList.addWidgets' => 'addWidgets', + 'Menu.Reporting.addItems' => 'addMenu', + 'Goals.getReportsWithGoalMetrics' => 'getReportsWithGoalMetrics', + 'API.getReportMetadata' => 'getReportMetadata', + 'API.getSegmentsMetadata' => 'getSegmentsMetadata', + 'Visualization.getReportDisplayProperties' => 'getReportDisplayProperties', + 'Visualization.getDefaultViewTypeForReports' => 'getDefaultViewTypeForReports' ); return $hooks; } @@ -122,6 +124,13 @@ class VisitTime extends \Piwik\Plugin ); } + public function getDefaultViewTypeForReports(&$defaultViewTypes) + { + $defaultViewTypes['VisitTime.getVisitInformationPerServerTime'] = Bar::ID; + $defaultViewTypes['VisitTime.getVisitInformationPerLocalTime'] = Bar::ID; + $defaultViewTypes['VisitTime.getByDayOfWeek'] = Bar::ID; + } + public function getReportDisplayProperties(&$properties) { $commonProperties = array( @@ -131,8 +140,7 @@ class VisitTime extends \Piwik\Plugin 'show_exclude_low_population' => false, 'show_offset_information' => false, 'show_pagination_control' => false, - 'show_limit_control' => false, - 'default_view_type' => 'graphVerticalBar' + 'show_limit_control' => false ); $properties['VisitTime.getVisitInformationPerServerTime'] = array_merge($commonProperties, array( diff --git a/plugins/VisitorInterest/VisitorInterest.php b/plugins/VisitorInterest/VisitorInterest.php index 4225f5cfc3..ca009b8fd9 100644 --- a/plugins/VisitorInterest/VisitorInterest.php +++ b/plugins/VisitorInterest/VisitorInterest.php @@ -16,6 +16,7 @@ use Piwik\FrontController; use Piwik\Menu\MenuMain; use Piwik\Metrics; use Piwik\Piwik; +use Piwik\Plugins\CoreVisualizations\Visualizations\Cloud; use Piwik\WidgetsList; /** @@ -30,12 +31,13 @@ class VisitorInterest extends \Piwik\Plugin public function getListHooksRegistered() { $hooks = array( - 'ArchiveProcessor.Day.compute' => 'archiveDay', - 'ArchiveProcessor.Period.compute' => 'archivePeriod', - 'WidgetsList.addWidgets' => 'addWidgets', - 'Menu.Reporting.addItems' => 'addMenu', - 'API.getReportMetadata' => 'getReportMetadata', - 'Visualization.getReportDisplayProperties' => 'getReportDisplayProperties', + 'ArchiveProcessor.Day.compute' => 'archiveDay', + 'ArchiveProcessor.Period.compute' => 'archivePeriod', + 'WidgetsList.addWidgets' => 'addWidgets', + 'Menu.Reporting.addItems' => 'addMenu', + 'API.getReportMetadata' => 'getReportMetadata', + 'Visualization.getReportDisplayProperties' => 'getReportDisplayProperties', + 'Visualization.getDefaultViewTypeForReports' => 'getDefaultViewTypeForReports' ); return $hooks; } @@ -151,6 +153,12 @@ class VisitorInterest extends \Piwik\Plugin $out .= '</div>'; } + public function getDefaultViewTypeForReports(&$defaultViewTypes) + { + $defaultViewTypes['VisitorInterest.getNumberOfVisitsPerVisitDuration'] = Cloud::ID; + $defaultViewTypes['VisitorInterest.getNumberOfVisitsPerPage'] = Cloud::ID; + } + public function getReportDisplayProperties(&$properties) { $properties['VisitorInterest.getNumberOfVisitsPerVisitDuration'] = @@ -166,7 +174,6 @@ class VisitorInterest extends \Piwik\Plugin private function getDisplayPropertiesForGetNumberOfVisitsPerVisitDuration() { return array( - 'default_view_type' => 'cloud', 'filter_sort_column' => 'label', 'filter_sort_order' => 'asc', 'translations' => array('label' => Piwik::translate('VisitorInterest_ColumnVisitDuration')), @@ -188,7 +195,6 @@ class VisitorInterest extends \Piwik\Plugin private function getDisplayPropertiesForGetNumberOfVisitsPerPage() { return array( - 'default_view_type' => 'cloud', 'filter_sort_column' => 'label', 'filter_sort_order' => 'asc', 'translations' => array('label' => Piwik::translate('VisitorInterest_ColumnPagesPerVisit')), |