X-Git-Url: http://git.roojs.org/?p=Pman.Admin;a=blobdiff_plain;f=GroupRights.php;h=6275f2c2a8189e7dd40153a22665b04cd77baf16;hp=f4be60735944dadf7fb416b96bfd73cacbe62183;hb=HEAD;hpb=1ad29c9ddddacd9e06168587ae161b6486564fdd diff --git a/GroupRights.php b/GroupRights.php index f4be607..0dbd455 100644 --- a/GroupRights.php +++ b/GroupRights.php @@ -12,7 +12,7 @@ class Pman_Admin_GroupRights extends Pman parent::getAuth(); // load company! $au = $this->getAuthUser(); if (!$au) { - $this->jerr("Not authenticated", array('authFailure' => true)); + $this->jerror("LOGIN-NOAUTH", "Not authenticated", array('authFailure' => true)); } if ($au->company()->comptype !='OWNER') { @@ -75,7 +75,7 @@ class Pman_Admin_GroupRights extends Pman $cur[$k] = clone($gr); } - $shortname = explode('.',$k); + $short = explode('.',$k); $ar[] = array( 'id' => $cur[$k]->id * 1, // 'rightname' => $k, @@ -83,28 +83,20 @@ class Pman_Admin_GroupRights extends Pman 'accessmask' => $cur[$k]->accessmask, 'FullMask' => $defdata[0], 'group_id' => (int)$_GET['group_id'], - 'shortname' => $shortname[0]; + 'shortname' => $short[0] ); } + + if (isset($_GET['_sort'])) { + foreach ($ar as $key => $row) { + $shortname[$key] = $row['shortname']; + $descript[$key] = $row['descript']; + } - foreach ($ar as $key => $row) { - $shortname[$key] = $row['shortname']; - $descript[$key] = $row['descript']; + array_multisort($shortname, SORT_ASC, $descript, SORT_ASC, $ar); } - - // Sort the data with volume descending, edition ascending - array_multisort($shortname, SORT_ASC, $descript, SORT_ASC, $ar); - //print_r($ar); exit; - /* - usort($ar, function($a, $b) { - $rdiff = $a['rightname'] - $b['rightname']; - if ($rdiff) return $rdiff; - return $a['descript'] - $b['descript']; - }); - */ - print_r($ar);exit; $this->jdata($ar);