Example #1
0
 /**
  * returns a sticky toolbar for WPP users which will appear at the top of the profile viewer page
  * includes filters and links to saved profiles, etc.
  */
 public static function wpp_toolbar($user_id, $last_login_date, $profiles_added)
 {
     $toolbar = self::get_status_line($user_id, $last_login_date, $profiles_added);
     $toolbar .= '<div class="toolbar-buttons">';
     // View buttons
     // view all profiles button
     $toolbar .= '<a href="#all" id="view-all" class="profile-button">View All Profiles</a>';
     // view saved profiles button
     $toolbar .= '<a href="#saved" id="view-saved" class="profile-button">View Saved Profiles</a>';
     // view filtered profiles button
     $toolbar .= '<a href="#filtered" id="view-filtered" class="profile-button">View Filtered Profiles</a>';
     // view latest profiles button
     $toolbar .= '<a href="#latest" id="view-latest" class="profile-button">View Latest Profiles</a>';
     // Filters control buttons
     // show filters button
     $toolbar .= sprintf('<a href="#" id="show-filters" class="profile-button">Filter Profiles</a>');
     // edit filters button
     $toolbar .= sprintf('<a href="#" id="edit-filters" class="profile-button">Edit filters</a>');
     // apply filters button
     $toolbar .= sprintf('<a href="#" id="apply-filters" class="profile-button">Apply filters</a>');
     $toolbar .= '</div>';
     // Filters
     $toolbar .= '<div id="profile-filters">';
     $fields = PeoplePostType::get_profile_fields();
     $filters = array("expertise" => array("label" => "Students with expertise in:", "no-selection" => "Anything", "options" => array()), "experience" => array("label" => "Minimum experience (years):", "no-selection" => "No minimum", "options" => array()), "region" => array("label" => "Students who are currently based in:", "no-selection" => "Any region", "options" => array()), "desired_region" => array("label" => "Students who wish to work in:", "no-selection" => "Any region", "options" => array()));
     // get options for each filter
     foreach ($fields as $field) {
         if (in_array($field["name"], array_keys($filters))) {
             $filters[$field["name"]]["options"] = $field["options"];
         }
     }
     $filter_list = '<div id="filter-list"><h3>Filter profiles by:</h3><ul>';
     $filter_controls = '<div id="filter-controls">';
     foreach ($filters as $filter => $data) {
         $active = $filter === "expertise" ? ' active' : '';
         if (count($data["options"])) {
             $filter_list .= sprintf('<li><a href="#filters-%s" class="show-filter-controls%s">%s</a><span class="current-filters-list" id="current-filters-%s" data-no-selection="%s"></span></li>', $filter, $active, $data["label"], $filter, esc_attr($data["no-selection"]));
             $filter_controls .= sprintf('<div class="checkbox-list %s" id="filters-%s"><a class="select-filters-button all" href="#" data-selectid="filters-%s" title="Select all">select all</a><a class="select-filters-button none" href="#" data-selectid="filters-%s" title="Select none">select none</a>', $active, $filter, $filter, $filter);
             //$toolbar .= sprintf('<p class="label">%s</p><div class="checkbox-list" id="filters-%s">', $data["label"], $filter );
             foreach ($data["options"] as $option) {
                 $option_value = $filter . '-' . preg_replace('/[^a-zA-Z0-9]+/', '', $option);
                 //$toolbar .= sprintf('<label for="%s"><input type="checkbox" name="%s" id="%s" value="1"> %s</label>', $option_value, $filter, $option_value, $option );
                 $filter_controls .= sprintf('<label for="%s"><input type="checkbox" name="%s" id="%s" value="1" data-filter-label="%s"> %s</label>', $option_value, $filter, $option_value, esc_attr($option), $option);
             }
             $filter_controls .= '</div>';
             //$toolbar .= '</div></div>';
         }
     }
     $filter_list .= '</ul><a href="#" id="delete-filters" class="profile-button">Delete filters</a><a href="#" id="cancel-filters" class="profile-button">Cancel</a></div>';
     $filter_controls .= '</div>';
     $toolbar .= $filter_list . $filter_controls . '</div>';
     return $toolbar;
 }
            echo PeoplePostType::get_profile_field_control(array('field_name' => 'desired_region'));
            print '</div></div>';
            print '<div class="section"><h3>4. Expertise</h3><div class="checkbox-list">';
            echo PeoplePostType::get_profile_field_control(array('field_name' => 'expertise'));
            print '</div></div>';
            print '<div class="section"><h3>5. Achievements</h3>';
            echo PeoplePostType::get_profile_field_control(array('field_name' => 'achievements'));
            print '</div>';
            //personal Statement
            print '<div class="section"><h3>6. Personal Statement</h3>';
            echo PeoplePostType::get_profile_field_control(array('field_name' => 'statement'));
            print '<h4>Curriculum Vitae</h4><p>Upload a copy of your C.V. in PDF format</p>';
            echo PeoplePostType::get_profile_field_control(array('field_name' => 'cv'));
            print '</div>';
            for ($i = 1; $i <= 3; $i++) {
                printf('<div class="section"><h3>%d. Showcase %d</h3>', $i + 6, $i);
                echo PeoplePostType::get_profile_field_control(array('field_name' => 'showcase' . $i . '_title'));
                echo PeoplePostType::get_profile_field_control(array('field_name' => 'showcase' . $i . '_text'));
                echo PeoplePostType::get_profile_field_control(array('field_name' => 'showcase' . $i . '_image'));
                echo '<p style="margin:0;"><em>Or video&hellip;</em></p>';
                echo PeoplePostType::get_profile_field_control(array('field_name' => 'showcase' . $i . '_video'));
                echo PeoplePostType::get_profile_field_control(array('field_name' => 'showcase' . $i . '_file'));
                print '</div>';
            }
            print '</form>';
        } else {
            print '<p>This template requires the People Post Type Plugin to be installed and activated.</p>';
        }
    }
}
get_footer();