diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-08-21 15:18:50 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-08-21 15:18:50 +0400 |
commit | d44cce7e3b49c8a74d30b0b35e042491409a7f45 (patch) | |
tree | 3aa9fb227b390bbd28fe261edf8e670028b4e7b3 /plugins/Contents/Reports | |
parent | 0610a6d428c3d4a725483678a9c5700a4888ea06 (diff) |
refs #4996 track content pieces and display a content report under action and added a widget
Diffstat (limited to 'plugins/Contents/Reports')
-rw-r--r-- | plugins/Contents/Reports/Base.php | 19 | ||||
-rw-r--r-- | plugins/Contents/Reports/GetContents.php | 67 |
2 files changed, 86 insertions, 0 deletions
diff --git a/plugins/Contents/Reports/Base.php b/plugins/Contents/Reports/Base.php new file mode 100644 index 0000000000..84540699f9 --- /dev/null +++ b/plugins/Contents/Reports/Base.php @@ -0,0 +1,19 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\Contents\Reports; + +use Piwik\Plugin\Report; + +abstract class Base extends Report +{ + protected function init() + { + $this->category = 'General_Actions'; + } +} diff --git a/plugins/Contents/Reports/GetContents.php b/plugins/Contents/Reports/GetContents.php new file mode 100644 index 0000000000..1d4205d956 --- /dev/null +++ b/plugins/Contents/Reports/GetContents.php @@ -0,0 +1,67 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\Contents\Reports; + +use Piwik\Piwik; +use Piwik\Plugin\Report; +use Piwik\Plugin\ViewDataTable; + +use Piwik\Plugins\Contents\Columns\ContentName; +use Piwik\View; + +/** + * This class defines a new report. + * + * See {@link http://developer.piwik.org/api-reference/Piwik/Plugin/Report} for more information. + */ +class GetContents extends Base +{ + protected function init() + { + parent::init(); + + $this->name = Piwik::translate('ContentsName'); + $this->dimension = null; + $this->documentation = Piwik::translate('ContentsDocumentation'); + $this->dimension = new ContentName(); + $this->order = 35; + + $this->menuTitle = 'Contents_Contents'; + $this->widgetTitle = $this->menuTitle; + + $this->metrics = array('nb_impressions', 'nb_conversions', 'conversion_rate'); + } + + /** + * Here you can configure how your report should be displayed. For instance whether your report supports a search + * etc. You can also change the default request config. For instance change how many rows are displayed by default. + * + * @param ViewDataTable $view + */ + public function configureView(ViewDataTable $view) + { + if (!empty($this->dimension)) { + $view->config->addTranslations(array('label' => $this->dimension->getName())); + } + + $view->config->columns_to_display = array_merge(array('label'), $this->metrics); + $view->requestConfig->filter_sort_column = 'nb_impressions'; + } + + /** + * Here you can define related reports that will be shown below the reports. Just return an array of related + * report instances if there are any. + * + * @return \Piwik\Plugin\Report[] + */ + public function getRelatedReports() + { + return array(); // eg return array(new XyzReport()); + } +} |