Ejemplo n.º 1
0
/**
 * 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();
    }
}
Ejemplo n.º 2
0
 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);
     }
 }
Ejemplo n.º 3
0
/**
 * Gets next comment of current premium comments
 *
 * @return array
 */
function osc_has_premium_comments()
{
    if (!View::newInstance()->_exists('comments')) {
        View::newInstance()->_exportVariableToView('comments', ItemComment::newInstance()->findBypremiumID(osc_premium_id(), osc_premium_comments_page(), osc_comments_per_page()));
    }
    return View::newInstance()->_next('comments');
}
Ejemplo n.º 4
0
?>
                            <div class="help-box"><?php 
_e('If the value is zero, an administrator must always approve comments');
?>
</div>
                        </div>
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-label"><?php 
_e('Other comment settings');
?>
</div>
                    <div class="form-controls">
                        <?php 
printf(__('Break comments into pages with %s comments per page'), '<input type="text" class="input-small" name="comments_per_page" value="' . osc_esc_html(osc_comments_per_page()) . '" />');
?>
                        <div class="help-box"><?php 
_e('If the value is zero all comments are shown');
?>
</div>
                    </div>
                </div>

                <h2 class="render-title"><?php 
_e('Notifications');
?>
</h2>

                <div class="form-row">
                    <div class="form-label"><?php 
Ejemplo n.º 5
0
/**
 * 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'), '&larr;'), 'text_next' => sprintf(__('Next %s', 'twitter'), '&rarr;'), 'class_selected' => 'active', 'class_non_selected' => '', 'force_limits' => false, 'url' => osc_item_comments_url('{PAGE}'));
    $pagination = new TwitterPagination($params);
    return $pagination->doPagination();
}
Ejemplo n.º 6
0
 /**
  * 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();
     }
 }
Ejemplo n.º 7
0
                _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 
    }
Ejemplo n.º 8
0
                                        &nbsp;<label><?php 
_e('Number of comments from same author that should be validated before skipping validation (0 for always moderation)');
?>
</label>
                                        <input type="text" name="num_moderate_comments" id="num_moderate_comments" value="<?php 
echo osc_moderate_comments() == -1 ? '' : osc_moderate_comments();
?>
" />
                                    </div>
                                    <br/>
                                    <label><?php 
_e('Number of comments per page. You could limit the number of comments shown at a time at the item\'s detail page. Other comments will be available through a pagination system. (0 for show all comments at the same time)');
?>
</label>
                                    <input type="text" name="comments_per_page" id="comments_per_page" value="<?php 
echo osc_comments_per_page();
?>
" />
                                    <br/>
                                    <input style="height: 20px; padding-left: 4px;padding-top: 4px;" type="checkbox" <?php 
echo osc_reg_user_post_comments() ? 'checked="true"' : '';
?>
 name="reg_user_post_comments" id="reg_user_post_comments" value="1" />
                                    <label for="reg_user_post_comments"><?php 
_e('Only allow registered users to post comments');
?>
</label>
                                </fieldset>
                            </div>
                            
                            <div style="float: left; width: 50%;">
Ejemplo n.º 9
0
                _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 
    }