|
|
@@ -116,6 +116,19 @@ class Schema_AccessGroupStorageAcl extends Core_AclBase {// Read only class
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ $orderBy = strtolower(V::get('order_by', 'id', $params));
|
|
|
+ $orderDir = strtolower(V::get('order_dir', 'desc', $params));
|
|
|
+ if (!in_array($orderBy, ['id', 'name', 'uid'])) throw new HttpException("Bad Request - wrong or missing order by", 400);
|
|
|
+ if (!in_array($orderDir, ['desc', 'asc'])) throw new HttpException("Bad Request - wrong or missing order dir", 400);
|
|
|
+ usort($items, function ($a, $b) use ($orderBy, $orderDir) {
|
|
|
+ if ('desc' == $orderDir) {
|
|
|
+ return (V::geti($orderBy, '', $a) > V::geti($orderBy, '', $b)) ? -1 : 1;
|
|
|
+ } else if ('asc' == $orderDir) {
|
|
|
+ return (V::geti($orderBy, '', $a) > V::geti($orderBy, '', $b)) ? 1 : -1;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ });
|
|
|
+
|
|
|
if($DBG>2){echo 'C.'.get_class($this).' L.' . __LINE__ . " getItems \$items:";print_r($items);echo "\n";}
|
|
|
return $items;
|
|
|
}
|