Source for file Subgroups.php
Documentation is available at Subgroups.php
require_once 'index.php';
echo '<h3>Subgroups</h3>';
$groups = $admin->perm ->getGroups ();
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
} elseif (empty ($groups)) {
echo 'Run the <strong>Group</strong> test first<br />';
$groups_with_subgroup = array ();
for ($i = 0; $i < 10; $i++ ) {
$groups_with_subgroup[] = $groups[$group]['group_id'];
'group_id' => $groups[$group]['group_id'],
'subgroup_id' => $groups[$subgroup]['group_id']
$assign = $admin->perm ->assignSubGroup ($data);
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
echo '<strong>' . $groups[$subgroup]['group_id'] . '</strong> is now
subgroup of <strong>'. $groups[$group]['group_id'] . '</strong><br />';
echo '<br /><br />All the groups with hierarchy mode on and rekey to true:<br />';
$groups = $admin->perm ->getGroups (
'group_id' => $groups_with_subgroup),
'subgroups' => 'hierarchy',
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
} elseif (empty ($groups)) {
echo 'No groups were found<br />';
Var_Dump ::display ($groups);
echo 'All the groups:<br />';
$groups = $admin->perm ->getGroups (array ('subgroups' => true ));
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
} elseif (empty ($groups)) {
echo 'No groups were found, thus we\'ve halted the rest of the test<br />';
Var_Dump ::display ($groups);
$filters = array ('group_id' => $groups[$id]['group_id']);
$unassign = $admin->perm ->unassignSubGroup ($filters);
if ($unassign === false ) {
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
echo 'Removed all records with the group id <strong>' . $groups[$id]['group_id'] . '</strong><br />';
$filters = array ('subgroup_id' => $groups[$id]['group_id']);
$unassign = $admin->perm ->unassignSubGroup ($filters);
if ($unassign === false ) {
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
echo 'Removed all records with the subgroup id <strong>' . $groups[$id]['group_id'] . '</strong><br />';
// By subgroup id and group id
'group_id' => $groups[$group]['group_id'],
'subgroup_id' => $groups[$subgroup]['group_id']
$unassign = $admin->perm ->unassignSubGroup ($filters);
if ($unassign === false ) {
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
echo 'Removed the record that has <strong>' . $groups[$group]['group_id'] . '</strong>
as group id and <strong>' . $groups[$subgroup]['group_id'] . '</strong> as subgroup id<br />';
echo '<br /><br />Test getParentGroup:<br />';
for ($i = 0; $i < 5; $i++ ) {
$result = $admin->perm ->getParentGroup ($groups[$subgroup]['group_id']);
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
echo 'Group <strong>' . $result['group_id'] . '</strong> is the parent group of <strong>' . $groups[$subgroup]['group_id'] . '</strong><br />';
echo '<br /><br />All the groups:<br />';
$groups = $admin->perm ->getGroups ();
echo '<strong>Error on line: '.__LINE__. '</strong><br />';
} elseif (empty ($groups)) {
echo 'No groups were found<br />';
Var_Dump ::display ($groups);
Documentation generated on Mon, 11 Mar 2019 14:16:45 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|