Skip to content

Commit

Permalink
Refs #4041, removed Piwik_ViewDataTable_HtmlTable::recursiveDataTable…
Browse files Browse the repository at this point in the history
…Load.
  • Loading branch information
Benaka Moorthi committed Jul 11, 2013
1 parent b9020ee commit a7879ae
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 30 deletions.
15 changes: 15 additions & 0 deletions core/ViewDataTable.php
Expand Up @@ -1428,4 +1428,19 @@ private function getBaseReportUrl($module, $action, $queryParams = array())
$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;
}
}
30 changes: 1 addition & 29 deletions core/ViewDataTable/HtmlTable.php
Expand Up @@ -19,14 +19,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
*
Expand Down Expand Up @@ -208,37 +200,17 @@ public function addColumnToDisplay($columnName)
public function setSearchRecursive()
{
$this->variablesDefault['search_recursive'] = true;
$this->setRecursiveLoadDataTableIfSearchingForPattern();
}

public function isLoadingExpandedDataTable()
{
return $this->recursiveDataTableLoad;
}

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
*/
protected function setRecursiveLoadDataTableIfSearchingForPattern()
{
// if the 2 variables are set we are searching for something.
// we have to load all the children subtables in this case
$this->recursiveDataTableLoad = Piwik_Common::getRequestVar('filter_column_recursive', false) !== false
&& Piwik_Common::getRequestVar('filter_pattern_recursive', false) !== false;
return $this->recursiveDataTableLoad;
}

/**
* Disable the row evolution feature which is enabled by default
*/
Expand Down
2 changes: 1 addition & 1 deletion plugins/Actions/Controller.php
Expand Up @@ -457,7 +457,7 @@ protected function configureGenericViewActions($view)
$view->setSubtableTemplate('@CoreHome/_dataTableActions_subDataTable.twig');

$view->setSearchRecursive();
if ($view->isLoadingExpandedDataTable()) {
if (Piwik_ViewDataTable::shouldLoadExpanded()) {
$view->showExpanded();

// set levelN css class for each row
Expand Down

0 comments on commit a7879ae

Please sign in to comment.