You are here

function taxonomy_access_admin in Taxonomy Access Control 7

Same name and namespace in other branches
  1. 5.2 taxonomy_access_admin.inc \taxonomy_access_admin()
  2. 6 taxonomy_access.admin.inc \taxonomy_access_admin()

Page callback: Renders the TAC permissions administration overview page.

Return value

Form to render.

See also

taxonomy_access_menu()

1 string reference to 'taxonomy_access_admin'
taxonomy_access_menu in ./taxonomy_access.module
Implements hook_menu().

File

./taxonomy_access.admin.inc, line 16
Administrative interface for taxonomy access control.

Code

function taxonomy_access_admin() {
  $roles = _taxonomy_access_user_roles();
  $active_rids = db_query('SELECT rid FROM {taxonomy_access_default} WHERE vid = :vid', array(
    ':vid' => TAXONOMY_ACCESS_GLOBAL_DEFAULT,
  ))
    ->fetchCol();
  $header = array(
    t('Role'),
    t('Status'),
    t('Operations'),
  );
  $rows = array();
  foreach ($roles as $rid => $name) {
    $row = array();
    $row[] = $name;
    if (in_array($rid, $active_rids)) {

      // Add edit operation link for active roles.
      $row[] = array(
        'data' => t('Enabled'),
      );
    }
    else {

      // Add enable link for unconfigured roles.
      $row[] = array(
        'data' => t('Disabled'),
      );
    }
    $row[] = array(
      'data' => l(t("Configure"), TAXONOMY_ACCESS_CONFIG . "/role/{$rid}/edit", array(
        'attributes' => array(
          'class' => array(
            'module-link',
            'module-link-configure',
          ),
        ),
      )),
    );
    $rows[] = $row;
  }
  $build['role_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
  );
  return $build;
}