function _DatabaseHandler::get_degree_id

4.x _DatabaseHandler.php _DatabaseHandler::get_degree_id($major_and_track_code, $catalog_year, $bool_use_draft = false)
5.x _DatabaseHandler.php _DatabaseHandler::get_degree_id($major_and_track_code, $catalog_year, $bool_use_draft = FALSE)
1 call to _DatabaseHandler::get_degree_id()

File

classes/_DatabaseHandler.php, line 1761

Class

_DatabaseHandler

Code

function get_degree_id($major_and_track_code, $catalog_year, $bool_use_draft = FALSE) 
 {
  // 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 < $GLOBALS ["fp_system_settings"]["earliest_catalog_year"]) 
   { // Lowest possible year.
    $catalog_year = $GLOBALS ["fp_system_settings"]["earliest_catalog_year"];
  }

  $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 = ?
               LIMIT 1 ", trim($major_and_track_code), $catalog_year);
  if ($this->db_num_rows($res7) > 0) 
   {
    $cur7 = $this->db_fetch_array($res7);
    return $cur7 ["degree_id"];
  }
  return false;

}