/**
 * get group list
 *
 * @return array group list
 */
function xoonips_group_get_groups($uid, $gids = null)
{
    $xgroup_handler =& xoonips_gethandler('xoonips', 'group');
    $xmember_handler =& xoonips_gethandler('xoonips', 'member');
    $u_handler =& xoonips_getormhandler('xoonips', 'xoops_users');
    $is_admin = $xmember_handler->isAdmin($uid);
    $xg_objs =& $xgroup_handler->getGroupObjects($gids);
    $groups = array();
    foreach ($xg_objs as $xg_obj) {
        $gid = $xg_obj->get('gid');
        $gadmin_uids = $xgroup_handler->getUserIds($gid, true);
        $is_gadmin = in_array($uid, $gadmin_uids);
        $gadmins = array();
        foreach ($gadmin_uids as $gadmin_uid) {
            $u_obj =& $u_handler->get($gadmin_uid);
            if (!is_object($u_obj)) {
                continue;
            }
            $gadmins[] = array('uid' => $gadmin_uid, 'uname' => $u_obj->getVar('uname', 's'));
        }
        $groups[] = array('gid' => $gid, 'gname' => $xg_obj->get('gname', 's'), 'gdesc' => $xg_obj->get('gdesc', 's'), 'locked' => !xoonips_group_check_perm($gid), 'gadmins' => $gadmins, 'is_admin' => $is_admin || $is_gadmin);
    }
    return $groups;
}
        if (!$admin_xgroup_handler->createGroup($gname, $gdesc, $gadmin_uids, $gilimit, $gxlimit, $gslimit * 1000 * 1000)) {
            xoonips_group_error('editgroups.php', 'insert');
        }
        $op = '';
        break;
    case 'delete':
        if (!$xoopsGTicket->check(true, $ticket_area, false)) {
            redirect_header('editgroups.php', 3, $xoopsGTicket->getErrors());
            exit;
        }
        $gid = $formdata->getValue('post', 'gid', 'i', true);
        $xg_obj =& $admin_xgroup_handler->getGroupObject($gid);
        if (!is_object($xg_obj)) {
            xoonips_group_error('editgroups.php', 'select');
        }
        if (!xoonips_group_check_perm($gid, 'delete')) {
            xoonips_group_error('editgroups.php', 'lock_delete');
        }
        if (!$admin_xgroup_handler->deleteGroup($gid)) {
            xoonips_group_error('editgroups.php', 'delete');
        }
        $op = '';
        break;
}
if ($op == '') {
    $gid = 0;
    $gname = '';
    $gdesc = '';
    $gilimit = $xconfig_handler->getValue('group_item_number_limit');
    $gxlimit = $xconfig_handler->getValue('group_index_number_limit');
    $gslimit = $xconfig_handler->getValue('group_item_storage_limit') / 1000 / 1000;