You are here

function theme_questions_inline in Frequently Asked Questions 5

1 theme call to theme_questions_inline()
faq_page in ./faq.module
Function to display the faq page

File

./faq.module, line 1252

Code

function theme_questions_inline($result, $display_vars) {

  // configure "back to top" link
  $back_to_top = '';
  if (!empty($display_vars['back_to_top'])) {
    $back_to_top = '<p class="faq_top_link">';
    $back_to_top .= l(t($display_vars['back_to_top']), 'faq', array(), NULL, '') . '</p>';
  }

  // configure labels
  $que_label = '';
  $ans_label = '';
  if ($display_vars['faq_qa_mark']) {
    $que_label = t($display_vars["faq_question_label"]) . ' ';
    $ans_label = '<strong>' . t($display_vars["faq_answer_label"]) . '</strong> ';
  }
  $output = "<div>\n";
  while ($node = db_fetch_object($result)) {
    $node_obj = node_load($node->nid);
    if (node_access("view", $node_obj)) {
      $output .= '<div class="faq_question">';
      $output .= l($que_label . $node->title, "node/{$node->nid}") . "</div>\n";

      // should we display teaser or full text
      if ($display_vars['use_teaser']) {
        $more_link = '';
        if (!empty($display_vars['more_link']) && strlen($node->teaser) < strlen($node->body)) {
          $more_link = '<p class="faq_more_link">';
          $more_link .= l(t($display_vars['more_link']), "node/{$node->nid}") . '</p>';
        }
        $output .= '<div class="faq_answer">';
        $output .= check_markup($ans_label . $node->teaser, $node->format, FALSE);
        $output .= $more_link . $back_to_top . "</div>\n";
      }
      else {
        $output .= '<div class="faq_answer">';
        $output .= check_markup($ans_label . $node->body, $node->format, FALSE);
        $output .= $back_to_top . "</div>\n";
      }
    }
  }
  $output .= "</div>\n";
  return $output;
}