You are here

function activity_table in Activity 5.3

Menu callback to display the records in a page

2 calls to activity_table()
activity_page in ./activity.module
buddylistactivity_page in contrib/buddylistactivity/buddylistactivity.module

File

./activity.module, line 487
Activity module: Allow users to see their friends' activity on the site.

Code

function activity_table($activities) {
  global $user;
  $display_headers = array(
    'created' => array(
      'field' => 'created',
      'data' => t('Date'),
    ),
    //t('Visible to'),
    t('Message'),
  );
  $rows = array();
  foreach ($activities as $activity) {
    if ($activity['target_uid'] == ACTIVITY_ALL) {
      $visible_to = t('Everyone');
    }
    else {
      if ($activity['target_uid'] == $user->uid) {
        $visible_to = t('You');
      }
      else {

        // TODO: if this column gets reinstated load the user information differently
        $visible_to = theme('username', user_load(array(
          'uid' => $activity['target_uid'],
        )));
      }
    }
    if ($activity_message = activity_token_replace($activity)) {
      $rows[] = array(
        format_date($activity['created'], 'small'),
        //$visible_to,
        theme('activity', $activity_message, $activity),
      );
    }
  }
  $output = theme('table', $display_headers, $rows);
  $output .= theme('pager');
  return $output;
}