function fp_get_degree_title
Search API
7.x db.inc | fp_get_degree_title($degree_id, $bool_include_track_title = FALSE, $bool_include_html = TRUE, $bool_use_draft = FALSE, $bool_include_major_code = FALSE) |
6.x db.inc | fp_get_degree_title($degree_id, $bool_include_track_title = FALSE, $bool_include_html = TRUE, $bool_use_draft = FALSE, $bool_include_major_code = FALSE) |
5.x db.inc | fp_get_degree_title($degree_id, $bool_include_track_title = FALSE, $bool_include_html = TRUE, $bool_use_draft = FALSE, $bool_include_major_code = FALSE) |
Quick method to look up title for a degree.
2 calls to fp_get_degree_title()
- audit_display_audit in modules/
audit/ audit.module - FlightPath::flag_outdated_substitutions in classes/
FlightPath.php
File
- includes/
db.inc, line 290 - This file contains mostly db shortcuts.
Code
function fp_get_degree_title($degree_id, $bool_include_track_title = FALSE, $bool_include_html = TRUE, $bool_use_draft = FALSE, $bool_include_major_code = FALSE) {
// TODO: Check cache.
$dtitle = "";
$track_title = "";
// Still no title? Try to load ANY degree title with this degree's
// major_code.
$table_name = "degrees";
if ($bool_use_draft) {
$table_name = "draft_$table_name";
}
$res = db_query("SELECT * FROM $table_name
WHERE degree_id = ?
ORDER BY catalog_year DESC LIMIT 1", $degree_id);
$cur = db_fetch_array($res);
if (!$cur) {
return '';
}
$dtitle = $cur ["title"];
$major_code = $cur ['major_code'];
$o_major_code = $cur ['major_code'];
$catalog_year = $cur ['catalog_year'];
if ($bool_include_track_title) {
// Get track title
if (strstr($major_code, "_"))
{
// This means that there is a track. Get all the information
// you can about it.
$temp = explode("_", $major_code);
$track_code = trim($temp [1]);
$major_code = trim($temp [0]);
// 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);
}
// Now, look up information on the track.
$table_name = "degree_tracks";
if ($bool_use_draft) {
$table_name = "draft_$table_name";
}
$res = db_query("SELECT track_title FROM $table_name
WHERE major_code = '?'
AND track_code = '?'
AND catalog_year = '?' ", $major_code, $track_code, $catalog_year);
$cur = db_fetch_array($res);
$track_title = $cur ["track_title"];
}
if ($track_title != "") {
if ($bool_include_html) {
$dtitle .= "<span class='level-3-raquo'>»</span>";
}
$dtitle .= $track_title;
}
}
if ($bool_include_major_code) {
$dtitle .= " [$major_code]";
}
return $dtitle;
}