function student_search_student_select_switchboard

7.x student_search.module student_search_student_select_switchboard()
6.x student_search.module student_search_student_select_switchboard()

The user has selected a student (clicked on a row) from the Search or My Advisees screen.

We now decide where the user is sent to, based on their settings. Ex: Do they go to the Student Profile page, do they go to the Degree tab, etc?

File

modules/student_search/student_search.module, line 163

Code

function student_search_student_select_switchboard() {

  // As in the advise_display_view, we need to "initialize" this student fresh...
  global $user, $fp, $degree_plan, $screen, $current_student_id;


  // Do we need to rebuild the course inventory cache?
  if (system_check_course_inventory_should_be_reloaded()) {
    system_reload_and_cache_course_inventory();
  }


  $GLOBALS ["fp_advising"]["advising_what_if"] = "no";
  $_REQUEST ["advising_what_if"] = "no";


  // Initialize everything we need to initialize for this advising session.
  advise_init_screen();


  $_SESSION ["last_student_selected"] = $current_student_id;

  // At this point, we decide where they are going to be redirected to, using fp_goto.
  $goto_tab = @$user->settings ['default_student_load_tab'];
  if (!$goto_tab || $goto_tab == "") {
    // No specific setting, so use the system's default setting.
    $goto_tab = variable_get('system_default_student_load_tab', 'profile');
  }

  ////////////////////////


  if ($goto_tab == "profile") {
    fp_goto("student-profile");
  }

  if ($goto_tab == 'engagements') {
    fp_goto("engagements");
  }


  if ($goto_tab == "degree") {
    // Do we mean their normal "view" URL, or do we mean What If?
    $query = "";
    $path = "view";
    if (@$_REQUEST ['what_if_major_code'] != "") {
      $path = "what-if";
      //&what_if_major_code=$what_if_major_code&what_if_track_code=$what_if_track_code&what_if_catalog_year=$what_if_catalog_year
      $query = "what_if_major_code=" . $_REQUEST ['what_if_major_code'] . "&what_if_track_code=" . $_REQUEST ['what_if_track_code'] . "&what_if_catalog_year=" . $_REQUEST ['what_if_catalog_year'];
    }
    fp_goto($path, $query);
  }



  return "";

}