示例#1
0
function LoadGroupRolesTable(&$targetTable, $firstIndex, $lastIndex)
{
    GetUsersOrGroupsByRole(false, ADMIN_ROLE, $groupsWithAdminRole);
    GetUsersOrGroupsByRole(false, AUTHOR_ROLE, $groupsWithAuthorRole);
    $targetTable = array();
    LoadGroupTable($groupTable, $firstIndex, $lastIndex, false);
    foreach ($groupTable as $groupKey => $groupVal) {
        // Create record for role data
        $groupRolesRec = new GroupRolesTableRecord();
        $targetTable[$groupKey] = $groupRolesRec;
        // For each role, record the group's role permission
        if (in_array($groupKey, $groupsWithAdminRole)) {
            $groupRolesRec->adminOn = true;
        } else {
            $groupRolesRec->adminOn = false;
        }
        if (in_array($groupKey, $groupsWithAuthorRole)) {
            $groupRolesRec->authorOn = true;
        } else {
            $groupRolesRec->authorOn = false;
        }
    }
}
示例#2
0
        CheckForPageSwitch();
        // Are we deleting a group?
        if (CheckForDeleteSelection() && DeleteGroup($selectedGroup)) {
            $confirmationMsg = sprintf($confSuccessfulDeletion, $selectedGroup);
        }
    } catch (MgException $e) {
        CheckForFatalMgException($e);
        $errorMsg = $e->GetExceptionMessage();
    } catch (Exception $e) {
        $errorMsg = $e->getMessage();
    }
    $groups = GetGroups();
    $groupCount = sizeof($groups);
    $currPage = GetPageNumber($groups, $selectedGroup, $pageSize);
    GetPageRange($currPage, $groupCount, $pageSize, $firstPageIndex, $lastPageIndex);
    LoadGroupTable($groupTable, $firstPageIndex, $lastPageIndex, true);
    if (!array_key_exists($selectedGroup, $groupTable) && $groupCount > 0) {
        $selectedGroup = $groups[$firstPageIndex];
    }
    if ($selectedGroup == MgGroup::Everyone) {
        if ($firstPageIndex + 1 <= $lastPageIndex) {
            $selectedGroup = $groups[$firstPageIndex + 1];
        } else {
            $selectedGroup = "";
        }
    }
    LoadGroupRolesTable($groupRolesTable, $firstPageIndex, $lastPageIndex);
} catch (MgException $e) {
    CheckForFatalMgException($e);
    if (empty($errorMsg)) {
        $errorMsg = $e->GetExceptionMessage();