/** * returns a toolbar for wpp users when viewing a single profile page, * or used for buttons on individual profiles in view mode */ public static function wpp_profile_toolbar($user_id, $profile_page_id, $cv_URL = false) { $last_login_date = ltp_data::get_previous_login($user_id); $profiles_added = ltp_data::get_profiles_added_since($last_login_date); $toolbar = self::get_status_line($user_id, $last_login_date, $profiles_added); $saved_profiles = ltp_data::has_saved($user_id); $toolbar .= sprintf('<form action="%s" method="post" class="toolbar-buttons">', $_SERVER["REQUEST_URI"]); $toolbar .= sprintf('<input type="hidden" name="user_id" value="%s">', $user_id); $toolbar .= sprintf('<input type="hidden" name="profile_page_id" value="%s">', $profile_page_id); $toolbar .= sprintf('<a class="profile-button" href="%s">View all profiles</a>', ltp_get_page_url('viewer')); if ($saved_profiles) { $toolbar .= sprintf('<a class="profile-button" href="%s#saved">View Saved Profiles</a>', ltp_get_page_url('viewer')); } if ($cv_URL) { $toolbar .= sprintf('<input type="hidden" name="cv_url" value="%s">', esc_attr($cv_URL)); $toolbar .= '<button name="action" value="cv_download" class="ppt-button ajax-button">Download CV</button>'; } if (ltp_data::is_saved($user_id, $profile_page_id)) { $toolbar .= sprintf('<button name="action" value="remove" class="ppt-button ajax-button">Remove</button>'); } else { $toolbar .= sprintf('<button name="action" value="save" class="ppt-button ajax-button">Save</button>'); } $toolbar .= '</form>'; return $toolbar; }
} elseif (ltp_is_student()) { ltp_redirect_to("builder"); } } } else { ltp_redirect_to('login'); } // get the people pages - admins see drafts as well $post_status = ltp_is_admin() ? array('publish', 'draft') : 'publish'; $people_pages = get_posts(array('post_type' => 'people', 'nopaging' => true, 'post_status' => $post_status, 'orderby' => 'modified')); ltp_data::save_actions(); get_header(); print '<div class="section sticky toolbar">'; global $current_user; $previous_login_date = ltp_data::get_previous_login($current_user->ID); $profiles_added = ltp_data::get_profiles_added_since($previous_login_date); print ltp_template::wpp_toolbar($current_user->ID, $previous_login_date, $profiles_added); print '</div>'; print '<div class="ltp-profiles">'; if (count($people_pages)) { // get all students $students = array(); $users = get_users(array('role' => 'student', 'fields' => 'all')); if (count($users)) { foreach ($users as $user) { $students[$user->user_login] = ltp_template::get_user_data($user); } } // apply filters on $students to see which pages are to be displayed //$to_display = apply_filters( 'ltp_results', $students ); $count = 0;