getDimension() public method

public getDimension ( ) : Dimension
return Piwik\Columns\Dimension
 /**
  * Adds ratio metrics if possible.
  *
  * @param  DataTable $dataTable
  * @return DataTable
  */
 protected function manipulateDataTable($dataTable)
 {
     if (!empty($this->report) && !$this->report->getDimension() && !$this->isAllMetricsReport()) {
         // we currently do not calculate the total value for reports having no dimension
         return $dataTable;
     }
     $this->totals = array();
     $firstLevelTable = $this->makeSureToWorkOnFirstLevelDataTable($dataTable);
     $metricsToCalculate = Metrics::getMetricIdsToProcessReportTotal();
     $metricNames = array();
     foreach ($metricsToCalculate as $metricId) {
         $metricNames[$metricId] = Metrics::getReadableColumnName($metricId);
     }
     foreach ($firstLevelTable->getRows() as $row) {
         $columns = $row->getColumns();
         foreach ($metricNames as $metricId => $metricName) {
             $this->sumColumnValueToTotal($columns, $metricId, $metricName);
         }
     }
     $dataTable->setMetadata('totals', $this->totals);
     return $dataTable;
 }
 /**
  * See {@link AddSegmentBySegmentValue}.
  *
  * @param DataTable $table
  * @return int The number of deleted rows.
  */
 public function filter($table)
 {
     if (empty($this->report) || !$table->getRowsCount()) {
         return;
     }
     $dimension = $this->report->getDimension();
     if (empty($dimension)) {
         return;
     }
     $segments = $dimension->getSegments();
     if (empty($segments)) {
         return;
     }
     /** @var \Piwik\Plugin\Segment $segment */
     $segment = reset($segments);
     $segmentName = $segment->getSegment();
     foreach ($table->getRows() as $row) {
         $value = $row->getMetadata('segmentValue');
         $filter = $row->getMetadata('segment');
         if ($value !== false && $filter === false) {
             $row->setMetadata('segment', sprintf('%s==%s', $segmentName, urlencode($value)));
         }
     }
 }
Esempio n. 3
0
 /**
  * Returns true if pivoting by subtable is supported for a report. Will return true if the report
  * has a subtable dimension and if the subtable dimension is different than the report's dimension.
  *
  * @param Report $report
  * @return bool
  */
 public static function isPivotingReportBySubtableSupported(Report $report)
 {
     return self::areDimensionsNotEqualAndNotNull($report->getSubtableDimension(), $report->getDimension());
 }