function __construct() { global $bp; $nav_page_name = get_option('bp_group_documents_nav_page_name'); $this->name = !empty($nav_page_name) ? $nav_page_name : __('Documents', 'bp-group-documents'); $this->slug = BP_GROUP_DOCUMENTS_SLUG; /* For internal identification */ $this->id = 'group_documents'; $this->format_notification_function = 'bp_group_documents_format_notifications'; if ($bp->groups->current_group) { $this->nav_item_name = $this->name . ' <span>' . BP_Group_Documents::get_total($bp->groups->current_group->id) . '</span>'; $this->nav_item_position = 51; } $this->admin_name = !empty($nav_page_name) ? $nav_page_name : __('Documents', 'bp-group-documents'); $this->admin_slug = BP_GROUP_DOCUMENTS_SLUG; if ('mods_decide' != get_option('bp_group_documents_upload_permission')) { $this->enable_create_step = false; } else { $this->create_step_position = 21; } }
/** * @author * @since */ private function do_paging_logic() { global $bp; do_action('bp_group_documents_template_do_paging_logic'); $this->items_per_page = get_option('bp_group_documents_items_per_page'); $this->total_records = BP_Group_Documents::get_total($bp->groups->current_group->id, $this->category); $this->total_pages = ceil($this->total_records / $this->items_per_page); if (isset($_GET['page']) && ctype_digit($_GET['page'])) { $this->page = $_GET['page']; $this->start_record = ($this->page - 1) * $this->items_per_page + 1; } $last_possible = $this->items_per_page * $this->page; $this->end_record = $this->total_records < $last_possible ? $this->total_records : $last_possible; $this->action_link = get_bloginfo('url') . '/' . bp_get_groups_root_slug() . '/' . $bp->current_item . '/' . $bp->current_action . '/'; }