You are here

function theme_userprotect_protections_bypass in User protect 7

Same name and namespace in other branches
  1. 5 userprotect.module \theme_userprotect_protections_bypass()
  2. 6 userprotect.module \theme_userprotect_protections_bypass()

Themes the protected users table.

Parameters

array $variables: Contains the form to theme.

Return value

string An HTML string representing the constructed form.

File

./userprotect.admin.inc, line 156
Administration functions for userprotect module.

Code

function theme_userprotect_protections_bypass($variables) {
  $form = $variables['form'];
  $rows = array();

  // Build the row for each user.
  if (isset($form['user'])) {
    foreach (element_children($form['user']) as $uid) {
      $row = array();
      $row[] = drupal_render($form[$uid]['name']);

      // Build the protections for the user row.
      foreach ($form['#protections'] as $protection) {
        $row[] = drupal_render($form['protection'][$uid][$protection]);
      }
      $row[] = drupal_render($form[$uid]['operations']);
      $rows[] = $row;
    }
  }

  // Add the last row with the add textfield.
  $rows[] = array(
    array(
      'data' => drupal_render($form['up_add']),
      'colspan' => strval(count($form['#header']) - 1),
    ),
    array(
      'data' => drupal_render($form['up_add_text']),
      'colspan' => '1',
    ),
  );

  // Theme the table.
  $output = theme('table', array(
    'header' => $form['#header'],
    'rows' => $rows,
  ));
  $output .= drupal_render_children($form);
  return $output;
}