function DatabaseHandler::get_degree_id

6.x DatabaseHandler.php DatabaseHandler::get_degree_id($major_and_track_code, $catalog_year, $bool_use_draft = FALSE, $school_id = 0)
1 call to DatabaseHandler::get_degree_id()

File

classes/DatabaseHandler.php, line 1652

Class

DatabaseHandler

Code

function get_degree_id($major_and_track_code, $catalog_year, $bool_use_draft = FALSE, $school_id = 0) 
 {
  // This function expects the major_code and track_code (if it exists)
  // to be joined using |_.  Example:
  // GSBA|_123  or  KIND|EXCP_231.
  // In other words, all in one.

  // Always override if the global variable is set.
  if (@$GLOBALS ["fp_advising"]["bool_use_draft"] == true) {
    $bool_use_draft = true;
  }



  if ($catalog_year < variable_get_for_school("earliest_catalog_year", 2006, $school_id)) 
   { // Lowest possible year.
    $catalog_year = variable_get_for_school("earliest_catalog_year", 2006, $school_id);
  }

  $table_name = "degrees";
  if ($bool_use_draft) {
    $table_name = "draft_$table_name";
  }

  $res7 = $this->db_query("SELECT degree_id FROM $table_name
              WHERE major_code = ?
              AND catalog_year = ?
              AND school_id = ?
               LIMIT 1 ", trim($major_and_track_code), $catalog_year, $school_id);
  if ($this->db_num_rows($res7) > 0) 
   {
    $cur7 = $this->db_fetch_array($res7);
    return $cur7 ["degree_id"];
  }
  return false;

}