You are here

function simple_access_page_overview in Simple Access 5

Same name and namespace in other branches
  1. 5.2 simple_access.module \simple_access_page_overview()
  2. 6.2 simple_access.admin.inc \simple_access_page_overview()
  3. 7.2 simple_access.admin.inc \simple_access_page_overview()
1 string reference to 'simple_access_page_overview'
simple_access_menu in ./simple_access.module
Implementation of hook_menu().

File

./simple_access.module, line 328
This module allows administrators to make nodes viewable by specific 'access groups'. Each access group can contain any number of roles. If a node is not assigned to any access groups, it will remain viewable by all users.

Code

function simple_access_page_overview() {
  if (count($rg = simple_access_get_groups())) {
    drupal_set_title(t('Access Groups'));
    $header = array(
      t('Group'),
      t('Roles'),
      t('Operations'),
    );
    $roles = user_roles();
    foreach ($rg as $g) {
      $gid = $g['gid'];
      $rows[$gid]['group'] = $g['name'];
      $r = array();
      foreach ($g['roles'] as $rid) {
        $r[] = $roles[$rid];
      }
      $rows[$gid]['roles'] = "<span style='font-size:xx-small'>" . implode(', ', $r) . "</span>";
      $rows[$gid]['ops'] = l('edit', 'admin/user/simple_access/edit/' . $gid) . '&nbsp;' . l('delete', 'admin/user/simple_access/delete/' . $gid);
    }
    $output .= theme('table', $header, $rows, array(
      'style' => 'width:100%',
    ));
    $output .= '<br />' . l(t('add another access group'), 'admin/user/simple_access/add');
    return $output;
  }
  else {
    drupal_set_message(t('You have not yet defined any access groups.'));
    drupal_goto('admin/user/simple_access/add');
  }
}