You are here

function simple_access_page_overview in Simple Access 7.2

Same name and namespace in other branches
  1. 5.2 simple_access.module \simple_access_page_overview()
  2. 5 simple_access.module \simple_access_page_overview()
  3. 6.2 simple_access.admin.inc \simple_access_page_overview()

Simple Access Overview form.

1 string reference to 'simple_access_page_overview'
simple_access_menu in ./simple_access.module
Implements hook_menu().

File

./simple_access.admin.inc, line 12
House all the admin functions in inc to make the foot print a lot smaller.

Code

function simple_access_page_overview() {
  if (count($groups = simple_access_get_groups())) {
    drupal_set_title(t('Access groups'));
    $roles = user_roles();
    $form['groups'] = array(
      '#tree' => TRUE,
      '#theme' => 'simple_access_page_overview_list',
    );
    foreach ($groups as $group) {
      $gid = $group['gid'];
      $form['groups'][$gid]['name'] = array(
        '#markup' => $group['name'],
      );
      $r = array();
      foreach ($group['roles'] as $rid) {
        $r[] = $roles[$rid];
      }
      $form['groups'][$gid]['roles'] = array(
        '#markup' => implode(', ', $r),
      );
      $form['groups'][$gid]['weight'] = array(
        '#type' => 'weight',
        '#default_value' => $group['weight'],
        '#attributes' => array(
          'class' => array(
            'sa-group-weight',
          ),
        ),
      );
      $form['groups'][$gid]['ops'] = array(
        '#markup' => l(t('edit'), 'admin/config/content/simple-access/groups/' . $gid . '/edit') . ' ' . l(t('delete'), 'admin/config/content/simple-access/groups/' . $gid . '/delete'),
      );
    }
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Update'),
    );
    return $form;
  }
  else {
    drupal_set_message(t('You have not yet defined any access groups.'));
    drupal_goto('admin/config/content/simple-access/groups/add');
  }
}