Actions

API15

JAuthorization/get group parents

From Joomla! Documentation

< API15:JAuthorization
Revision as of 08:44, 12 May 2013 by JoomlaWikiBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Contents

Syntax

get_group_parents($group_id, $group_type= 'ARO', $recurse= 'NO_RECURSE')
Parameter Name Default Value Description
$group_id
$group_type 'ARO'
$recurse 'NO_RECURSE'

Defined in

libraries/joomla/user/authorization.php

Importing

jimport( 'joomla.user.authorization' );

Source Body

function get_group_parents($group_id, $group_type = 'ARO', $recurse = 'NO_RECURSE')
{
        $this->debug_text("get_group_parents(): Group_ID: $group_id Group Type: $group_type Recurse: $recurse");
 
        switch (strtolower(trim($group_type))) {
                case 'axo':
                        $group_type = 'axo';
                        $table = $this->_db_table_prefix .'axo_groups';
                        break;
                default:
                        $group_type = 'aro';
                        $table = $this->_db_table_prefix .'aro_groups';
        }
 
        if (empty($group_id)) {
                $this->debug_text("get_group_parents(): ID ($group_id) is empty, this is required");
                return FALSE;
        }
 
        $query = '
                        SELECT          g2.id
                        FROM            '. $table .' g1';
 
        //FIXME-mikeb: Why is group_id in quotes?
        switch (strtoupper($recurse)) {
                case 'RECURSE':
                        $query .= '
                        LEFT JOIN       '. $table .' g2 ON g1.lft > g2.lft AND g1.lft < g2.rgt
                        WHERE           g1.id='.(int) $group_id;
                        break;
                case 'RECURSE_INCL':
                        // inclusive resurse
                        $query .= '
                        LEFT JOIN       '. $table .' g2 ON g1.lft >= g2.lft AND g1.lft <= g2.rgt
                        WHERE           g1.id='.(int) $group_id;
                        break;
                default:
                        $query .= '
                        WHERE           g1.parent_id='.(int) $group_id;
        }
 
        $query .= '
                        ORDER BY        g2.lft';
 
 
        $this->db->setQuery( $query );
        return $this->db->loadResultArray();
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />