/** * Display CommentList with the given filters * * @param integer Blog ID * @param integer Item ID * @param array Status filters * @param integer Limit * @param array Comments IDs string to exclude from the list * @param string Filterset name * @param string Expiry status: 'all', 'active', 'expired' */ function echo_item_comments($blog_ID, $item_ID, $statuses = NULL, $currentpage = 1, $limit = 20, $comment_IDs = array(), $filterset_name = '', $expiry_status = 'active') { global $inc_path, $status_list, $Blog, $admin_url; $BlogCache =& get_BlogCache(); $Blog =& $BlogCache->get_by_ID($blog_ID, false, false); global $CommentList; $CommentList = new CommentList2($Blog, $limit, 'CommentCache', '', $filterset_name); $exlude_ID_list = NULL; if (!empty($comment_IDs)) { $exlude_ID_list = '-' . implode(",", $comment_IDs); } if (empty($statuses)) { $statuses = get_visibility_statuses('keys', array('redirected', 'trash')); } if ($expiry_status == 'all') { // Display all comments $expiry_statuses = array('active', 'expired'); } else { // Display active or expired comments $expiry_statuses = array($expiry_status); } // if item_ID == -1 then don't use item filter! display all comments from current blog if ($item_ID == -1) { $item_ID = NULL; } // set redirect_to if ($item_ID != null) { // redirect to the items full view param('redirect_to', 'url', url_add_param($admin_url, 'ctrl=items&blog=' . $blog_ID . '&p=' . $item_ID, '&')); param('item_id', 'integer', $item_ID); param('currentpage', 'integer', $currentpage); if (count($statuses) == 1) { $show_comments = $statuses[0]; } else { $show_comments = 'all'; } param('comments_number', 'integer', generic_ctp_number($item_ID, 'comments', $show_comments)); // Filter list: $CommentList->set_filters(array('types' => array('comment', 'trackback', 'pingback'), 'statuses' => $statuses, 'expiry_statuses' => $expiry_statuses, 'comment_ID_list' => $exlude_ID_list, 'post_ID' => $item_ID, 'order' => 'ASC', 'comments' => $limit, 'page' => $currentpage)); } else { // redirect to the comments full view param('redirect_to', 'url', url_add_param($admin_url, 'ctrl=comments&blog=' . $blog_ID . '&filter=restore', '&')); // this is an ajax call we always have to restore the filterst (we can set filters only without ajax call) $CommentList->set_filters(array('types' => array('comment', 'trackback', 'pingback'))); $CommentList->restore_filterset(); } // Get ready for display (runs the query): $CommentList->display_init(); $CommentList->display_if_empty(array('before' => '<div class="bComment"><p>', 'after' => '</p></div>', 'msg_empty' => T_('No feedback for this post yet...'))); // display comments require $inc_path . 'comments/views/_comment_list.inc.php'; }