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/Columns | |
parent | 0610a6d428c3d4a725483678a9c5700a4888ea06 (diff) |
refs #4996 track content pieces and display a content report under action and added a widget
Diffstat (limited to 'plugins/Contents/Columns')
-rw-r--r-- | plugins/Contents/Columns/ContentName.php | 55 | ||||
-rw-r--r-- | plugins/Contents/Columns/ContentPiece.php | 56 | ||||
-rw-r--r-- | plugins/Contents/Columns/ContentTarget.php | 56 |
3 files changed, 167 insertions, 0 deletions
diff --git a/plugins/Contents/Columns/ContentName.php b/plugins/Contents/Columns/ContentName.php new file mode 100644 index 0000000000..21af924e4b --- /dev/null +++ b/plugins/Contents/Columns/ContentName.php @@ -0,0 +1,55 @@ +<?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\Columns; + +use Piwik\Piwik; +use Piwik\Plugin\Dimension\ActionDimension; +use Piwik\Plugins\Contents\Actions\ActionContent; +use Piwik\Plugins\Actions\Segment; +use Piwik\Tracker\Action; +use Piwik\Tracker\Request; + +class ContentName extends ActionDimension +{ + protected $columnName = 'idaction_name'; + + protected function configureSegments() + { + $segment = new Segment(); + $segment->setSegment('contentName'); + $segment->setName('Contents_ContentName'); + $this->addSegment($segment); + } + + public function getName() + { + return Piwik::translate('Contents_ContentName'); + } + + public function getActionId() + { + return Action::TYPE_CONTENT_NAME; + } + + public function onLookupAction(Request $request, Action $action) + { + if (!($action instanceof ActionContent)) { + return false; + } + + $contentName = $request->getParam('c_n'); + $contentName = trim($contentName); + + if (strlen($contentName) > 0) { + return $contentName; + } + + return false; + } +}
\ No newline at end of file diff --git a/plugins/Contents/Columns/ContentPiece.php b/plugins/Contents/Columns/ContentPiece.php new file mode 100644 index 0000000000..c64b3b5660 --- /dev/null +++ b/plugins/Contents/Columns/ContentPiece.php @@ -0,0 +1,56 @@ +<?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\Columns; + +use Piwik\Piwik; +use Piwik\Plugin\Dimension\ActionDimension; +use Piwik\Plugins\Actions\Segment; +use Piwik\Plugins\Contents\Actions\ActionContent; +use Piwik\Tracker\Action; +use Piwik\Tracker\Request; + +class ContentPiece extends ActionDimension +{ + protected $columnName = 'idaction_content_piece'; + protected $columnType = 'INTEGER(10) UNSIGNED DEFAULT NULL'; + + protected function configureSegments() + { + $segment = new Segment(); + $segment->setSegment('contentPiece'); + $segment->setName('Contents_ContentPiece'); + $this->addSegment($segment); + } + + public function getName() + { + return Piwik::translate('Contents_ContentPiece'); + } + + public function getActionId() + { + return Action::TYPE_CONTENT_PIECE; + } + + public function onLookupAction(Request $request, Action $action) + { + if (!($action instanceof ActionContent)) { + return false; + } + + $contentPiece = $request->getParam('c_p'); + $contentPiece = trim($contentPiece); + + if (strlen($contentPiece) > 0) { + return $contentPiece; + } + + return false; + } +}
\ No newline at end of file diff --git a/plugins/Contents/Columns/ContentTarget.php b/plugins/Contents/Columns/ContentTarget.php new file mode 100644 index 0000000000..17abb9f1a5 --- /dev/null +++ b/plugins/Contents/Columns/ContentTarget.php @@ -0,0 +1,56 @@ +<?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\Columns; + +use Piwik\Piwik; +use Piwik\Plugin\Dimension\ActionDimension; +use Piwik\Plugins\Actions\Segment; +use Piwik\Plugins\Contents\Actions\ActionContent; +use Piwik\Tracker\Action; +use Piwik\Tracker\Request; + +class ContentTarget extends ActionDimension +{ + protected $columnName = 'idaction_content_target'; + protected $columnType = 'INTEGER(10) UNSIGNED DEFAULT NULL'; + + protected function configureSegments() + { + $segment = new Segment(); + $segment->setSegment('contentTarget'); + $segment->setName('Contents_ContentTarget'); + $this->addSegment($segment); + } + + public function getName() + { + return Piwik::translate('Contents_ContentTarget'); + } + + public function getActionId() + { + return Action::TYPE_CONTENT_TARGET; + } + + public function onLookupAction(Request $request, Action $action) + { + if (!($action instanceof ActionContent)) { + return false; + } + + $contentTarget = $request->getParam('c_t'); + $contentTarget = trim($contentTarget); + + if (strlen($contentTarget) > 0) { + return $contentTarget; + } + + return false; + } +}
\ No newline at end of file |