You are here

function theme_taxonomy_access_admin in Taxonomy Access Control 5.2

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

Renders the main page of category permissions

1 call to theme_taxonomy_access_admin()
taxonomy_access_admin in ./taxonomy_access_admin.inc
Menu callback; presents the category permissions page of TAC (admin/user/taxonomy_access).

File

./taxonomy_access_admin.inc, line 42
Administrative interface for taxonomy access control.

Code

function theme_taxonomy_access_admin() {
  $roles = _taxonomy_access_user_roles();

  // Render role/permission overview:
  $header = array(
    t('Role'),
    array(
      'data' => ' ',
    ),
  );
  $rows = array();
  $result = db_query('SELECT rid FROM {term_access_defaults} WHERE vid=0 ');
  $active = array();
  while ($role = db_fetch_array($result)) {
    $active[$role['rid']] = TRUE;
  }
  foreach ($roles as $rid => $name) {
    $ops = array();
    if ($active[$rid]) {

      //only allow delete for "extra" roles
      if ($rid > 2) {
        $ops[] = l(t("disable"), "admin/user/taxonomy_access/delete/{$rid}");
      }
      $ops[] = l(t("edit"), "admin/user/taxonomy_access/edit/{$rid}");
    }
    else {
      $ops = array(
        l(t("enable"), "admin/user/taxonomy_access/edit/{$rid}"),
      );
    }
    $rows[] = array(
      $name,
      array(
        'data' => implode(' | ', $ops),
        'align' => 'right',
      ),
    );
  }
  return theme('table', $header, $rows);
}