/** * Sorts the given data table by defined column and sorting method * * @param Piwik_DataTable $table * @return mixed */ public function filter($table) { if ($table instanceof Piwik_DataTable_Simple) { return; } if (empty($this->columnToSort)) { return; } $rows = $table->getRows(); if (count($rows) == 0) { return; } $row = current($rows); if ($row === false) { return; } $this->columnToSort = $this->selectColumnToSort($row); $value = $row->getColumn($this->columnToSort); if (is_numeric($value)) { $methodToUse = "sort"; } else { if ($this->naturalSort) { $methodToUse = "naturalSort"; } else { $methodToUse = "sortString"; } } $table->sort(array($this, $methodToUse), $this->columnToSort); }