Actions

API15

JAuthorization/is group child of

From Joomla! Documentation

< API15:JAuthorization
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

is_group_child_of($grp_src, $grp_tgt, $group_type='ARO')
Parameter Name Default Value Description
$grp_src
$grp_tgt
$group_type 'ARO'

Defined in

libraries/joomla/user/authorization.php

Importing

jimport( 'joomla.user.authorization' );

Source Body

function is_group_child_of( $grp_src, $grp_tgt, $group_type='ARO' )
{
        $db =& JFactory::getDBO();
 
        $this->debug_text("has_group_parent(): Source=$grp_src, Target=$grp_tgt, Type=$group_type");
 
        switch(strtolower(trim($group_type))) {
                case 'axo':
                        $table = $this->_db_table_prefix .'axo_groups';
                        break;
                default:
                        $table = $this->_db_table_prefix .'aro_groups';
                        break;
        }
 
        $query = 'SELECT COUNT(*) '.
                         'FROM '.$table.' AS g1 '.
                         'LEFT JOIN '.$table.' AS g2 ON (g1.lft > g2.lft AND g1.lft < g2.rgt) ';
 
        if (is_int( $grp_src ) && is_int($grp_tgt)) {
                $query .= 'WHERE g1.id = '.$grp_src.' AND g2.id = '.$grp_tgt;
        } else if (is_string( $grp_src ) && is_string($grp_tgt)) {
                $query .= 'WHERE g1.name = '.$db->Quote($grp_src).' AND g2.name = '.$db->Quote($grp_tgt);
        } else if (is_int( $grp_src ) && is_string($grp_tgt)) {
                $query .= 'WHERE g1.id = '.$grp_src.' AND g2.name = '.$db->Quote($grp_tgt);
        } else {
                $query .= 'WHERE g1.name = '.$db->Quote($grp_src).' AND g2.id = '.(int) $grp_tgt;
        }
 
        $db->setQuery($query);
 
        return $db->loadResult();
}

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

Examples

<CodeExamplesForm />