You are here

function theme_spaces_dashboard_users in Spaces 5

Same name and namespace in other branches
  1. 5.2 spaces_dashboard/spaces_dashboard.module \theme_spaces_dashboard_users()

File

spaces_dashboard/spaces_dashboard.module, line 317

Code

function theme_spaces_dashboard_users($form) {
  $row = array();
  $labels[] = $form['groups']['#title'];
  $labels[] = $form['actions']['#title'];
  $labels[] = '';
  unset($form['groups']['#title']);
  unset($form['actions']['#title']);
  $row[] = drupal_render($form['groups']);
  $row[] = drupal_render($form['actions']);
  $row[] = drupal_render($form['submit']);
  $output .= theme('table', $labels, array(
    $row,
  ));

  // Overview table:
  $header = array(
    theme('table_select_header_cell'),
    t('Name'),
    t('User Info'),
  );
  if (isset($form['username']) && is_array($form['username'])) {
    foreach (element_children($form['username']) as $key) {
      $groups = $groupnames = array();
      foreach ($form['#accounts'][$key]->og_groups as $gid => $node) {
        $groupnames[] = $node['title'];
        $groups[] = 'og-' . $gid;
      }
      $groups = implode(' ', $groups);
      $groupnames = "<div class='groupnames'>" . implode(', ', $groupnames) . "</div>";
      $row = array();
      $row[] = drupal_render($form['users'][$key]);
      $row[] = array(
        'data' => drupal_render($form['username'][$key]),
        'class' => 'name',
      );
      $row[] = drupal_render($form['email'][$key]) . $groupnames;

      // $row[] = $form['#accounts'][$key]->status ? t('Active') : t('Blocked');
      $rows[] = array(
        'data' => $row,
        'class' => $groups . ($form['#accounts'][$key]->status ? '' : ' blocked'),
      );
    }
  }
  else {
    $rows[] = array(
      array(
        'data' => t('No users found.'),
        'colspan' => '4',
      ),
    );
  }
  $output .= theme('table', $header, $rows);
  if ($form['pager']['#value']) {
    $output .= drupal_render($form['pager']);
  }
  $output .= drupal_render($form);
  return $output;
}