foreach ($sorted_sub_chapters as $child_Chapter) { // Display subforum echo '<a href="' . $child_Chapter->get_permanent_url() . '" class="forumlink">' . $child_Chapter->get('name') . '</a>'; echo $cc < count($sorted_sub_chapters) - 1 ? ', ' : ''; $cc++; } echo '</div>'; } ?> </td> <td class="ft_count"><?php printf(T_('%s topics'), '<b>' . get_postcount_in_category($Chapter->ID) . '</b>'); ?> </td> <td class="ft_count"><?php printf(T_('%s replies'), '<b>' . get_commentcount_in_category($Chapter->ID) . '</b>'); ?> </td> <td class="ft_date"><?php echo $Chapter->get_last_touched_date('D M j, Y H:i'); ?> </td> </tr> <?php } } // End of categories loop. ?> </table> <?php }
/** * Search and score chapters * * @param string original search term * @param array all separated words from the search term * @param array all quoted parts from the search term * @param number max possible score */ function search_and_score_chapters($search_term, $keywords, $quoted_parts) { global $DB, $Blog; // Init result array: $search_result = array(); // Set query conditions: $or = ''; $cat_where_condition = ''; foreach ($keywords as $keyword) { $keyword = $DB->escape($keyword); $cat_where_condition .= $or . ' ( cat_name LIKE \'%' . $keyword . '%\' OR cat_description LIKE \'%' . $keyword . '%\' )'; $or = ' OR'; } // Search between chapters: $ChapterCache =& get_ChapterCache(); $ChapterCache->clear(); $cat_where_condition = '( cat_blog_ID = ' . $DB->quote($Blog->ID) . ' ) AND ( ' . $cat_where_condition . ' )'; $ChapterCache->load_where($cat_where_condition); while (($iterator_Chapter =& $ChapterCache->get_next()) != NULL) { $scores_map = array(); $scores_map['name'] = score_text($iterator_Chapter->get('name'), $search_term, $keywords, $quoted_parts, 3); $scores_map['description'] = score_text($iterator_Chapter->get('description'), $search_term, $keywords, $quoted_parts); $post_count = get_postcount_in_category($iterator_Chapter->ID, $Blog->ID); $post_score = intval($post_count / 3); $scores_map['post_count'] = $post_score > 10 ? 10 : $post_score; $comment_count = get_commentcount_in_category($iterator_Chapter->ID, $Blog->ID); $comment_score = intval($comment_count / 6); $scores_map['comment_count'] = $comment_score > 10 ? 10 : $comment_score; $final_score = $scores_map['name']['score'] + $scores_map['description']['score'] + $scores_map['post_count'] + $scores_map['comment_count']; $search_result[] = array('type' => 'category', 'score' => $final_score, 'ID' => $iterator_Chapter->ID, 'scores_map' => $scores_map); } return $search_result; }
foreach ($sorted_sub_chapters as $child_Chapter) { // Display subforum echo '<a href="' . $child_Chapter->get_permanent_url() . '" class="forumlink">' . $child_Chapter->get('name') . '</a>'; echo $cc < count($sorted_sub_chapters) - 1 ? ', ' : ''; $cc++; } echo '</div>'; } ?> </td> <td class="row2"><?php echo get_postcount_in_category($Chapter->ID); ?> </td> <td class="row2"><?php echo get_commentcount_in_category($Chapter->ID); ?> </td> <td class="row2 font10"><?php echo $Chapter->get_last_touched_date('D M j, Y H:i'); ?> </td> </tr> <?php } } // End of categories loop. ?> </table> <?php }
echo '<a href="' . $child_Chapter->get_permanent_url() . '" class="forumlink">' . $child_Chapter->get('name') . '</a>'; echo $cc < count($sorted_sub_chapters) - 1 ? ', ' : ''; $cc++; } echo '</div>'; } ?> </div> </div> <div class="ft_count col-lg-1 col-md-1 col-sm-1 col-xs-2"> <?php printf(T_('%s topics'), '<div><a href="' . $Chapter->get_permanent_url() . '">' . get_postcount_in_category($Chapter->ID) . '</a></div>'); ?> </div> <div class="ft_count second_of_class col-lg-1 col-md-1 col-sm-1 col-xs-2"><?php printf(T_('%s replies'), '<div><a href="' . $Chapter->get_permanent_url() . '">' . get_commentcount_in_category($Chapter->ID) . '</a></div>'); ?> </div> <div class="ft_date col-lg-2 col-md-3 col-sm-3"><?php echo $Chapter->get_last_touched_date('D M j, Y H:i'); ?> </div> <!-- Apply this on XS size --> <div class="ft_date_shrinked col-xs-2"><?php echo $Chapter->get_last_touched_date('m/j/y'); ?> </div> </article> <?php } ?>