function _heartbeat_messages_format_interval in Heartbeat 6.3
Helper function
1 call to _heartbeat_messages_format_interval()
- _heartbeat_build_block in ./
heartbeat.module - Helper function that wraps the template functions
File
- ./
heartbeat.common.inc, line 119 - Commonly functions used in heartbeat
Code
function _heartbeat_messages_format_interval($messages) {
$content = '';
$date_format = variable_get("heartbeat_activity_date_format", "Y-m-d H:i:s");
$show_time = variable_get('heartbeat_show_message_times', 1);
$ago = t('ago');
$i = 0;
foreach ($messages as $key => $message) {
$message_date = format_interval($_SERVER['REQUEST_TIME'] - $message->timestamp, 1, 'nl');
$content .= '<div class="heartbeat-message-block ' . ($i % 2 ? 'odd' : 'even') . '">';
$content .= '<span class="beat-item">' . $message->message . '</span>';
// Don't show time if the message is a merged message
if ($show_time) {
if ($message->target_count <= 1 || variable_get('heartbeat_show_time_grouped_items', 1)) {
$content .= '<span class="heartbeat_times"> ' . $message_date . ' ' . $ago . '</span> ';
}
}
if (!empty($message->concat_args['flags'])) {
$content .= '<div>';
$extras = array();
foreach ($message->concat_args['flags'] as $flagname) {
$extras[] = flag_create_link($flagname, $message->uaid);
}
$content .= implode(' - ', $extras);
$content .= '</div>';
}
$content .= '</div>';
$i++;
}
return $content;
}