Changeset 3245 for branches/1.2/bp-groups/bp-groups-templatetags.php
- Timestamp:
- 09/10/2010 08:12:08 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.2/bp-groups/bp-groups-templatetags.php
r3201 r3245 27 27 28 28 $this->pag_page = isset( $_REQUEST['grpage'] ) ? intval( $_REQUEST['grpage'] ) : $page; 29 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;30 31 if ( 'invites' == $type ) 29 $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page; 30 31 if ( 'invites' == $type ) { 32 32 $this->groups = groups_get_invites_for_user( $user_id, $this->pag_num, $this->pag_page ); 33 else if ( 'single-group' == $type ) {33 } else if ( 'single-group' == $type ) { 34 34 $group = new stdClass; 35 35 $group->group_id = BP_Groups_Group::get_id_from_slug($slug); 36 $this->groups = array( $group );37 } else 36 $this->groups = array( $group ); 37 } else { 38 38 $this->groups = groups_get_groups( array( 'type' => $type, 'per_page' => $this->pag_num, 'page' =>$this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms, 'populate_extras' => $populate_extras ) ); 39 } 39 40 40 41 if ( 'invites' == $type ) { 41 42 $this->total_group_count = (int)$this->groups['total']; 42 $this->group_count = (int)$this->groups['total']; 43 $this->group_count = (int)$this->groups['total']; 44 $this->groups = $this->groups['groups']; 45 } else if ( 'single-group' == $type ) { 46 $this->single_group = true; 47 $this->total_group_count = 1; 48 $this->group_count = 1; 49 } else { 50 if ( !$max || $max >= (int)$this->groups['total'] ) { 51 $this->total_group_count = (int)$this->groups['total']; 52 } else { 53 $this->total_group_count = (int)$max; 54 } 55 43 56 $this->groups = $this->groups['groups']; 44 } else if ( 'single-group' == $type ) {45 $this->single_group = true;46 $this->total_group_count = 1;47 $this->group_count = 1;48 } else {49 if ( !$max || $max >= (int)$this->groups['total'] )50 $this->total_group_count = (int)$this->groups['total'];51 else52 $this->total_group_count = (int)$max;53 54 $this->groups = $this->groups['groups'];55 57 56 58 if ( $max ) { 57 if ( $max >= count($this->groups) ) 58 $this->group_count = count( $this->groups);59 else59 if ( $max >= count($this->groups) ) { 60 $this->group_count = count( $this->groups ); 61 } else { 60 62 $this->group_count = (int)$max; 63 } 61 64 } else { 62 $this->group_count = count( $this->groups);65 $this->group_count = count( $this->groups ); 63 66 } 64 67 } 65 68 66 $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 ) ), 68 'format' => '', 69 'total' => ceil($this->total_group_count / $this->pag_num), 70 'current' => $this->pag_page, 71 'prev_text' => '←', 72 'next_text' => '→', 73 'mid_size' => 1 74 )); 69 // Build pagination links 70 if ( (int)$this->total_group_count && (int)$this->pag_num ) { 71 $this->pag_links = paginate_links( array( 72 'base' => add_query_arg( array( 'grpage' => '%#%', 'num' => $this->pag_num, 's' => $search_terms, 'sortby' => $this->sort_by, 'order' => $this->order ) ), 73 'format' => '', 74 'total' => ceil( (int)$this->total_group_count / (int)$this->pag_num ), 75 'current' => $this->pag_page, 76 'prev_text' => '←', 77 'next_text' => '→', 78 'mid_size' => 1 79 ) ); 80 } 75 81 } 76 82
Note: See TracChangeset
for help on using the changeset viewer.