You are here

function faq_get_faq_list in Frequently Asked Questions 5

Same name and namespace in other branches
  1. 5.2 faq.module \faq_get_faq_list()
  2. 6 faq.module \faq_get_faq_list()
  3. 7.2 faq.module \faq_get_faq_list()
  4. 7 faq.module \faq_get_faq_list()
1 call to faq_get_faq_list()
faq_site_map in ./faq.module
Implementation of hook_site_map().

File

./faq.module, line 1791

Code

function faq_get_faq_list() {

  // return list of vocab terms if categories are configured
  $use_categories = variable_get('faq_use_categories', FALSE);
  if ($use_categories) {
    return faq_get_terms();
  }

  // otherwise return list of weighted FAQ nodes
  $items = array();
  $result = db_query(db_rewrite_sql("SELECT n.nid, n.title, if((w.weight IS NULL), 0, w.weight) as weight FROM {node} n LEFT JOIN {faq_weights} w ON w.nid = n.nid WHERE n.type='faq' AND n.status = 1 AND (w.tid = 0 OR w.tid IS NULL) ORDER BY weight, n.sticky DESC, n.created DESC", "n", "nid"));
  while ($node = db_fetch_object($result)) {
    $node_obj = node_load($node->nid);
    if (node_access("view", $node_obj)) {
      $items[] = l($node->title, "node/{$node->nid}");
    }
  }
  return theme('item_list', $items);
}