diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2015-07-03 03:54:27 +0300 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2015-10-06 18:25:13 +0300 |
commit | 9ba8f216fd7856ce5fef06bf82ecb8f8a2e7e630 (patch) | |
tree | 6ce07d18a85d00b39ab720abe042361c0775aead /plugins/Referrers/Reports | |
parent | 8ccc9dc05da021325cdbf141a548637fa52f16b2 (diff) |
generate pages instead of implementing them in each controller
Diffstat (limited to 'plugins/Referrers/Reports')
-rw-r--r-- | plugins/Referrers/Reports/Base.php | 2 | ||||
-rw-r--r-- | plugins/Referrers/Reports/GetAll.php | 12 | ||||
-rw-r--r-- | plugins/Referrers/Reports/GetCampaigns.php | 4 | ||||
-rw-r--r-- | plugins/Referrers/Reports/GetKeywords.php | 4 | ||||
-rw-r--r-- | plugins/Referrers/Reports/GetReferrerType.php | 36 | ||||
-rw-r--r-- | plugins/Referrers/Reports/GetSearchEngines.php | 3 | ||||
-rw-r--r-- | plugins/Referrers/Reports/GetSocials.php | 11 | ||||
-rw-r--r-- | plugins/Referrers/Reports/GetWebsites.php | 5 |
8 files changed, 68 insertions, 9 deletions
diff --git a/plugins/Referrers/Reports/Base.php b/plugins/Referrers/Reports/Base.php index e4a6394c00..2bd240d191 100644 --- a/plugins/Referrers/Reports/Base.php +++ b/plugins/Referrers/Reports/Base.php @@ -12,7 +12,7 @@ abstract class Base extends \Piwik\Plugin\Report { protected function init() { - $this->category = 'Referrers_Referrers'; + $this->categoryId = 'Referrers_Referrers'; } } diff --git a/plugins/Referrers/Reports/GetAll.php b/plugins/Referrers/Reports/GetAll.php index 2079dd414d..cb5f17ee41 100644 --- a/plugins/Referrers/Reports/GetAll.php +++ b/plugins/Referrers/Reports/GetAll.php @@ -13,6 +13,8 @@ use Piwik\Plugin\ViewDataTable; use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; use Piwik\Plugins\Referrers\Columns\Referrer; use Piwik\Plugins\Referrers\Referrers; +use Piwik\Report\ReportWidgetFactory; +use Piwik\Widget\WidgetsList; class GetAll extends Base { @@ -23,7 +25,15 @@ class GetAll extends Base $this->name = Piwik::translate('Referrers_WidgetGetAll'); $this->documentation = Piwik::translate('Referrers_AllReferrersReportDocumentation', '<br />'); $this->order = 2; - $this->widgetTitle = 'Referrers_WidgetGetAll'; + + $this->subcategoryId = 'Referrers_WidgetGetAll'; + } + + public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory) + { + $widgetsList->addWidgetConfig( + $factory->createWidget()->setName('Referrers_Referrers') + ); } public function getDefaultTypeViewDataTable() diff --git a/plugins/Referrers/Reports/GetCampaigns.php b/plugins/Referrers/Reports/GetCampaigns.php index a09affa70c..1d375423d8 100644 --- a/plugins/Referrers/Reports/GetCampaigns.php +++ b/plugins/Referrers/Reports/GetCampaigns.php @@ -24,8 +24,8 @@ class GetCampaigns extends Base $this->actionToLoadSubTables = 'getKeywordsFromCampaignId'; $this->hasGoalMetrics = true; $this->order = 9; - $this->widgetTitle = 'Referrers_Campaigns'; - $this->menuTitle = 'Referrers_Campaigns'; + + $this->subcategoryId = 'Referrers_Campaigns'; } public function configureView(ViewDataTable $view) diff --git a/plugins/Referrers/Reports/GetKeywords.php b/plugins/Referrers/Reports/GetKeywords.php index be8e8d3f4c..3239fefde0 100644 --- a/plugins/Referrers/Reports/GetKeywords.php +++ b/plugins/Referrers/Reports/GetKeywords.php @@ -11,7 +11,9 @@ namespace Piwik\Plugins\Referrers\Reports; use Piwik\Piwik; use Piwik\Plugin\ViewDataTable; use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; +use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Evolution; use Piwik\Plugins\Referrers\Columns\Keyword; +use Piwik\Tracker\Visit; class GetKeywords extends Base { @@ -24,7 +26,7 @@ class GetKeywords extends Base $this->actionToLoadSubTables = 'getSearchEnginesFromKeywordId'; $this->hasGoalMetrics = true; $this->order = 3; - $this->widgetTitle = 'Referrers_Keywords'; + $this->subcategoryId = 'Referrers_SubmenuSearchEngines'; } public function configureView(ViewDataTable $view) diff --git a/plugins/Referrers/Reports/GetReferrerType.php b/plugins/Referrers/Reports/GetReferrerType.php index f5656bfa7f..c09f8c6d17 100644 --- a/plugins/Referrers/Reports/GetReferrerType.php +++ b/plugins/Referrers/Reports/GetReferrerType.php @@ -12,7 +12,11 @@ use Piwik\Common; use Piwik\Piwik; use Piwik\Plugin\ViewDataTable; use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; +use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Evolution; +use Piwik\Plugins\CoreVisualizations\Visualizations\Sparklines; use Piwik\Plugins\Referrers\Columns\ReferrerType; +use Piwik\Widget\WidgetsList; +use Piwik\Report\ReportWidgetFactory; class GetReferrerType extends Base { @@ -32,7 +36,7 @@ class GetReferrerType extends Base $this->constantRowsCount = true; $this->hasGoalMetrics = true; $this->order = 1; - $this->widgetTitle = 'General_Overview'; + $this->subcategoryId = 'Referrers_WidgetGetAll'; } public function getDefaultTypeViewDataTable() @@ -40,6 +44,36 @@ class GetReferrerType extends Base return HtmlTable\AllColumns::ID; } + public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory) + { + $widgetsList->addWidgetConfig( + $factory->createWidget() + ->setName('Referrers_ReferrerTypes') + ->setSubcategoryId('Referrers_WidgetGetAll') + ); + + $widgetsList->addWidgetConfig( + $factory->createWidget() + ->setName('General_EvolutionOverPeriod') + ->setSubcategoryId('General_Overview') + ->setAction('getEvolutionGraph') + ->setIsNotWidgetizable() + ->forceViewDataTable(Evolution::ID) + ->addParameters(array( + 'columns' => $defaultColumns = array('nb_visits'), + )) + ); + + $widgetsList->addWidgetConfig( + $factory->createCustomWidget('getSparklines') + ->forceViewDataTable(Sparklines::ID) + ->setIsNotWidgetizable() + ->setName('Referrers_Type') + ->setSubcategoryId('General_Overview') + ->setOrder(10) + ); + } + public function configureView(ViewDataTable $view) { $idSubtable = Common::getRequestVar('idSubtable', false); diff --git a/plugins/Referrers/Reports/GetSearchEngines.php b/plugins/Referrers/Reports/GetSearchEngines.php index 3b66cd0784..0a17cd132e 100644 --- a/plugins/Referrers/Reports/GetSearchEngines.php +++ b/plugins/Referrers/Reports/GetSearchEngines.php @@ -24,7 +24,8 @@ class GetSearchEngines extends Base $this->actionToLoadSubTables = 'getKeywordsFromSearchEngineId'; $this->hasGoalMetrics = true; $this->order = 7; - $this->widgetTitle = 'Referrers_SearchEngines'; + + $this->subcategoryId = 'Referrers_SubmenuSearchEngines'; } public function configureView(ViewDataTable $view) diff --git a/plugins/Referrers/Reports/GetSocials.php b/plugins/Referrers/Reports/GetSocials.php index b49fac623a..7429ddd48f 100644 --- a/plugins/Referrers/Reports/GetSocials.php +++ b/plugins/Referrers/Reports/GetSocials.php @@ -14,6 +14,8 @@ use Piwik\Plugin\ViewDataTable; use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Pie; use Piwik\Plugins\Referrers\Columns\SocialNetwork; +use Piwik\Report\ReportWidgetFactory; +use Piwik\Widget\WidgetsList; class GetSocials extends Base { @@ -25,7 +27,14 @@ class GetSocials extends Base $this->documentation = Piwik::translate('Referrers_WebsitesReportDocumentation', '<br />'); $this->actionToLoadSubTables = 'getUrlsForSocial'; $this->order = 11; - $this->widgetTitle = 'Referrers_WidgetSocials'; + + $this->subcategoryId = 'Referrers_SubmenuWebsites'; + } + + public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory) + { + $widget = $factory->createWidget()->setName('Referrers_Socials'); + $widgetsList->addWidgetConfig($widget); } public function getDefaultTypeViewDataTable() diff --git a/plugins/Referrers/Reports/GetWebsites.php b/plugins/Referrers/Reports/GetWebsites.php index 18f9336a63..f5be3ca375 100644 --- a/plugins/Referrers/Reports/GetWebsites.php +++ b/plugins/Referrers/Reports/GetWebsites.php @@ -12,6 +12,8 @@ use Piwik\Piwik; use Piwik\Plugin\ViewDataTable; use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; use Piwik\Plugins\Referrers\Columns\Website; +use Piwik\Report\ReportWidgetFactory; +use Piwik\Widget\WidgetsList; class GetWebsites extends Base { @@ -25,7 +27,8 @@ class GetWebsites extends Base $this->actionToLoadSubTables = 'getUrlsFromWebsiteId'; $this->hasGoalMetrics = true; $this->order = 5; - $this->widgetTitle = 'Referrers_WidgetExternalWebsites'; + + $this->subcategoryId = 'Referrers_SubmenuWebsites'; } public function configureView(ViewDataTable $view) |