function heartbeat_stream_more_link in Heartbeat 7
Helper function for a more link on streams (older messages) Should only be called when hasMoreMessages resulted to TRUE
1 call to heartbeat_stream_more_link()
- theme_activity_pager in ./
heartbeat.module - Returns HTML for a query pager for heartbeat activity.
File
- ./
heartbeat.module, line 1493 - Module file for heartbeat activity. Basic hook implementations and helper functions will be found here.
Code
function heartbeat_stream_more_link(HeartbeatStream $heartbeatStream, $offset_time, $absolute = FALSE) {
$attributes = array(
'html' => FALSE,
'attributes' => array(
'class' => array(
'heartbeat-older-messages',
),
),
);
$attributes['absolute'] = $absolute;
$content = '';
$content .= '<div class="heartbeat-more-messages-wrapper">';
// Override the viewer if possible.
$uid = $heartbeatStream
->getViewedId();
$is_page = (int) $heartbeatStream
->isPage();
// Ajax pager.
if ($heartbeatStream
->isAjax()) {
$attributes['attributes']['onclick'] = 'javascript:Drupal.heartbeat.getOlderMessages(this, {ajax: true, stream_name: "' . $heartbeatStream->config->name . '" ,stream_class: "' . $heartbeatStream->config->class . '" ,offset_time: ' . $offset_time . ',page:' . $is_page . ', uid: ' . $uid . ' }); return false;';
if (method_exists($heartbeatStream, 'getGroup')) {
$attributes['attributes']['class'][] = 'heartbeat-group-' . $heartbeatStream
->getGroup()->nid;
}
$content .= l(t('Older messages'), 'heartbeat/js/older', $attributes);
$content .= '<span class="heartbeat-messages-throbber"> </span>';
}
elseif ($is_page && !empty($heartbeatStream->config->stream_path)) {
$attributes['query'] = array(
'ajax' => FALSE,
'stream_name' => $heartbeatStream->config->name,
'stream_class' => $heartbeatStream->config->class,
'offset_time' => $offset_time,
'page' => $is_page,
'uid' => $uid,
);
$content .= l(t('Older messages'), $heartbeatStream->config->stream_path, $attributes);
$content .= '<span class="heartbeat-messages-throbber"> </span>';
}
// Link to the pages.
if (!$heartbeatStream
->isPage() && !empty($heartbeatStream->config->stream_path) && (!$heartbeatStream
->isAjax() || $heartbeatStream->config->block_show_pager == 3)) {
$path = $heartbeatStream->config->stream_path;
if (isset($attributes['attributes']['onclick'])) {
unset($attributes['attributes']['onclick']);
}
$fulllink = '<div class="more fullarchive heartbeat-full">' . l(t('Full list'), $path, $attributes) . '</div>';
$content .= $fulllink;
}
$content .= '</div>';
return $content;
}