diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-09-03 19:35:50 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-09-03 19:35:50 +0400 |
commit | 71c76ffd4435344024c3a9ef332daab8f908572f (patch) | |
tree | 076b4638a76ed936c87deb8dde8bac6eae0eb683 /plugins/Contents | |
parent | 9b1d0b1c50455fc6b7928718d71c052957a00598 (diff) |
refs #4996 updated spec to better describe how it will work. While writing this I noticed a few things that need to be changed and that do not work, also many possible new features for V2. Already updated a few things but will need to adjust more things before writing tests
Diffstat (limited to 'plugins/Contents')
-rw-r--r-- | plugins/Contents/API.php | 6 | ||||
-rw-r--r-- | plugins/Contents/Actions/ActionContent.php | 2 | ||||
-rw-r--r-- | plugins/Contents/Archiver.php | 7 |
3 files changed, 14 insertions, 1 deletions
diff --git a/plugins/Contents/API.php b/plugins/Contents/API.php index ef4bdaf781..95dc283fe1 100644 --- a/plugins/Contents/API.php +++ b/plugins/Contents/API.php @@ -49,6 +49,12 @@ class API extends \Piwik\Plugin\API $dataTable->queueFilter('ReplaceColumnNames'); $dataTable->queueFilter('ReplaceSummaryRowLabel'); + $dataTable->filter(function (DataTable $table) { + $row = $table->getRowFromLabel(Archiver::CONTENT_PIECE_NOT_SET); + if ($row) { + $row->setColumn('label', Piwik::translate('General_NotDefined', Piwik::translate('Contents_ContentPiece'))); + } + }); // Content interaction rate = interactions / impressions $dataTable->queueFilter('ColumnCallbackAddColumnPercentage', array('interaction_rate', 'nb_interactions', 'nb_impressions', $precision = 2)); diff --git a/plugins/Contents/Actions/ActionContent.php b/plugins/Contents/Actions/ActionContent.php index ecc6769813..b9edc14a29 100644 --- a/plugins/Contents/Actions/ActionContent.php +++ b/plugins/Contents/Actions/ActionContent.php @@ -28,7 +28,7 @@ class ActionContent extends Action public static function shouldHandle(Request $request) { - $name = $request->getParam('c_n'); + $name = $request->getParam('c_n'); $interaction = $request->getParam('c_i'); // if interaction is set we want it to be for instance an outlink, download, ... return !empty($name) && empty($interaction); diff --git a/plugins/Contents/Archiver.php b/plugins/Contents/Archiver.php index c5888b29a8..debac613a9 100644 --- a/plugins/Contents/Archiver.php +++ b/plugins/Contents/Archiver.php @@ -21,6 +21,7 @@ class Archiver extends \Piwik\Plugin\Archiver const CONTENTS_PIECE_NAME_RECORD_NAME = 'Contents_piece_name'; const CONTENTS_NAME_PIECE_RECORD_NAME = 'Contents_name_piece'; const CONTENT_TARGET_NOT_SET = 'Piwik_ContentTargetNotSet'; + const CONTENT_PIECE_NOT_SET = 'Piwik_ContentPieceNotSet'; /** * @var DataArray[] @@ -248,6 +249,12 @@ class Archiver extends \Piwik\Plugin\Archiver $mainDimension = $dimensions[0]; $mainLabel = $row[$mainDimension]; + // content piece is optional + if ($mainDimension == 'contentPiece' + && empty($mainLabel)) { + $mainLabel = self::CONTENT_PIECE_NOT_SET; + } + $dataArray->sumMetricsImpressions($mainLabel, $row); $this->rememberMetadataForRow($row, $mainLabel); |