Code

Added function that sorts the list of given classes by priority.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Sep 2006 03:54:18 +0000 (03:54 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Sep 2006 03:54:18 +0000 (03:54 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4786 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_acl.inc

index 7bd9ba33f1c03eaa62b01d4b580be28d836e9bb2..dec421bec554a299818248ac8a34567b071c4ee5 100644 (file)
@@ -473,7 +473,28 @@ class acl extends plugin
     return ($smarty->fetch (get_template_path('acl.tpl')));
   }
 
-  
+  function sort_by_priority($list)
+  {
+    $tmp= get_global('plist');
+    $plist= $tmp->info;
+    asort($plist);
+
+    foreach($list as $name => $translation){
+      $na  =  preg_replace("/^.*\//","",$name);
+      $prio=  $plist[$na]['plPriority'] ;
+
+      $newSort[$name] = $prio;
+    }
+
+    asort($newSort);
+
+    $ret = array();
+    foreach($newSort as $name => $prio){
+      $ret[$name] = $list[$name];
+    }
+    return($ret);
+  }
+
   function buildAclSelector($list)
   {
     $display= "<input type='hidden' name='acl_dummy_0_0_0' value='1'>";
@@ -483,6 +504,8 @@ class acl extends plugin
     asort($plist);
 
     /* Build general objects */
+
+    $list =$this->sort_by_priority($list);
     foreach ($list as $key => $name){
 
       /* Create sub acl if it does not exist */