function _heartbeat_render_view in Heartbeat 6.4
Same name and namespace in other branches
- 6.3 views/heartbeat_views.module \_heartbeat_render_view()
Helper function to (re-)render the messages from views.
2 calls to _heartbeat_render_view()
- heartbeat_views_views_pre_render in views/
heartbeat_views.module - Implementation of hook_views_pre_render().
- heartbeat_views_views_pre_view in views/
heartbeat_views.module - Implementation of hook_views_pre_view().
File
- views/
heartbeat_views.module, line 112
Code
function _heartbeat_render_view(&$view) {
$name = $view->name . '_' . $view->current_display;
// Prepare info object
$stream = isset($view->filter['access_type']->stream) ? $view->filter['access_type']->stream : new stdClass();
if ($view->style_plugin
->uses_fields()) {
$field_handlers = array();
foreach ($view->field as $fieldname => $handler) {
$fieldalias = isset($handler->field_alias) && $handler->field_alias != 'unknown' ? $handler->field_alias : $handler->real_field;
$field_handlers[$fieldname] = $fieldalias;
}
}
$results = array();
foreach ($view->result as $row) {
// unset message types that where denied in stream access configuration
if (!isset($stream->messages_denied[$row->message_id])) {
$template = new HeartbeatMessageTemplate($row->hid, $row->message_id, $row->message_orig, $row->message_concat_orig, $row->concat_args);
$template->perms = $row->perms;
$template->custom = $row->custom;
$template->description = $row->description;
$template
->set_variables($row->variables_orig);
$template
->set_attachments($row->attachments);
$template
->set_roles(isset($template->concat_args['roles']) ? $template->concat_args['roles'] : array());
$heartbeatactivity = new HeartbeatActivity($row, $template);
$results[$row->uaid]->count = 1;
if (!empty($field_handlers)) {
foreach ($field_handlers as $fieldname => $fieldalias) {
if ($fieldname == 'counter') {
continue;
}
$heartbeatactivity->{$fieldalias} = $row->{$fieldalias};
}
}
$uses_ds = $view->style_plugin
->uses_row_plugin() && $view->style_plugin->row_plugin->definition['module'] == 'ds';
if ($uses_ds) {
$heartbeatactivity->content['message'] = $heartbeatactivity->message;
$heartbeatactivity->content['widgets'] = _theme_heartbeat_widgets($heartbeatactivity);
$heartbeatactivity->content['time_info'] = theme('heartbeat_time_ago', $heartbeatactivity);
$heartbeatactivity->content['buttons'] = theme('heartbeat_buttons', $heartbeatactivity);
}
$results[$row->uaid] = $heartbeatactivity;
}
}
if (isset($view->pager['items_per_page'])) {
$stream->limit_sql = $view->pager['items_per_page'];
}
$result = _heartbeat_group_views_messages($name, $results, $stream);
$view->result = $result;
}