function _DatabaseHandler::get_degrees_in_catalog_year
Search API
4.x _DatabaseHandler.php | _DatabaseHandler::get_degrees_in_catalog_year($catalog_year, $bool_include_tracks = false, $bool_use_draft = false, $bool_undergrad_only = TRUE) |
5.x _DatabaseHandler.php | _DatabaseHandler::get_degrees_in_catalog_year($catalog_year, $bool_include_tracks = false, $bool_use_draft = false, $bool_undergrad_only = TRUE, $only_level_nums = array(1, 2)) |
File
- classes/
_DatabaseHandler.php, line 1125
Class
Code
function get_degrees_in_catalog_year($catalog_year, $bool_include_tracks = false, $bool_use_draft = false, $bool_undergrad_only = TRUE)
{
// Returns an array of all the degrees from a particular year
// which are entered into FlightPath.
$table_name = "degrees";
if ($bool_use_draft) {
$table_name = "draft_$table_name";
}
if ($bool_undergrad_only) {
$undergrad_line = "AND degree_class != 'G' ";
}
$rtn_array = array();
$res = $this->db_query("SELECT * FROM $table_name
WHERE catalog_year = '?'
AND exclude = '0'
$undergrad_line
ORDER BY title, major_code ", $catalog_year);
if ($this->db_num_rows($res) < 1)
{
return false;
}
while ($cur = $this->db_fetch_array($res))
{
$degree_id = $cur ["degree_id"];
$major = trim($cur ["major_code"]);
$title = trim($cur ["title"]);
$track_code = "";
$major_code = $major;
// The major may have a track specified. If so, take out
// the track and make it seperate.
if (strstr($major, "_"))
{
$temp = explode("_", $major);
$major_code = trim($temp [0]);
$track_code = trim($temp [1]);
// The major_code might now have a | at the very end. If so,
// get rid of it.
if (substr($major_code, strlen($major_code) -1, 1) == "|")
{
$major_code = str_replace("|", "", $major_code);
}
}
// Leave the track in if requested.
if ($bool_include_tracks == true)
{
// Set it back to what we got from the db.
$major_code = $major;
$temp_degree = $this->get_degree_plan($major, $catalog_year, true);
if ($temp_degree->track_code != "")
{
$title .= " - " . $temp_degree->track_title;
}
}
$rtn_array [$major_code]["title"] = $title;
$rtn_array [$major_code]["degree_id"] = $degree_id;
$rtn_array [$major_code]["degree_class"] = trim(strtoupper($cur ["degree_class"]));
}
return $rtn_array;
}