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:
authorsgiehl <stefan@piwik.org>2015-01-17 16:29:11 +0300
committersgiehl <stefan@piwik.org>2015-01-17 16:29:11 +0300
commit2926ed1c713ed5219e216366de476cc19ef771b1 (patch)
tree0e5a5ecb87138b90c9776dfb1ecc2922927f13c0 /core/ViewDataTable
parent037c64e3faccae9392712660aa1958c2c34ce493 (diff)
moved checking for fixed view types to factory
Diffstat (limited to 'core/ViewDataTable')
-rw-r--r--core/ViewDataTable/Factory.php59
1 files changed, 39 insertions, 20 deletions
diff --git a/core/ViewDataTable/Factory.php b/core/ViewDataTable/Factory.php
index 01a301cb19..dce4eca37b 100644
--- a/core/ViewDataTable/Factory.php
+++ b/core/ViewDataTable/Factory.php
@@ -106,27 +106,31 @@ class Factory
$params = Manager::getViewDataTableParameters($login, $controllerAction);
}
- $savedViewDataTable = false;
- if (!empty($params['viewDataTable'])) {
- $savedViewDataTable = $params['viewDataTable'];
- }
-
- // order of default viewDataTables' priority is: function specified default, saved default, configured default for report
- // function specified default is preferred
- // -> force default == true : defaultType ?: saved ?: defaultView
- // -> force default == false : saved ?: defaultType ?: defaultView
- if ($forceDefault) {
- $defaultType = $defaultType ?: $savedViewDataTable ?: $defaultViewType;
+ if (!self::isDefaultViewTypeForReportFixed($apiAction)) {
+ $savedViewDataTable = false;
+ if (!empty($params['viewDataTable'])) {
+ $savedViewDataTable = $params['viewDataTable'];
+ }
+
+ // order of default viewDataTables' priority is: function specified default, saved default, configured default for report
+ // function specified default is preferred
+ // -> force default == true : defaultType ?: saved ?: defaultView
+ // -> force default == false : saved ?: defaultType ?: defaultView
+ if ($forceDefault) {
+ $defaultType = $defaultType ?: $savedViewDataTable ?: $defaultViewType;
+ } else {
+ $defaultType = $savedViewDataTable ?: $defaultType ?: $defaultViewType;
+ }
+
+ $type = Common::getRequestVar('viewDataTable', $defaultType, 'string');
+
+ // Common::getRequestVar removes backslashes from the defaultValue in case magic quotes are enabled.
+ // therefore do not pass this as a default value to getRequestVar()
+ if ('' === $type) {
+ $type = $defaultType ?: HtmlTable::ID;
+ }
} else {
- $defaultType = $savedViewDataTable ?: $defaultType ?: $defaultViewType;
- }
-
- $type = Common::getRequestVar('viewDataTable', $defaultType, 'string');
-
- // Common::getRequestVar removes backslashes from the defaultValue in case magic quotes are enabled.
- // therefore do not pass this as a default value to getRequestVar()
- if ('' === $type) {
- $type = $defaultType ?: HtmlTable::ID;
+ $type = $defaultViewType;
}
$params['viewDataTable'] = $type;
@@ -169,6 +173,21 @@ class Factory
}
/**
+ * Returns if the default viewDataTable ID to use is fixed.
+ */
+ private static function isDefaultViewTypeForReportFixed($apiAction)
+ {
+ list($module, $action) = explode('.', $apiAction);
+ $report = Report::factory($module, $action);
+
+ if (!empty($report) && $report->isEnabled()) {
+ return $report->isDefaultTypeFixed();
+ }
+
+ return false;
+ }
+
+ /**
* Returns a list of default viewDataTables ID to use when determining which visualization to use for multiple
* reports.
*/