API15:JAuthorization/is group child of
From Joomla! Documentation
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.
Description:JAuthorization/is group child of
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(); }
[Edit See Also] SeeAlso:JAuthorization/is group child of
Examples
<CodeExamplesForm />
