Updates to ORM sub records and change Sort::MAsort, sortby is now an array
This commit is contained in:
@@ -19,9 +19,9 @@ abstract class lnApp_Sort {
|
||||
* @param boolean Whether to reverse sort.
|
||||
* @return array Sorted multi demension array.
|
||||
*/
|
||||
public static function MAsort(&$data,$sortby,$rev=0) {
|
||||
public static function MAsort(&$data,array $sortby=array(),$rev=0) {
|
||||
// if the array to sort is null
|
||||
if (! $data)
|
||||
if (! $data OR ! $sortby)
|
||||
return;
|
||||
// if the array to sort is null or empty, or our sortby is bad
|
||||
# if (! preg_match('/^([a-zA-Z0-9_]+(\([a-zA-Z0-9_,]*\)(->[a-zA-Z0-9])?)?,?)+$/',$sortby) || ! $data)
|
||||
@@ -29,7 +29,7 @@ abstract class lnApp_Sort {
|
||||
|
||||
$code = '$c=0;';
|
||||
|
||||
foreach (explode(',',$sortby) as $key) {
|
||||
foreach ($sortby as $key) {
|
||||
$code .= 'if (is_object($a) || is_object($b)) {';
|
||||
foreach (array('a','b') as $x) {
|
||||
$code .= 'if (is_array($'.$x.'->'.$key.')) {';
|
||||
|
Reference in New Issue
Block a user