mirror of
https://git.steelants.cz/SH/PHP_SMART_HOME_V3.git
synced 2026-10-11 17:54:34 +00:00
Fix sorting room, fix form sending after sorting and add column Historie
This commit is contained in:
1 parent
64b50ead9f
commit
b5b2bb95a7
9 files changed
+58
-26
No files matched your search
+22
-11
@@ -187,20 +187,31 @@ class Utilities
|
||||
* @param string $operator ('asc'/'desc')
|
||||
* @return void
|
||||
*/
|
||||
static function sortArrayByKey($data = [], $key, $operator = "asc"){
|
||||
if ($operator == "asc")
|
||||
{
|
||||
uasort($data, function($a, $b) use ($key){
|
||||
if ($a[$key] == $b[$key]) return 0;
|
||||
return ($a[$key] < $b[$key]) ? -1 : 1;
|
||||
static function sortArrayByKey($data = [], $key, $operator = "asc")
|
||||
{
|
||||
if ($operator == "asc") {
|
||||
uasort($data, function ($a, $b) use ($key) {
|
||||
$SortA = $a[$key];
|
||||
$SortB = $b[$key];
|
||||
if ($key == "room_id") {
|
||||
$SortA = RoomManager::getRoomName($SortA);
|
||||
$SortB = RoomManager::getRoomName($SortB);
|
||||
}
|
||||
if ($SortA == $SortB) return 0;
|
||||
return ($SortA < $SortB) ? -1 : 1;
|
||||
});
|
||||
} else{
|
||||
uasort($data, function($a, $b) use ($key){
|
||||
if ($a[$key] == $b[$key]) return 0;
|
||||
return ($a[$key] > $b[$key]) ? -1 : 1;
|
||||
} else {
|
||||
uasort($data, function ($a, $b) use ($key) {
|
||||
$SortA = $a[$key];
|
||||
$SortB = $b[$key];
|
||||
if ($key == "room_id") {
|
||||
$SortA = RoomManager::getRoomName($SortA);
|
||||
$SortB = RoomManager::getRoomName($SortB);
|
||||
}
|
||||
if ($SortA == $SortB) return 0;
|
||||
return ($SortA > $SortB) ? -1 : 1;
|
||||
});
|
||||
}
|
||||
return $data;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user