public function views_matrix_plugin_style_matrix::compareRows in Views Matrix 7
Same name and namespace in other branches
- 8 includes/views_matrix_plugin_style_matrix.inc \views_matrix_plugin_style_matrix::compareRows()
Compares two matrix rows, according to the active click sort.
Parameters
mixed $a: The first row's y value.
mixed $b: The second row's y value.
Return value
int An integer less than, equal to or greater than 0, if $a should be ordered before, equally to or after $b, respectively.
File
- includes/
views_matrix_plugin_style_matrix.inc, line 336 - Class definition for views matrix plugin.
Class
- views_matrix_plugin_style_matrix
- @class Views Plugin Class
Code
public function compareRows($a, $b) {
if (isset($this->sort_weights[$a]) && is_string($this->sort_weights[$a])) {
$a_value = "{$this->sort_weights[$a]}";
}
else {
$a_value = "";
}
if (isset($this->sort_weights[$b]) && is_string($this->sort_weights[$b])) {
$b_value = "{$this->sort_weights[$b]}";
}
else {
$b_value = "";
}
$ret = strnatcmp($a_value, $b_value);
return $this->sort_asc ? $ret : -$ret;
}