function DegreePlan::get_title2

6.x DegreePlan.php DegreePlan::get_title2($bool_include_classification = FALSE, $bool_include_track_title = FALSE, $bool_include_html = TRUE)

File

classes/DegreePlan.php, line 824

Class

DegreePlan

Code

function get_title2($bool_include_classification = FALSE, $bool_include_track_title = FALSE, $bool_include_html = TRUE) 
 {
  // This will simply return the degree's title.  If it does not
  // exist, it will try to find another degree with the same major_code.
  // This is to fix the problem with students with catalog years outside
  // of FlightPath's database, but with major codes that have titles.

  if (!$this->bool_loaded_descriptive_data) {
    $this->load_descriptive_data();
  }

  $dtitle = "";

  if ($this->title) {
    $dtitle = $this->title;
    if ($bool_include_html) {
      $dtitle = "<span class='deg-title'>$this->title</span>";
    }
  }
  else {


    // Still no title?  Try to load ANY degree title with this degree's
    // major_code.
    $this->title = '';
    $table_name = "degrees";
    if ($this->bool_use_draft) {
      $table_name = "draft_$table_name";
    }

    $res = $this->db->db_query("SELECT title FROM $table_name
                              WHERE major_code = ? 
                              ORDER BY catalog_year DESC LIMIT 1", $this->major_code);
    $cur = $this->db->db_fetch_array($res);
    if ($cur) {
      $this->title = trim($cur ["title"]);
    }
    if ($bool_include_html && $this->title) {
      $dtitle = "<span class='deg-title'>$this->title</span>";
    }
    else {
      $dtitle = $this->title;
    }
  }


  if ($bool_include_track_title && $this->track_title != "") {
    if ($bool_include_html && $this->title) {
      $dtitle .= "<span class='level-3-raquo'>&raquo;</span>";
      $dtitle .= "<span class='deg-track-title'>$this->track_title</span>";
    }
    else {
      $dtitle .= $this->track_title;
    }
  }

  if ($bool_include_classification && $this->degree_class != "") {
    $details = fp_get_degree_classification_details($this->degree_class);
    if ($bool_include_html) {
      $dtitle .= " <span class='deg-class-title'>(" . $details ["title"] . ")</span>";
    }
    else {
      $dtitle .= " (" . $details ["title"] . ")";
    }
  }


  return $dtitle;
}