function theme_views_fb_discussion in Drupal for Facebook 5
Same name and namespace in other branches
- 5.2 fb_views.module \theme_views_fb_discussion()
- 6.3 fb_views/fb_views.module \theme_views_fb_discussion()
- 6.2 fb_views/fb_views.module \theme_views_fb_discussion()
- 7.3 fb_views/fb_views.module \theme_views_fb_discussion()
File
- ./
fb_views.module, line 126
Code
function theme_views_fb_discussion($view, $nodes, $type) {
//drupal_set_message("theme_views_fb_discussion, type is '$type'" . dprint_r($view, 1) . dprint_r($nodes, 1)); // debug
if ($type == 'page') {
// use tablesort code to generate the sort links.
$sorts = array();
$ts = tablesort_init($view->table_header);
foreach ($view->table_header as $cell) {
$th = tablesort_header($cell, $view->table_header, $ts);
$sorts[] = $th['data'];
}
$output .= theme('sortable_header_links', $sorts);
$output .= theme('fb_discussion_nodes', $view, $nodes);
}
else {
if ($type == 'block') {
// If were displaying in a block, its most likely the profile page, where
// all styles have to be inline. So here we do our best to mimic the
// block view of a facebook discussion.
foreach ($nodes as $data) {
$reply_count = format_plural($data->node_comment_statistics_comment_count + 1, '1 post', '@count posts');
$output .= '<div style="padding: 10px 20px 10px 5px; border-bottom: 1px solid #cccccc;">';
$output .= '<div style="font-weight: bold; font-size: 10px;">' . l($data->node_title, 'node/' . $data->nid, array(), NULL, NULL, FALSE) . "</div><div style=\"font-size: 9px;\"><span style=\"color: #333333;\">{$reply_count}</span><span style=\"color: #888888; margin-left: 5px;\">Updated " . format_interval(time() - $data->node_comment_statistics_last_comment_timestamp) . " ago.</span></div>\n";
$output .= "</div>\n";
}
}
}
return $output;
}