You are here

function activity_page in Activity 5.2

Same name and namespace in other branches
  1. 5.4 activity.module \activity_page()
  2. 5 activity.module \activity_page()
  3. 5.3 activity.module \activity_page()
  4. 6 activity.module \activity_page()

Menu callback to display the records in a page

1 call to activity_page()
activity_block in ./activity.module
create a block for display
1 string reference to 'activity_page'
activity_menu in ./activity.module
Implementation of hook_menu().

File

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

Code

function activity_page($uid) {
  $buddy_activity = activity_buddy_activity($uid);
  arsort($buddy_activity);
  $count = 0;
  if (!empty($buddy_activity)) {
    foreach ($buddy_activity as $ba) {
      if ($count < variable_get('activity_message_limit', 20)) {
        $offset = strftime("%j") + strftime("%Y") * 365 - (strftime("%j", $ba->timestamp) + strftime("%Y", $ba->timestamp) * 365);
        $timeset = $offset > 0 && $offset != $prev_offset ? '<h3>' . activity_format_offset($ba->timestamp) . '</h3>' : '';
        $activity = activity_token_replace($ba);
        if ($activity) {
          $items[] = $timeset . $activity . ' <span class="activity-time">' . date('g:ia', $ba->timestamp) . '</span> ';
        }
        $prev_offset = $offset;
      }
      $count++;
    }
    return theme('activity_page', $items);
  }
}