Piwik\API\DataTableManipulator\Flattener::includeAggregateRows PHP Метод

includeAggregateRows() публичный Метод

If the flattener is used after calling this method, aggregate rows will be included in the result. This can be useful when they contain data that the leafs don't have (e.g. conversion stats in some cases).
    public function includeAggregateRows()
    {
        $this->includeAggregateRows = true;
    }

Usage Example

Пример #1
0
 protected function handleDataTable($datatable)
 {
     $label = $this->getLabelFromRequest($this->request);
     // if requested, flatten nested tables
     if (Common::getRequestVar('flat', '0', 'string', $this->request) == '1') {
         $flattener = new Flattener($this->apiModule, $this->apiMethod, $this->request);
         if (Common::getRequestVar('include_aggregate_rows', '0', 'string', $this->request) == '1') {
             $flattener->includeAggregateRows();
         }
         $datatable = $flattener->flatten($datatable);
     }
     if (1 == Common::getRequestVar('totals', '1', 'integer', $this->request)) {
         $genericFilter = new ReportTotalsCalculator($this->apiModule, $this->apiMethod, $this->request);
         $datatable = $genericFilter->calculate($datatable);
     }
     // if the flag disable_generic_filters is defined we skip the generic filters
     if (0 == Common::getRequestVar('disable_generic_filters', '0', 'string', $this->request)) {
         $genericFilter = new DataTableGenericFilter($this->request);
         if (!empty($label)) {
             $genericFilter->disableFilters(array('Limit', 'Truncate'));
         }
         $genericFilter->filter($datatable);
     }
     // we automatically safe decode all datatable labels (against xss)
     $datatable->queueFilter('SafeDecodeLabel');
     // if the flag disable_queued_filters is defined we skip the filters that were queued
     if (Common::getRequestVar('disable_queued_filters', 0, 'int', $this->request) == 0) {
         $datatable->applyQueuedFilters();
     }
     // use the ColumnDelete filter if hideColumns/showColumns is provided (must be done
     // after queued filters are run so processed metrics can be removed, too)
     $hideColumns = Common::getRequestVar('hideColumns', '', 'string', $this->request);
     $showColumns = Common::getRequestVar('showColumns', '', 'string', $this->request);
     if ($hideColumns !== '' || $showColumns !== '') {
         $datatable->filter('ColumnDelete', array($hideColumns, $showColumns));
     }
     // apply label filter: only return rows matching the label parameter (more than one if more than one label)
     if (!empty($label)) {
         $addLabelIndex = Common::getRequestVar('labelFilterAddLabelIndex', 0, 'int', $this->request) == 1;
         $filter = new LabelFilter($this->apiModule, $this->apiMethod, $this->request);
         $datatable = $filter->filter($label, $datatable, $addLabelIndex);
     }
     return $this->apiRenderer->renderDataTable($datatable);
 }
All Usage Examples Of Piwik\API\DataTableManipulator\Flattener::includeAggregateRows