當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DataTable::disableFilter方法代碼示例

本文整理匯總了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));
 }
開發者ID:piwik,項目名稱:piwik,代碼行數:55,代碼來源:Dashboard.php


注:本文中的Piwik\DataTable::disableFilter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。