function faq_get_child_categories_faqs in Frequently Asked Questions 6
Same name and namespace in other branches
- 5.2 faq.module \faq_get_child_categories_faqs()
- 7.2 faq.module \faq_get_child_categories_faqs()
- 7 faq.module \faq_get_child_categories_faqs()
Helper function for retrieving the sub-categories faqs.
Parameters
$term: The category / term to display FAQs for.
$theme_function: Theme function to use to format the Q/A layout for sub-categories.
$default_weight: Is 0 for $default_sorting = DESC; is 1000000 for $default_sorting = ASC.
$default_sorting: If 'DESC', nodes are sorted by creation date descending; if 'ASC', nodes are sorted by creation date ascending.
$category_display: The layout of categories which should be used.
$class: CSS class which the HTML div will be using. A special class name is required in order to hide and questions / answers.
$parent_term: The original, top-level, term we're displaying FAQs for.
5 calls to faq_get_child_categories_faqs()
- template_preprocess_faq_category_hide_answer in includes/
faq.hide_answer.inc - Create categorized FAQ page if set to show answer when question is clicked.
- template_preprocess_faq_category_new_page in includes/
faq.new_page.inc - Create categorized FAQ page if set to show answer in a new page.
- template_preprocess_faq_category_questions_inline in includes/
faq.questions_inline.inc - Create categorized FAQ page if set to show/hide the questions inline.
- template_preprocess_faq_category_questions_top in includes/
faq.questions_top.inc - Create categorized questions for FAQ page if set to show questions on top.
- template_preprocess_faq_category_questions_top_answers in includes/
faq.questions_top.inc - Create categorized answers for FAQ page if set to show the questions on top.
File
- ./
faq.module, line 1268 - The FAQ module allows users to create a FAQ page, with questions and answers displayed in different styles, according to the settings.
Code
function faq_get_child_categories_faqs($term, $theme_function, $default_weight, $default_sorting, $category_display, $class, $parent_term = NULL) {
$output = array();
$list = taxonomy_get_children($term->tid);
if (!is_array($list)) {
return '';
}
foreach ($list as $tid => $child_term) {
$child_term->depth = $term->depth + 1;
if (taxonomy_term_count_nodes($child_term->tid, 'faq')) {
if ($default_sorting == 'DESC') {
$result = db_query(db_rewrite_sql("SELECT n.nid, COALESCE(w.weight, %d) as effective_weight, n.sticky, n.created FROM {node} n INNER JOIN {term_node} tn ON (n.nid = tn.nid AND n.vid = tn.vid) LEFT JOIN {faq_weights} w ON w.tid = tn.tid AND n.nid = w.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY effective_weight, n.sticky DESC, n.created DESC", "n", "nid"), $default_weight, $child_term->tid);
}
else {
$result = db_query(db_rewrite_sql("SELECT n.nid, COALESCE(w.weight, %d) as effective_weight, n.sticky, n.created FROM {node} n INNER JOIN {term_node} tn ON (n.nid = tn.nid AND n.vid = tn.vid) LEFT JOIN {faq_weights} w ON w.tid = tn.tid AND n.nid = w.nid WHERE n.type='faq' AND n.status = 1 AND tn.tid = '%d' ORDER BY effective_weight, n.sticky DESC, n.created ASC", "n", "nid"), $default_weight, $child_term->tid);
}
$data = array();
while ($row = db_fetch_object($result)) {
$node = node_load($row->nid);
if (node_access('view', $node)) {
$data[] = $node;
}
}
$output[] = theme($theme_function, $data, 1, $category_display, $child_term, $class, $parent_term);
}
}
return $output;
}