You are here

function theme_book_access_permissions_form in Book access 6

Theme the permission tab added to each book.

1 theme call to theme_book_access_permissions_form()
book_access_permissions_form in ./book_access.admin.inc
Book access configuration page.

File

./book_access.admin.inc, line 300
Administration interface for the Book access module.

Code

function theme_book_access_permissions_form($form) {
  $header = array();
  $rows = array();
  if (isset($form['#rids'])) {
    foreach ($form['#rids'] as $key) {
      $row = array();
      $row[] = drupal_render($form['roles']['names'][$key]);
      $row[] = drupal_render($form['roles']['view'][$key]);
      $row[] = drupal_render($form['roles']['update'][$key]);
      $row[] = drupal_render($form['roles']['delete'][$key]);
      $row[] = ' ';
      $rows[] = $row;
    }
  }
  if (isset($form['#uids'])) {
    foreach ($form['#uids'] as $key) {
      $row = array();
      $row[] = drupal_render($form['users']['names'][$key]);
      $row[] = drupal_render($form['users']['view'][$key]);
      $row[] = drupal_render($form['users']['update'][$key]);
      $row[] = drupal_render($form['users']['delete'][$key]);
      $row[] = l(t('delete'), 'book_access/delete/user_permission/' . $form['#bid'] . "/{$key}");
      $rows[] = $row;
    }
  }
  $rows[] = array(
    drupal_render($form['user']['username']),
    drupal_render($form['user']['view']),
    drupal_render($form['user']['update']),
    drupal_render($form['user']['delete']),
    drupal_render($form['user']['add_user']),
  );
  $header[] = t('Role/user');
  $header[] = array(
    'data' => t('View this book'),
    'class' => 'book-access-view',
  );
  $header[] = array(
    'data' => t('Edit pages'),
    'class' => 'book-access-update',
  );
  $header[] = array(
    'data' => t('Delete pages'),
    'class' => 'book-access-delete',
  );
  $header[] = t('Operations');
  return theme('table', $header, $rows) . drupal_render($form);
}