function DegreePlan::get_available_tracks

6.x DegreePlan.php DegreePlan::get_available_tracks()

Returns a simple array with values seperated by " ~~ " in this order: track_code ~~ track_title ~~ trackDesc ~~ track's degree id

Return value

array

File

classes/DegreePlan.php, line 1081

Class

DegreePlan

Code

function get_available_tracks() 
 {
  $rtn_array = array();

  $rtn_array [] = "  ~~ None ~~ Select this option to display
            the base degree plan (may not be available for all majors).";
  $table_name = "degree_tracks";
  $table_name2 = "degrees";
  if ($this->bool_use_draft) {
    $table_name = "draft_$table_name";
  }
  if ($this->bool_use_draft) {
    $table_name2 = "draft_$table_name2";
  }

  $res = db_query("SELECT track_code, track_title, track_description FROM $table_name
                              WHERE major_code = ?
                              AND catalog_year = ? 
                              AND school_id = ?
                              ORDER BY track_title ", $this->major_code, $this->catalog_year, $this->school_id);
  while ($cur = db_fetch_array($res)) 
   {

    $track_code = $cur ["track_code"];
    $track_title = $cur ["track_title"];
    $track_description = $cur ["track_description"];


    // Let's also get the degree_id for this particular track.
    $track_degree_id = $this->db->get_degree_id($this->major_code . "|_" . $track_code, $this->catalog_year, $this->bool_use_draft, $this->school_id);

    // Also find out what is the degree_class for this degree_id.
    $degree_class = @trim(db_result(db_query("SELECT degree_class FROM $table_name2
                        WHERE degree_id = ?", $track_degree_id)));


    $rtn_array [] = "$track_code ~~ $track_title ~~ $track_description ~~ $track_degree_id ~~ $degree_class";
  }

  if (count($rtn_array) > 1) // we're going to have at least 1 because of the "none" option.  Let's skip that one.
   {
    return $rtn_array;
  }
  else {
    return false;
  }


}