JAuthorization/get group parents
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]
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[edit]
libraries/joomla/user/authorization.php
Importing[edit]
jimport( 'joomla.user.authorization' );
Source Body[edit]
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 transcluded page call, red link never existed >
Examples[edit]
Code Examples[edit]