Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-09-30 09:37:32 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-09-30 09:37:32 +0400
commita00487b0b841c4b15463b591c7f62176c4b84d15 (patch)
tree6eb893ce356a4740e044c9cdadaf84ffb2095b9d /core/DataTable/Filter/Sort.php
parent0edef3332289a7cbe54b58084b967907d1086d29 (diff)
coding style fixes, some PHPStorm inspection fixes, improved readability of code, few refactorings, all as part of our code cleanup strategy
Diffstat (limited to 'core/DataTable/Filter/Sort.php')
-rw-r--r--core/DataTable/Filter/Sort.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/core/DataTable/Filter/Sort.php b/core/DataTable/Filter/Sort.php
index 683e93cffe..9df2250288 100644
--- a/core/DataTable/Filter/Sort.php
+++ b/core/DataTable/Filter/Sort.php
@@ -38,11 +38,13 @@ class Sort extends BaseFilter
public function __construct($table, $columnToSort, $order = 'desc', $naturalSort = true, $recursiveSort = false)
{
parent::__construct($table);
+
if ($recursiveSort) {
$table->enableRecursiveSort();
}
+
$this->columnToSort = $columnToSort;
- $this->naturalSort = $naturalSort;
+ $this->naturalSort = $naturalSort;
$this->setOrder($order);
}
@@ -55,10 +57,10 @@ class Sort extends BaseFilter
{
if ($order == 'asc') {
$this->order = 'asc';
- $this->sign = 1;
+ $this->sign = 1;
} else {
$this->order = 'desc';
- $this->sign = -1;
+ $this->sign = -1;
}
}
@@ -225,17 +227,21 @@ class Sort extends BaseFilter
if ($table instanceof 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);
@@ -248,6 +254,7 @@ class Sort extends BaseFilter
$methodToUse = "sortString";
}
}
+
$table->sort(array($this, $methodToUse), $this->columnToSort);
}
}