You are here

function theme_privatemsg_message_table in Privatemsg 5.3

Same name and namespace in other branches
  1. 5 privatemsg.module \theme_privatemsg_message_table()
1 theme call to theme_privatemsg_message_table()
privatemsg_list_form in ./privatemsg.module

File

./privatemsg.module, line 2238

Code

function theme_privatemsg_message_table($form) {
  $rows = array();
  foreach (element_children($form) as $key) {
    if ($key != 'current_folder') {
      $classes = array(
        'pm-' . drupal_strtolower(preg_replace('/[^\\w]+/i', '_', $form[$key]['type']['#value'])),
      );
      if ($form[$key]['#new']) {
        $classes[] = 'pm-new';
      }
      $rows[] = array(
        'data' => array(
          drupal_render($form[$key]['selected']),
          drupal_render($form[$key]['avatar']),
          $form[$key]['user']['#value'],
          array(
            'data' => $form[$key]['subject']['#value'],
            'width' => '50%',
          ),
          array(
            'data' => $form[$key]['date']['#value'],
            'nowrap' => 'nowrap',
          ),
        ),
        'class' => implode(' ', $classes),
      );
    }
  }
  if (count($rows) == 0) {
    $rows[] = array(
      array(
        'data' => t('No messages.'),
        'colspan' => 5,
      ),
    );
    $select_cell = NULL;
  }
  else {
    $select_cell = theme('table_select_header_cell');
  }
  $header = _privatemsg_list_header($form['current_folder']['#value']);
  array_unshift($header, $select_cell);
  return theme('table', $header, $rows, array(
    'id' => 'privatemsg_message_table',
  ));
}