';
$output .= '
'. theme('table', array(), $rows) .'
';
if (!empty($summary_links)) {
$output .= '
'. theme('item_list', $summary_links, t('Jump to:'), 'ul', array('class' => 'internal-links')) .'
';
}
$output .= '
';
return $output;
}
/**
* Generates internal page links for issue pages.
*
* @param $node
* The issue node.
* @return
* An array of internal page links.
*/
function project_issue_internal_links($node) {
$links = array();
if ($node->comment != COMMENT_NODE_DISABLED) {
// Link to the first unread, or most recent comment.
if (comment_num_new($node->nid)) {
// There are unread replies; link to first unread comment.
$links[] = l(t('First unread comment'), "node/$node->nid", array('fragment' => 'new'));
}
else {
// No unread replies; link to most recent comment.
$comment_cid = db_result(db_query_range("SELECT pic.cid FROM {project_issue_comments} pic INNER JOIN {node} n on pic.nid = n.nid WHERE n.status = 1 AND n.nid = %d ORDER BY pic.cid DESC", $node->nid, 0, 1));
if ($comment_cid) {
$links[] = l(t('Most recent comment'), "node/$node->nid", array('fragment' => "comment-$comment_cid"));
}
}
// Link for most recent patch.
$file_cid = db_result(db_query_range("SELECT cu.cid FROM {comment_upload} cu INNER JOIN {node} n on cu.nid = n.nid WHERE n.status = 1 AND n.nid = %d ORDER BY cu.fid DESC", $node->nid, 0, 1));
if ($file_cid) {
$links[] = l(t('Most recent attachment'), "node/$node->nid", array('fragment' => "comment-$file_cid"));
}
}
// Link straight to comment form.
if ($node->comment == COMMENT_NODE_READ_WRITE && (user_access('post comments') || user_access('post comments without approval'))) {
// TODO: This conditional needs to be ripped out in D6.
$comment_form_location = isset($node->project_issue['comment_form_location']) ? $node->project_issue['comment_form_location'] : variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE);
// Comment form isn't on the page, link to the comment reply page.
if ($comment_form_location == COMMENT_FORM_SEPARATE_PAGE) {
$links[] = l(t('Add new comment'), "comment/reply/$node->nid");
}
// Comment form is on the page, generate an internal page link for it.
else {
$links[] = l(t('Add new comment'), "node/$node->nid", array('fragment' => "comment-form"));
}
}
return $links;
}