You are here

function theme_activity_page in Activity 5

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

theme function for displaying the users activity page

2 theme calls to theme_activity_page()
activity_block in ./activity.module
create a block for display
activity_page in ./activity.module
Menu callback to display the records in a page

File

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

Code

function theme_activity_page($buddy_activity) {

  /*
   FORMAT:
    <h3>Today</h3>
    <ul class="activity-list">
      <li>Listening to my "Ultimate Britney Spears Playlist" on the iPod on the train. (via <a href="#">Twitter</a>) <span class="activity-time">10:00 pm</span></li>
      <li><a href="#">NateH</a> has added <a href="#">Webchick</a> to friends <span class="activity-time">9:00 pm</span></li>
      <li><a href="#">DanW</a> thinks you should be a fan of Justin Timberlake <a href="#">because</a> <span class="activity-time">8:00 pm</span></li>
    </ul>
  */
  $count = 0;
  arsort($buddy_activity);
  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_off($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('item_list', $items, NULL, 'ul', array(
      'class' => 'activity-list',
    ));
  }
  else {
    return '';
  }
}