本文整理汇总了PHP中Piwik\DataTable::disableFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP DataTable::disableFilter方法的具体用法?PHP DataTable::disableFilter怎么用?PHP DataTable::disableFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\DataTable
的用法示例。
在下文中一共展示了DataTable::disableFilter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeSitesFlatAndApplyGenericFilters
/**
* Makes sure to not have any subtables anymore.
*
* So if $table is
* array(
* site1
* site2
* subtable => site3
* site4
* site5
* site6
* site7
* )
*
* it will return
*
* array(
* site1
* site2
* site3
* site4
* site5
* site6
* site7
* )
*
* in a sorted order
*
* @param DataTable $table
* @param array $request
*/
private function makeSitesFlatAndApplyGenericFilters(DataTable $table, $request)
{
// we handle limit here as we have to apply sort filter, then make sites flat, then apply limit filter.
$filterOffset = $request['filter_offset'];
$filterLimit = $request['filter_limit'];
unset($request['filter_offset']);
unset($request['filter_limit']);
// filter_sort_column does not work correctly is a bug in MultiSites.getAll
if (!empty($request['filter_sort_column']) && $request['filter_sort_column'] === 'nb_pageviews') {
$request['filter_sort_column'] = 'Actions_nb_pageviews';
} elseif (!empty($request['filter_sort_column']) && $request['filter_sort_column'] === 'revenue') {
$request['filter_sort_column'] = 'Goal_revenue';
}
// make sure no limit filter is applied, we will do this manually
$table->disableFilter('Limit');
// this will apply the sort filter
/** @var DataTable $table */
$genericFilter = new DataTablePostProcessor('MultiSites', 'getAll', $request);
$table = $genericFilter->applyGenericFilters($table);
// make sure from now on the sites will be no longer sorted, they were already sorted
$table->disableFilter('Sort');
// make sites flat and limit
$table->filter('Piwik\\Plugins\\MultiSites\\DataTable\\Filter\\NestedSitesLimiter', array($filterOffset, $filterLimit));
}