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
path: root/core
diff options
context:
space:
mode:
authorThomas ZILLIOX <thomas@zilliox.me>2013-07-11 18:25:05 +0400
committerThomas ZILLIOX <thomas@zilliox.me>2013-07-11 18:25:05 +0400
commit2566d552726d0cbf308f797294e4671b7d94a4a8 (patch)
tree0fe0b4f1248d4bb1e4e8b5ad49a590e2695e7a4c /core
parent09c7e0c0a3e3fe2a9445ae6a19668b6df7b97ae3 (diff)
parent96c3d48fe242738a4594d4a4a959fe0eb89df8fd (diff)
Merge branch 'master' of github.com:piwik/piwik into pleineLune__less-installation
Diffstat (limited to 'core')
-rw-r--r--core/ViewDataTable.php17
-rw-r--r--core/ViewDataTable/HtmlTable.php72
-rw-r--r--core/ViewDataTable/HtmlTable/AllColumns.php2
-rw-r--r--core/ViewDataTable/HtmlTable/Goals.php2
4 files changed, 40 insertions, 53 deletions
diff --git a/core/ViewDataTable.php b/core/ViewDataTable.php
index 3a5ce83b74..3415c817f5 100644
--- a/core/ViewDataTable.php
+++ b/core/ViewDataTable.php
@@ -1273,7 +1273,7 @@ abstract class Piwik_ViewDataTable
* and should therefore be ran before Sort, Limit, etc.
* @return void
*/
- public function queueFilter($filterName, $parameters, $runBeforeGenericFilters = false)
+ public function queueFilter($filterName, $parameters = array(), $runBeforeGenericFilters = false)
{
if ($runBeforeGenericFilters) {
$this->queuedFiltersPriority[] = array($filterName, $parameters);
@@ -1428,4 +1428,19 @@ abstract class Piwik_ViewDataTable
$url = Piwik_Url::getCurrentQueryStringWithParametersModified($params);
return $url;
}
+
+ /**
+ * Returns whether the DataTable result will have to be expanded for the
+ * current request before rendering.
+ *
+ * @return bool
+ */
+ public static function shouldLoadExpanded()
+ {
+ // if filter_column_recursive & filter_pattern_recursive are supplied, and flat isn't supplied
+ // we have to load all the child subtables.
+ return Piwik_Common::getRequestVar('filter_column_recursive', false) !== false
+ && Piwik_Common::getRequestVar('filter_pattern_recursive', false) !== false
+ && Piwik_Common::getRequestVar('flat', false) === false;
+ }
}
diff --git a/core/ViewDataTable/HtmlTable.php b/core/ViewDataTable/HtmlTable.php
index 402355dc53..c8677b9643 100644
--- a/core/ViewDataTable/HtmlTable.php
+++ b/core/ViewDataTable/HtmlTable.php
@@ -20,14 +20,6 @@
class Piwik_ViewDataTable_HtmlTable extends Piwik_ViewDataTable
{
/**
- * Set to true when the DataTable must be loaded along with all its children subtables
- * Useful when searching for a pattern in the DataTable Actions (we display the full hierarchy)
- *
- * @var bool
- */
- protected $recursiveDataTableLoad = false;
-
- /**
* PHP array conversion of the Piwik_DataTable
*
* @var array
@@ -55,6 +47,9 @@ class Piwik_ViewDataTable_HtmlTable extends Piwik_ViewDataTable
$this->setSortedColumn('nb_visits', 'desc');
$this->setLimit(Piwik_Config::getInstance()->General['datatable_default_limit']);
$this->handleLowPopulation();
+ $this->setSubtableTemplate("@CoreHome/_dataTable.twig");
+ $this->viewProperties['datatable_js_type'] = 'dataTable';
+ $this->viewProperties['datatable_css_class'] = $this->getDefaultDataTableCssClass();
}
protected function getViewDataTableId()
@@ -90,19 +85,29 @@ class Piwik_ViewDataTable_HtmlTable extends Piwik_ViewDataTable
$this->view = $this->buildView();
}
- public function getDefaultDataTableType()
+ public function getDefaultDataTableCssClass()
{
return 'dataTableNormal';
}
- public function setDataTableType($type)
+ public function setDataTableCssClass($type)
{
- $this->viewProperties['dataTableType'] = $type;
+ $this->viewProperties['datatable_css_class'] = $type;
}
public function setJsType($type)
{
- $this->dataTableJsType = $type;
+ $this->viewProperties['datatable_js_type'] = $type;
+ }
+
+ public function setSubtableTemplate($subtableTemplate)
+ {
+ $this->viewProperties['subtable_template'] = $subtableTemplate;
+ }
+
+ public function showExpanded()
+ {
+ $this->viewProperties['show_expanded'] = true;
}
/**
@@ -110,22 +115,15 @@ class Piwik_ViewDataTable_HtmlTable extends Piwik_ViewDataTable
*/
protected function buildView()
{
- $view = new Piwik_View($this->dataTableTemplate);
-
- if (empty($this->viewProperties['dataTableType'])) {
- $this->viewProperties['dataTableType'] = $this->getDefaultDataTableType();
- }
-
- if (!empty($this->dataTableJsType)) {
- $view->dataTableJsType = $this->dataTableJsType;
- }
+ $template = $this->idSubtable ? $this->viewProperties['subtable_template'] : $this->dataTableTemplate;
+ $view = new Piwik_View($template);
if (!empty($this->loadingError)) {
$view->error = $this->loadingError;
}
if (!$this->isDataAvailable) {
- $view->arrayDataTable = array();
+ $view->dataTable = null;
} else {
$columns = $this->getColumnsToDisplay();
$columnTranslations = $columnDocumentation = array();
@@ -139,7 +137,7 @@ class Piwik_ViewDataTable_HtmlTable extends Piwik_ViewDataTable
$nbColumns = count($this->columnsToDisplay);
}
- $view->arrayDataTable = $this->getPHPArrayFromDataTable();
+ $view->dataTable = $this->dataTable;
$view->dataTableColumns = $columns;
$view->reportDocumentation = $this->getReportDocumentation();
$view->columnTranslations = $columnTranslations;
@@ -198,48 +196,22 @@ class Piwik_ViewDataTable_HtmlTable extends Piwik_ViewDataTable
/**
* Sets the search on a table to be recursive (also searches in subtables)
* Works only on Actions/Downloads/Outlinks tables.
- *
- * @return bool If the pattern for a recursive search was set in the URL
*/
public function setSearchRecursive()
{
$this->variablesDefault['search_recursive'] = true;
- return $this->setRecursiveLoadDataTableIfSearchingForPattern();
}
protected function getRequestString()
{
$requestString = parent::getRequestString();
- if ($this->recursiveDataTableLoad
- && !Piwik_Common::getRequestVar('flat', false)
- ) {
+ if (parent::shouldLoadExpanded()) {
$requestString .= '&expanded=1';
}
return $requestString;
}
/**
- * Set the flag to load the datatable recursively so we can search on subtables as well
- *
- * @return bool if recursive search is enabled
- */
- protected function setRecursiveLoadDataTableIfSearchingForPattern()
- {
- try {
- $requestValue = Piwik_Common::getRequestVar('filter_column_recursive');
- $requestValue = Piwik_Common::getRequestVar('filter_pattern_recursive');
- // if the 2 variables are set we are searching for something.
- // we have to load all the children subtables in this case
-
- $this->recursiveDataTableLoad = true;
- return true;
- } catch (Exception $e) {
- $this->recursiveDataTableLoad = false;
- return false;
- }
- }
-
- /**
* Disable the row evolution feature which is enabled by default
*/
public function disableRowEvolution()
diff --git a/core/ViewDataTable/HtmlTable/AllColumns.php b/core/ViewDataTable/HtmlTable/AllColumns.php
index d486fcfc51..3381c85891 100644
--- a/core/ViewDataTable/HtmlTable/AllColumns.php
+++ b/core/ViewDataTable/HtmlTable/AllColumns.php
@@ -63,7 +63,7 @@ class Piwik_ViewDataTable_HtmlTable_AllColumns extends Piwik_ViewDataTable_HtmlT
return true;
}
- public function getDefaultDataTableType()
+ public function getDefaultDataTableCssClass()
{
return 'dataTableAllColumns';
}
diff --git a/core/ViewDataTable/HtmlTable/Goals.php b/core/ViewDataTable/HtmlTable/Goals.php
index e938771d60..7b407e8d17 100644
--- a/core/ViewDataTable/HtmlTable/Goals.php
+++ b/core/ViewDataTable/HtmlTable/Goals.php
@@ -257,7 +257,7 @@ class Piwik_ViewDataTable_HtmlTable_Goals extends Piwik_ViewDataTable_HtmlTable
return true;
}
- public function getDefaultDataTableType()
+ public function getDefaultDataTableCssClass()
{
return 'dataTableGoals';
}