API15

JAuthorization/is group child of

From Joomla! Documentation

< API15:JAuthorization

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

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

Syntax[edit]

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[edit]

libraries/joomla/user/authorization.php

Importing[edit]

jimport( 'joomla.user.authorization' );

Source Body[edit]

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 transcluded page call, red link never existed >

Examples[edit]

Code Examples[edit]