You are here

function _spaces_calendar_feed_links in Spaces 5

Same name and namespace in other branches
  1. 5.2 spaces_calendar/spaces_calendar.module \_spaces_calendar_feed_links()

Helper function to display feed links in calendar view footers

File

spaces_calendar/spaces_calendar.module, line 235

Code

function _spaces_calendar_feed_links() {
  $links = array();
  $gid = spaces_gid();
  $feedtype = variable_get('spaces_calendar_feed_nodetype', '');
  if ($gid && $feedtype) {
    $results = db_query("SELECT nr.title, n.nid\n      FROM {node} n\n        LEFT JOIN {node_revisions} nr ON n.vid = nr.vid\n        JOIN {og_ancestry} og ON n.nid = og.nid\n      WHERE n.type = '%s'\n        AND n.status = 1\n        AND og.group_nid = %d\n      ORDER BY nr.title ASC", $feedtype, $gid);
    while ($feed = db_fetch_object($results)) {
      $crayon = theme('crayon', $feed->nid);
      $links[] = array(
        'title' => "<span class='crayon-marker crayon-{$crayon}'></span> " . $feed->title,
        'html' => true,
      );
    }
  }
  return $links;
}