fp_get_student_majors

5.x db.inc fp_get_student_majors($student_cwid, $bool_return_as_csv = FALSE, $bool_return_as_full_record = FALSE, $perform_join_with_degrees = TRUE, $bool_skip_directives = TRUE, $bool_check_for_allow_dynamic = TRUE)

Return back the codes or records for a student's degrees, based on what is in the student_degrees table (thanks to system.module), as well as what we get from hooks.

4 calls to fp_get_student_majors()
advise_display_popup_change_track in modules/advise/advise.module
advise_display_popup_change_track_non_dynamic_degree in modules/advise/advise.module
This is the "change track" popup we will display if the degree cannot be combined with anything else (non-dynamic).
student_search_query_advisees in modules/student_search/student_search.module
Accepts the SQL, plus an array of parameters compatible with our PDO set up. ex: $params[":name"] = "Bob" and $sql = " SELECT * where name = :name";
_Student::load_student_data in classes/_Student.php
This loads a student's personal data, like name and so forth.

File

includes/db.inc, line 364
This file contains mostly db shortcuts.

Code

function fp_get_student_majors($student_cwid, $bool_return_as_csv = FALSE, $bool_return_as_full_record = FALSE, $perform_join_with_degrees = TRUE, $bool_skip_directives = TRUE, $bool_check_for_allow_dynamic = TRUE) {

  $params = array(
    $student_cwid,
    $bool_return_as_full_record,
    $perform_join_with_degrees,
    $bool_skip_directives,
    $bool_check_for_allow_dynamic,
  );

  // Execute hook for this too.
  $arr = invoke_hook("fp_get_student_majors", $params);

  // Results will appear in an array, with each module as the index.
  // Ex:
  //   system
  //      MAJOR1 => MAJOR1
  //      MAJOR2 => MAJOR2
  //   custom_module
  //      MAJOR1 => MAJOR1
  //      XYZ => XYZ


  $new_arr = array();
  $csv = "";
  // Go through our modules, combine the identical ones, then prepare as a possible CSV.
  foreach ($arr as $module => $results) {
    foreach ($results as $k => $v) {
      $new_arr[$k] = $v;
    }
  }

  $rtn = $new_arr;


  // Returning as a CSV?

  if ($bool_return_as_csv) {
    foreach ($new_arr as $k => $v) {
      $csv .= $k . ",";
    }
    $csv = rtrim($csv, ",");
    $rtn = $csv;
  }




  return $rtn;

}