function bp_gtm_personal_nav() { global $bp; $bp_gtm = get_option('bp_gtm'); if ($bp_gtm['p_todo'] == 'on') { $gtm_profile_link = $bp->loggedin_user->domain . $bp->gtm->slug . '/'; $filter['user'] = $bp->loggedin_user->id; $filter['not_navi'] = 1; $count_ass = BP_GTM_Personal::get_count($filter); // Main Navi bp_core_new_nav_item(array('name' => $bp_gtm['label_assignments'] . ' (' . $count_ass['all'] . ')', 'slug' => $bp->gtm->slug, 'position' => 45, 'show_for_displayed_user' => bp_is_my_profile(), 'screen_function' => 'bp_gtm_personal_pages', 'default_subnav_slug' => 'tasks', 'item_css_id' => $bp->gtm->id)); // Subnav items in profile bp_core_new_subnav_item(array('name' => __('Tasks', 'bp_gtm') . ' (' . $count_ass['tasks'] . ')', 'slug' => 'tasks', 'parent_url' => $gtm_profile_link, 'parent_slug' => $bp->gtm->slug, 'screen_function' => 'bp_gtm_personal_pages', 'position' => 10, 'user_has_access' => bp_is_my_profile())); bp_core_new_subnav_item(array('name' => __('Projects', 'bp_gtm') . ' (' . $count_ass['projects'] . ')', 'slug' => 'projects', 'parent_url' => $gtm_profile_link, 'parent_slug' => $bp->gtm->slug, 'screen_function' => 'bp_gtm_personal_pages', 'position' => 20, 'user_has_access' => bp_is_my_profile())); bp_core_new_subnav_item(array('name' => __('Settings', 'bp_gtm'), 'slug' => 'settings', 'parent_url' => $gtm_profile_link, 'parent_slug' => $bp->gtm->slug, 'screen_function' => 'bp_gtm_personal_pages', 'position' => 30, 'user_has_access' => bp_is_my_profile())); } }
function bp_gtm_personal_tasks_navi($filter, $per_page = 20) { global $bp, $wpdb; $cur = 1; $tasks = BP_GTM_Personal::get_count($filter); $pages = ceil($tasks / $per_page); if ($pages > 1) { echo '<p class="navi" id="' . $tasks . '">'; echo sprintf(__('<span id="cur_tasks">%s - %s</span> out of %s. ', 'bp_gtm'), $cur, $per_page, $tasks); _e('Pagination:', 'bp_gtm'); for ($i = 0; $i < $pages; $i++) { $c = $i + 1; $cur = $cur - 1; if ($cur != $i) { echo ' <a id="' . $i . '-' . $per_page . '" class="task_navi" href="#">' . $c . '</a>'; } else { echo ' <a id="' . $i . '-' . $per_page . '" class="task_navi current" href="#">' . $c . '</a>'; } } echo '</p>'; } else { echo sprintf(_n('There is only %d task you are responsible for.', '%d tasks you are responsible for. You may use filters.', $tasks, 'bp_gtm'), $tasks); } }
function bp_gtm_get_personal_profile_settings() { global $bp; $options['filter'] = !empty($_GET['filter']) ? $_GET['filter'] : ''; if (empty($_GET['filter']) || $_GET['filter'] == 'deadline') { $options['projects'] = BP_GTM_Personal::get_projects($bp->loggedin_user->id, $options['filter']); $options['h4_title'] = __('Personal Projects by Deadline', 'bp_gtm'); $options['styles_d_cur'] = 'grey'; } elseif ($_GET['filter'] == 'alpha') { $options['projects'] = BP_GTM_Personal::get_projects($bp->loggedin_user->id, $options['filter']); $options['h4_title'] = __('Personal Projects by A/Z', 'bp_gtm'); $options['styles_a_cur'] = 'grey'; } return $options; }