Пример #1
0
// check for groupscope and globalscope
if ($globalscope = $gperm_handler->checkRight("view_globalscope", $fid, $groups, $mid)) {
    // get all groups
    // need to make option array with values as gids and text as names of groups
    $allgroups =& $member_handler->getGroups();
    for ($i = 0; $i < count($allgroups); $i++) {
        if (in_array($allgroups[$i]->getVar('groupid'), $groupsWithViewForm)) {
            $availgroups[$allgroups[$i]->getVar('groupid')] = $allgroups[$i]->getVar('name');
        }
    }
} elseif ($groupscope = $gperm_handler->checkRight("view_groupscope", $fid, $groups, $mid)) {
    // get all groups the groups the user is a member of (except registered users)
    // check permission table for the existing forced groupscope selections, if any
    include_once XOOPS_ROOT_PATH . "/modules/formulize/class/usersGroupsPerms.php";
    $formulize_permHandler = new formulizePermHandler($fid);
    $groupScopeGroups = $formulize_permHandler->getGroupScopeGroups($groups);
    // returns false if none found, otherwise, array of id=>name, based on groups selected in permission UI for this form
    if ($groupScopeGroups !== false) {
        $availgroups = $groupScopeGroups;
    } else {
        for ($i = 0; $i < count($groups); $i++) {
            $thisgroup =& $member_handler->getGroup($groups[$i]);
            if (in_array($groups[$i], $groupsWithViewForm)) {
                $availgroups[$groups[$i]] = $thisgroup->getVar('name');
            }
        }
    }
} else {
    exit("Error: no advanced scope permission detected.");
}
include_once XOOPS_ROOT_PATH . "/class/xoopsformloader.php";