You are here

function forward_top5_list in Forward 6

Same name and namespace in other branches
  1. 5 forward.module \forward_top5_list()
  2. 7 forward.module \forward_top5_list()
  3. 7.2 forward.module \forward_top5_list()
1 call to forward_top5_list()
forward_form_submit in ./forward.module

File

./forward.module, line 1386

Code

function forward_top5_list($query, $base_url, $type) {
  $items = '';
  if ($type == 'user') {
    $result = db_query_range($query, 0, 5);
  }
  else {
    $result = db_query_range(db_rewrite_sql($query), 0, 5);
  }
  while ($item = db_fetch_object($result)) {
    if ($type == 'user') {
      $items .= '<li>' . l($item->name, 'user/' . $item->uid, array(
        'absolute' => TRUE,
      )) . '</li>';
    }
    elseif ($type == 'comment') {
      $items .= '<li>' . l($item->subject, 'node/' . $item->nid, array(
        'absolute' => TRUE,
        'fragment' => 'comment-' . $item->cid,
      )) . '</li>';
    }
    else {
      $items .= '<li>' . l($item->title, 'node/' . $item->nid, array(
        'absolute' => TRUE,
      )) . '</li>';
    }
  }
  if ($items) {
    $items = '<ul>' . $items . '</ul>';
  }
  return $items;
}