Esempio n. 1
0
 private static function getGroupPath($groupId)
 {
     if (empty(JAccess::$_userGroups)) {
         $db = JFactory::getDBO();
         $query = "SELECT parent.id, parent.lft, parent.rgt\n                      FROM #__core_acl_aro_groups AS parent ORDER BY parent.lft";
         $db->setQuery($query);
         JAccess::$_userGroups = $db->loadObjectList('id');
     }
     if (!array_key_exists($groupId, JAccess::$_userGroups)) {
         return array();
     }
     if (!isset(JAccess::$_userGroupPaths[$groupId])) {
         JAccess::$_userGroupPaths[$groupId] = array();
         foreach (JAccess::$_userGroups as $group) {
             if ($group->lft <= JAccess::$_userGroups[$groupId]->lft && $group->rgt >= JAccess::$_userGroups[$groupId]->rgt) {
                 JAccess::$_userGroupPaths[$groupId][] = $group->id;
             }
         }
     }
     return JAccess::$_userGroupPaths[$groupId];
 }