Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Aubry <matt@piwik.org>2016-01-27 07:59:13 +0300
committerMatthieu Aubry <matt@piwik.org>2016-01-27 07:59:13 +0300
commitf03c048a2061c867a2758729bc9d2225eee176be (patch)
treef54e600ffa2e949dcc6a9ab2c832f79d02a7daac
parent3cee9f4ba8f6afc836c0de027aed08aadf5280c9 (diff)
parent41bd903c1eca93224757836927d79d54bcbd7e96 (diff)
Merge pull request #9643 from piwik/8128
Display a footer message below Custom Variables report which explains why some metrics are not set
-rw-r--r--plugins/CustomVariables/Reports/GetCustomVariables.php36
-rw-r--r--plugins/CustomVariables/lang/en.json4
2 files changed, 39 insertions, 1 deletions
diff --git a/plugins/CustomVariables/Reports/GetCustomVariables.php b/plugins/CustomVariables/Reports/GetCustomVariables.php
index 2ddedc4e97..275acb25ef 100644
--- a/plugins/CustomVariables/Reports/GetCustomVariables.php
+++ b/plugins/CustomVariables/Reports/GetCustomVariables.php
@@ -8,6 +8,7 @@
*/
namespace Piwik\Plugins\CustomVariables\Reports;
+use Piwik\DataTable;
use Piwik\Piwik;
use Piwik\Plugin\ViewDataTable;
use Piwik\Plugins\CustomVariables\Columns\CustomVariableName;
@@ -34,5 +35,40 @@ class GetCustomVariables extends Base
$view->config->addTranslation('label', Piwik::translate('CustomVariables_ColumnCustomVariableName'));
$view->requestConfig->filter_sort_column = 'nb_actions';
$view->requestConfig->filter_sort_order = 'desc';
+
+ $view->config->filters[] = function (DataTable $table) use ($view) {
+ if($this->isReportContainsUnsetVisitsColumns($table)) {
+ $message = $this->getFooterMessageExplanationMissingMetrics();
+ $view->config->show_footer_message = $message;
+ }
+ };
+ }
+
+ /**
+ * @return array
+ */
+ protected function getFooterMessageExplanationMissingMetrics()
+ {
+ $metrics = sprintf("'%s', '%s' %s '%s'",
+ Piwik::translate('General_ColumnNbVisits'),
+ Piwik::translate('General_ColumnNbUniqVisitors'),
+ Piwik::translate('General_And'),
+ Piwik::translate('General_ColumnNbUsers')
+ );
+ $messageStart = Piwik::translate('CustomVariables_MetricsAreOnlyAvailableForVisitScope', array($metrics, "'visit'"));
+
+ $messageEnd = Piwik::translate('CustomVariables_MetricsNotAvailableForPageScope', array("'page'", '\'-\''));
+
+ return $messageStart . ' ' . $messageEnd;
+ }
+
+ /**
+ * @return bool
+ */
+ protected function isReportContainsUnsetVisitsColumns(DataTable $report)
+ {
+ $visits = $report->getColumn('nb_visits');
+ $isVisitsMetricsSometimesUnset = in_array(false, $visits);
+ return $isVisitsMetricsSometimesUnset;
}
}
diff --git a/plugins/CustomVariables/lang/en.json b/plugins/CustomVariables/lang/en.json
index 1a9dba86d1..e065886759 100644
--- a/plugins/CustomVariables/lang/en.json
+++ b/plugins/CustomVariables/lang/en.json
@@ -17,6 +17,8 @@
"CreatingCustomVariableTakesTime": "Creating a new custom variable slot can take a long time depending on the size of your database. Therefore it is only possible to do this via a command which needs to be executed on the command line.",
"CurrentAvailableCustomVariables": "Currently you can use up to %s Custom Variables per site.",
"ToCreateCustomVarExecute": "To create a new custom variable slot execute the following command within your Piwik installation: ",
- "SlotsReportIsGeneratedOverTime": "Data for this report will be populated over time. It may take a day or two to see any data and a few weeks until the report is fully accurate."
+ "SlotsReportIsGeneratedOverTime": "Data for this report will be populated over time. It may take a day or two to see any data and a few weeks until the report is fully accurate.",
+ "MetricsAreOnlyAvailableForVisitScope": "Note: %1$s metrics are available for Custom Variables of scope %2$s only.",
+ "MetricsNotAvailableForPageScope": "For Custom Variables of scope %1$s, the column value for these metrics is %2$s"
}
} \ No newline at end of file