/** * Gets the pagination links of comments pagination * * @return string pagination links */ function osc_comments_pagination() { if (osc_comments_per_page() == 0 || osc_item_comments_page() === 'all') { return ''; } else { $params = array('total' => ceil(osc_item_total_comments() / osc_comments_per_page()), 'selected' => osc_item_comments_page(), 'url' => osc_item_comments_url('{PAGE}')); $pagination = new Pagination($params); return $pagination->doPagination(); } }
public function findByItemID($id, $page = null, $comments_per_page = null) { if ($page == null) { $page = osc_item_comments_page(); } if ($page == '') { $page = 0; } if ($comments_per_page == null) { $comments_per_page = osc_comments_per_page(); } if ($page === 'all' || $comments_per_page == 0) { return $this->conn->osc_dbFetchResults("SELECT c.* FROM %st_item_comment c WHERE fk_i_item_id = %d AND b_active = 1 AND b_enabled = 1", DB_TABLE_PREFIX, $id); } else { return $this->conn->osc_dbFetchResults("SELECT c.* FROM %st_item_comment c WHERE fk_i_item_id = %d AND b_active = 1 AND b_enabled = 1 LIMIT %d, %d", DB_TABLE_PREFIX, $id, $page * $comments_per_page, $comments_per_page); } }
/** * Helper to use twitter pagination in item comments */ function twitter_comments_item_pagination() { $params = array('total' => ceil(osc_item_total_comments() / osc_comments_per_page()), 'selected' => osc_item_comments_page(), 'class_first' => '', 'class_last' => '', 'class_prev' => 'prev', 'class_next' => 'next', 'delimiter' => '', 'text_prev' => sprintf(__('%s Previous', 'twitter'), '←'), 'text_next' => sprintf(__('Next %s', 'twitter'), '→'), 'class_selected' => 'active', 'class_non_selected' => '', 'force_limits' => false, 'url' => osc_item_comments_url('{PAGE}')); $pagination = new TwitterPagination($params); return $pagination->doPagination(); }
/** * Gets next comment of current item comments * * @return array */ function osc_has_item_comments() { if (!View::newInstance()->_exists('comments')) { View::newInstance()->_exportVariableToView('comments', ItemComment::newInstance()->findByItemID(osc_item_id(), osc_item_comments_page(), osc_comments_per_page())); } return View::newInstance()->_next('comments'); }
/** * Searches for comments information, given an item id, page and comments per page. * * @access public * @since unknown * @param integer $id * @param integer $page * @param integer $comments_per_page * @return array */ function findByItemID($id, $page = null, $commentsPerPage = null) { $result = array(); if ($page == null) { $page = osc_item_comments_page(); } if ($page == '') { $page = 0; } if ($commentsPerPage == null) { $commentsPerPage = osc_comments_per_page(); } $this->dao->select(); $this->dao->from($this->getTableName()); $conditions = array('fk_i_item_id' => $id, 'b_active' => 1, 'b_enabled' => 1); $this->dao->where($conditions); if ($page !== 'all' || $commentsPerPage > 0) { $this->dao->limit($page * $commentsPerPage, $commentsPerPage); } $result = $this->dao->get(); if ($result == false) { return false; } else { return $result->result(); } }
_e('Delete your comment', 'twitter_bootstrap'); ?> "><?php _e('Delete', 'twitter_bootstrap'); ?> </a> </p> <?php } ?> </div> <?php } ?> <?php if (!(osc_comments_per_page() == 0) || osc_item_comments_page() === 'all') { ?> <div class="pagination"> <ul> <?php echo twitter_comments_item_pagination(); ?> </ul> </div> <?php } ?> </div> <!-- list comments end --> <?php }
_e('Delete your comment', 'twitter'); ?> "><?php _e('Delete', 'twitter'); ?> </a> </p> <?php } ?> </div> <?php } ?> <?php if ((!(osc_comments_per_page() == 0) || osc_item_comments_page() === 'all') && osc_item_total_comments() >= osc_comments_per_page()) { ?> <div class="pagination"> <ul> <?php echo twitter_comments_item_pagination(); ?> </ul> </div> <?php } ?> </div> <!-- list comments end --> <?php }