You are here

function theme_simple_access_form in Simple Access 5.2

Same name and namespace in other branches
  1. 5 simple_access.module \theme_simple_access_form()
  2. 6.2 simple_access.theme.inc \theme_simple_access_form()
  3. 7.2 simple_access.theme.inc \theme_simple_access_form()
4 theme calls to theme_simple_access_form()
simple_access_action_group_grant_form in inc/workflow_ng.inc
Configure grant group permissions
simple_access_action_group_revoke_form in inc/workflow_ng.inc
Configure revoke group permissions
simple_access_form in ./simple_access.module
simple_access_profile_form in ./simple_access.module

File

./simple_access.module, line 446
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 theme_simple_access_form($form) {
  drupal_add_css(drupal_get_path('module', 'simple_access') . '/simple_access.css');
  $output = '';
  $variable = variable_get('sa_display', array(
    'view' => 1,
  ));
  $head = array(
    t('Access Group'),
  );
  if ($variable['view'] || isset($form['#admin'])) {
    $head[] = t('View');
  }
  if ($variable['update'] || isset($form['#admin'])) {
    $head[] = t('Update');
  }
  if ($variable['delete'] || isset($form['#admin'])) {
    $head[] = t('Delete');
  }
  foreach (element_children($form) as $gid) {
    if (!isset($form['#access']) || $form['#access']) {
      $row = array(
        array(
          'data' => drupal_render($form[$gid]['name']),
        ),
      );
      if ($variable['view'] || isset($form['#admin'])) {
        $row[] = array(
          'data' => drupal_render($form[$gid]['sa_view']),
        );
      }
      if ($variable['update'] || isset($form['#admin'])) {
        $row[] = array(
          'data' => drupal_render($form[$gid]['sa_update']),
        );
      }
      if ($variable['delete'] || isset($form['#admin'])) {
        $row[] = array(
          'data' => drupal_render($form[$gid]['sa_delete']),
        );
      }
      $rows[] = $row;
    }
  }
  if (!empty($rows)) {
    $output .= theme('table', $head, $rows);
    $output .= drupal_render($form);
    return $output;
  }
}