Skip to:
Content

BuddyPress.org

Changeset 7523


Ignore:
Timestamp:
11/08/2013 03:06:35 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Add pagination to notifications output. Includes functions for outputting and returning the count labels. See #5148.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-notifications/bp-notifications-template.php

    r7521 r7523  
    512512
    513513/**
    514  * Output the pagination for the current notification loop.
     514 * Output the pagination count for the current notification loop.
     515 *
     516 * @since BuddyPress (1.9.0)
     517 */
     518function bp_notifications_pagination_count() {
     519        echo bp_get_notifications_pagination_count();
     520}
     521        /**
     522         * Return the pagination count for the current notification loop.
     523         *
     524         * @since BuddyPress (1.9.0)
     525         *
     526         * @return string HTML for the pagination count.
     527         */
     528        function bp_get_notifications_pagination_count() {
     529                $query_loop = buddypress()->notifications->query_loop;
     530                $start_num  = intval( ( $query_loop->pag_page - 1 ) * $query_loop->pag_num ) + 1;
     531                $from_num   = bp_core_number_format( $start_num );
     532                $to_num     = bp_core_number_format( ( $start_num + ( $query_loop->pag_num - 1 ) > $query_loop->total_notification_count ) ? $query_loop->total_notification_count : $start_num + ( $query_loop->pag_num - 1 ) );
     533                $total      = bp_core_number_format( $query_loop->total_notification_count );
     534                $pag        = sprintf( _n( 'Viewing %1$s to %2$s (of %3$s notification)', 'Viewing %1$s to %2$s (of %3$s notifications)', $total, 'buddypress' ), $from_num, $to_num, $total );
     535
     536                return apply_filters( 'bp_notifications_pagination_count', $pag );
     537        }
     538
     539/**
     540 * Output the pagination links for the current notification loop.
    515541 *
    516542 * @since BuddyPress (1.9.0)
     
    520546}
    521547        /**
    522          * Return the pagination for the current notification loop.
    523          *
    524          * @since BuddyPress (1.9.0)
    525          *
    526          * @return string HTML for the pagination.
     548         * Return the pagination links for the current notification loop.
     549         *
     550         * @since BuddyPress (1.9.0)
     551         *
     552         * @return string HTML for the pagination links.
    527553         */
    528554        function bp_get_notifications_pagination_links() {
  • trunk/bp-templates/bp-legacy/buddypress/members/single/notifications/read.php

    r7521 r7523  
    11<?php if ( bp_has_notifications() ) : ?>
     2
     3        <div id="pag-top" class="pagination no-ajax">
     4                <div class="pag-count" id="notifications-count-top">
     5                        <?php bp_notifications_pagination_count(); ?>
     6                </div>
     7
     8                <div class="pagination-links" id="notifications-pag-top">
     9                        <?php bp_notifications_pagination_links(); ?>
     10                </div>
     11        </div>
    212
    313        <table class="notification-settings">
     
    1626        </table>
    1727
     28        <div id="pag-bottom" class="pagination no-ajax">
     29                <div class="pag-count" id="notifications-count-bottom">
     30                        <?php bp_notifications_pagination_count(); ?>
     31                </div>
     32
     33                <div class="pagination-links" id="notifications-pag-bottom">
     34                        <?php bp_notifications_pagination_links(); ?>
     35                </div>
     36        </div>
     37
    1838<?php else : ?>
    1939
  • trunk/bp-templates/bp-legacy/buddypress/members/single/notifications/unread.php

    r7521 r7523  
    11<?php if ( bp_has_notifications() ) : ?>
     2
     3        <div id="pag-top" class="pagination no-ajax">
     4                <div class="pag-count" id="notifications-count-top">
     5                        <?php bp_notifications_pagination_count(); ?>
     6                </div>
     7
     8                <div class="pagination-links" id="notifications-pag-top">
     9                        <?php bp_notifications_pagination_links(); ?>
     10                </div>
     11        </div>
    212
    313        <table class="notification-settings">
     
    1626        </table>
    1727
     28        <div id="pag-bottom" class="pagination no-ajax">
     29                <div class="pag-count" id="notifications-count-bottom">
     30                        <?php bp_notifications_pagination_count(); ?>
     31                </div>
     32
     33                <div class="pagination-links" id="notifications-pag-bottom">
     34                        <?php bp_notifications_pagination_links(); ?>
     35                </div>
     36        </div>
     37
    1838<?php else : ?>
    1939
Note: See TracChangeset for help on using the changeset viewer.