You are here

function theme_activity in Activity 6

Same name and namespace in other branches
  1. 5.4 activity.module \theme_activity()
  2. 5.3 activity.module \theme_activity()

Theme function for individual activity message.

5 theme calls to theme_activity()
activity_block in ./activity.module
Implementation of hook_block().
activity_user in ./activity.module
Implementation of hook_user().
ogactivity_block in contrib/ogactivity/ogactivity.module
create a block for display
theme_activity_table in ./activity.module
Theme function for displaying a table of activities.
user_relationshipsactivity_block in contrib/user_relationshipsactivity/user_relationshipsactivity.module
Implementation of hook_block().

File

./activity.module, line 1339
activity.module

Code

function theme_activity($message, $item) {
  $output = '';
  if (isset($item['mark'])) {
    $output = $item['mark'] . '<span class="activity activity-module-' . $item['module'] . ' activity-type-' . $item['type'] . ' activity-operation-' . $item['operation'] . '">' . $message . '</span>';
  }
  $output .= '<span class="activity-links">';

  // If user has permission to create an activity comment then show link to add comment
  // Click here displays the activity comment form.
  if (user_access('create activity comments')) {

    // Also note that the js looks for this specific class name 'activity-comments-click-to-show', so don't remove it
    $output .= '&nbsp;&ndash;&nbsp;<span class="activity-comments-click-to-show">' . t('Comment') . '</span>';
  }

  // If the user has permission to delete the activity record, display the delete link
  if ($item['delete-link']) {
    $output .= '&nbsp;&nbsp;' . $item['delete-link'];
  }
  $output .= '</span>';
  if (user_access('create activity comments')) {
    drupal_add_js(drupal_get_path('module', 'activity') . '/activity_comments.js');
    $output .= '<div class="activity-comments-form-hidden">' . drupal_get_form('activity_comment_form', $item['aid']) . '</div>';
  }
  if ($item['comments']) {
    $comments = theme('activity_comments', $item['comments']);
    $output .= theme('item_list', $comments, NULL, 'ul', array(
      'class' => 'activity-comments-list',
    ));
  }
  return $output;
}