MARK_NEW)); $options['fragment'] = 'new'; } $subject = $thread['subject']; if ($thread['has_tokens']) { $message = privatemsg_message_load($thread['thread_id']); $subject = privatemsg_token_replace($subject, array('privatemsg_message' => $message), array('sanitize' => TRUE, 'privatemsg-show-span' => FALSE)); } $field['data'] = l($subject, 'messages/view/' . $thread['thread_id'], $options) . $is_new; $field['class'][] = 'privatemsg-list-subject'; return $field; } /** * Theme the replies field. */ function theme_privatemsg_list_field__count($variables) { $thread = $variables['thread']; $field = array(); $field['data'] = $thread['count']; $options = array(); if (!empty($thread['is_new']) && $thread['is_new'] < $thread['count']) { $options['fragment'] = 'new'; $field['data'] .= '
' . l((format_plural($thread['is_new'], '(1 new)', '(@count new)')), 'messages/view/' . $thread['thread_id'], $options); } $field['class'][] = 'privatemsg-list-count'; return $field; } /** * Theme the last updated column. */ function theme_privatemsg_list_field__last_updated($variables) { $thread = $variables['thread']; $field['data'] = privatemsg_format_date($thread['last_updated']); $field['class'][] = 'privatemsg-list-date'; return $field; } /** * Theme the thread started column. */ function theme_privatemsg_list_field__thread_started($variables) { $thread = $variables['thread']; $field = array(); $field['data'] = privatemsg_format_date($thread['thread_started']); $field['class'][] = 'privatemsg-list-date-started'; return $field; } /** * Theme a block which displays the number of new messages a user has. */ function theme_privatemsg_new_block($count) { $count = $count['count']; if ($count == 0) { $text = t('Click here to go to your messages.'); } else { $text = format_plural($count, 'You have a new message! Click here to read it.', 'You have @count new messages! Click here to read them.'); } return l($text, 'messages', array('attributes' => array('id' => 'privatemsg-new-link'))); } /** * Used to theme and display user recipients. * * Wrapper for theme_username() with a few additional options. */ function theme_privatemsg_username($variables) { $recipient = $variables['recipient']; $options = $variables['options']; if (!isset($recipient->uid)) { $recipient->uid = $recipient->recipient; } if (!empty($options['plain'])) { $name = format_username($recipient); if (!empty($options['unique'])) { $name .= ' [user]'; } return $name; } else { return theme('username', array('account' => $recipient)); } } /** * Output the admin settings display fields and weight settings as a * drag and drop sortable table. */ function theme_privatemsg_admin_settings_display_fields($variables) { $element = $variables['element']; $header = array( array('data' => t('Field'), 'class' => array('field')), array('data' => t('Enable'), 'class' => array('enable')), array('data' => t('Weight'), 'class' => array('weight')), ); $rows = array(); foreach (element_children($element['privatemsg_display_fields']) as $child) { $row = array(); // Title. $row[] = array('data' => $element['privatemsg_display_fields'][$child]['#title'], 'class' => array('field')); unset($element['privatemsg_display_fields'][$child]['#title']); // Enable checkbox. $row[] = array('data' => drupal_render($element['privatemsg_display_fields'][$child]), 'class' => array('enable')); // Weight selector. unset($element['privatemsg_display_fields_weights'][$child]['#title']); $element['privatemsg_display_fields_weights'][$child]['#attributes']['class'] = array('privatemsg-display-fields-weight'); $row[] = array( 'data' => drupal_render($element['privatemsg_display_fields_weights'][$child]), 'class' => array('weight'), ); $rows[] = array('data' => $row, 'class' => array('draggable')); } if (!empty($rows)) { drupal_add_tabledrag('privatemsg-list-display-fields', 'order', 'sibling', 'privatemsg-display-fields-weight'); return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'privatemsg-list-display-fields'))) . drupal_render_children($element); } else { return drupal_render_children($element); } } /** * @} */