Skip to:
Content

BuddyPress.org

Changeset 2950


Ignore:
Timestamp:
04/24/2010 03:34:25 PM (11 years ago)
Author:
apeatling
Message:

Return and echo functions for pagination counts.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-templatetags.php

    r2944 r2950  
    174174
    175175function bp_members_pagination_count() {
    176     global $bp, $members_template;
    177 
    178     $from_num = bp_core_number_format( intval( ( $members_template->pag_page - 1 ) * $members_template->pag_num ) + 1 );
    179     $to_num = bp_core_number_format( ( $from_num + ( $members_template->pag_num - 1 ) > $members_template->total_member_count ) ? $members_template->total_member_count : $from_num + ( $members_template->pag_num - 1) );
    180     $total = bp_core_number_format( $members_template->total_member_count );
    181 
    182     if ( 'active' == $members_template->type )
    183         echo sprintf( __( 'Viewing member %1$s to %2$s (of %3$s active members)', 'buddypress' ), $from_num, $to_num, $total );
    184     else if ( 'popular' == $members_template->type )
    185         echo sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members with friends)', 'buddypress' ), $from_num, $to_num, $total );
    186     else if ( 'online' == $members_template->type )
    187         echo sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members online)', 'buddypress' ), $from_num, $to_num, $total );
    188     else
    189         echo sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members)', 'buddypress' ), $from_num, $to_num, $total );
    190 
    191     ?><span class="ajax-loader"></span><?php
    192 }
     176    echo bp_get_members_pagination_count();
     177}
     178    function bp_get_members_pagination_count() {
     179        global $bp, $members_template;
     180
     181        $from_num = bp_core_number_format( intval( ( $members_template->pag_page - 1 ) * $members_template->pag_num ) + 1 );
     182        $to_num = bp_core_number_format( ( $from_num + ( $members_template->pag_num - 1 ) > $members_template->total_member_count ) ? $members_template->total_member_count : $from_num + ( $members_template->pag_num - 1) );
     183        $total = bp_core_number_format( $members_template->total_member_count );
     184
     185        if ( 'active' == $members_template->type )
     186            $pag = sprintf( __( 'Viewing member %1$s to %2$s (of %3$s active members)', 'buddypress' ), $from_num, $to_num, $total );
     187        else if ( 'popular' == $members_template->type )
     188            $pag = sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members with friends)', 'buddypress' ), $from_num, $to_num, $total );
     189        else if ( 'online' == $members_template->type )
     190            $pag = sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members online)', 'buddypress' ), $from_num, $to_num, $total );
     191        else
     192            $pag = sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members)', 'buddypress' ), $from_num, $to_num, $total );
     193
     194        return apply_filters( 'bp_members_pagination_count', $pag );
     195    }
    193196
    194197function bp_members_pagination_links() {
  • trunk/bp-forums/bp-forums-templatetags.php

    r2946 r2950  
    662662
    663663function bp_forum_pagination_count() {
    664     global $bp, $forum_template;
    665 
    666     $from_num = bp_core_number_format( intval( ( $forum_template->pag_page - 1 ) * $forum_template->pag_num ) + 1 );
    667     $to_num = bp_core_number_format( ( $from_num + ( $forum_template->pag_num - 1  ) > $forum_template->total_topic_count ) ? $forum_template->total_topic_count : $from_num + ( $forum_template->pag_num - 1 ) );
    668     $total = bp_core_number_format( $forum_template->total_topic_count );
    669 
    670     $pag_filter = false;
    671     if ( 'tags' == $forum_template->type && !empty( $forum_template->search_terms ) )
    672         $pag_filter = sprintf( __( ' matching tag "%s"', 'buddypress' ), $forum_template->search_terms );
    673 
    674     echo apply_filters( 'bp_forum_pagination_count', sprintf( __( 'Viewing topic %s to %s (%s total topics%s)', 'buddypress' ), $from_num, $to_num, $total, $pag_filter ) );
    675 ?>
    676 <span class="ajax-loader"></span>
    677 <?php
    678 }
     664    echo bp_get_forum_pagination_count();
     665}
     666    function bp_get_forum_pagination_count() {
     667        global $bp, $forum_template;
     668
     669        $from_num = bp_core_number_format( intval( ( $forum_template->pag_page - 1 ) * $forum_template->pag_num ) + 1 );
     670        $to_num = bp_core_number_format( ( $from_num + ( $forum_template->pag_num - 1  ) > $forum_template->total_topic_count ) ? $forum_template->total_topic_count : $from_num + ( $forum_template->pag_num - 1 ) );
     671        $total = bp_core_number_format( $forum_template->total_topic_count );
     672
     673        $pag_filter = false;
     674        if ( 'tags' == $forum_template->type && !empty( $forum_template->search_terms ) )
     675            $pag_filter = sprintf( __( ' matching tag "%s"', 'buddypress' ), $forum_template->search_terms );
     676
     677        return apply_filters( 'bp_get_forum_pagination_count', sprintf( __( 'Viewing topic %s to %s (of %s total topics%s)', 'buddypress' ), $from_num, $to_num, $total, $pag_filter ) );
     678    }
    679679
    680680function bp_is_edit_topic() {
  • trunk/bp-groups/bp-groups-templatetags.php

    r2946 r2950  
    1919
    2020    var $single_group = false;
    21 
    22     var $sort_by;
    23     var $order;
    2421
    2522    function bp_groups_template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $include, $populate_extras ) {
     
    6562
    6663        $this->pag_links = paginate_links( array(
    67             'base' => add_query_arg( array( 'grpage' => '%#%', 'num' => $this->pag_num, 's' => $search_terms, 'sortby' => $this->sort_by, 'order' => $this->order ) ),
     64            'base' => add_query_arg( array( 'grpage' => '%#%' ) ),
    6865            'format' => '',
    6966            'total' => ceil($this->total_group_count / $this->pag_num),
     
    551548
    552549function bp_groups_pagination_count() {
    553     global $bp, $groups_template;
    554 
    555     $from_num = bp_core_number_format( intval( ( $groups_template->pag_page - 1 ) * $groups_template->pag_num ) + 1 );
    556     $to_num = bp_core_number_format( ( $from_num + ( $groups_template->pag_num - 1 ) > $groups_template->total_group_count ) ? $groups_template->total_group_count : $from_num + ( $groups_template->pag_num - 1 ) );
    557     $total = bp_core_number_format( $groups_template->total_group_count );
    558 
    559     echo sprintf( __( 'Viewing group %1$s to %2$s (of %3$s groups)', 'buddypress' ), $from_num, $to_num, $total ); ?> &nbsp;
    560     <span class="ajax-loader"></span><?php
    561 }
     550    echo bp_get_groups_pagination_count();
     551}
     552    function bp_get_groups_pagination_count() {
     553        global $bp, $groups_template;
     554
     555        $from_num = bp_core_number_format( intval( ( $groups_template->pag_page - 1 ) * $groups_template->pag_num ) + 1 );
     556        $to_num = bp_core_number_format( ( $from_num + ( $groups_template->pag_num - 1 ) > $groups_template->total_group_count ) ? $groups_template->total_group_count : $from_num + ( $groups_template->pag_num - 1 ) );
     557        $total = bp_core_number_format( $groups_template->total_group_count );
     558
     559        return apply_filters( 'bp_get_groups_pagination_count', sprintf( __( 'Viewing group %1$s to %2$s (of %3$s groups)', 'buddypress' ), $from_num, $to_num, $total ) );
     560    }
    562561
    563562function bp_group_total_members() {
Note: See TracChangeset for help on using the changeset viewer.