function _Course::get_all_names

4.x _Course.php _Course::get_all_names($bool_add_white_space = false, $bool_add_exclude = true)
5.x _Course.php _Course::get_all_names($bool_add_white_space = false, $bool_add_exclude = true)

This function will return a CSV string of all the possible names for this course, in alphabetical order.

This function is used by DataEntry primarily.

Parameters

bool $bool_add_white_space:

bool $bool_add_exclude:

Return value

string

File

classes/_Course.php, line 279

Class

_Course

Code

function get_all_names($bool_add_white_space = false, $bool_add_exclude = true) 
 {
  $rtn = "";

  $used_array = array();

  $table_name = "courses";
  if ($this->bool_use_draft) {
    $table_name = "draft_$table_name";
  }
  // took out: and `catalog_year`='$this->catalog_year'
  // because we don't care what catalog year it comes from...
  $res = $this->db->db_query("SELECT * FROM $table_name
						WHERE course_id = '?'
						AND delete_flag = '0' 
						ORDER BY subject_id, course_num ", $this->course_id);
  while ($cur = $this->db->db_fetch_array($res)) 
   {

    if (in_array($cur ["subject_id"] . "~" . $cur ["course_num"], $used_array)) 
     { // skip ones we have already seen.
      continue;
    }

    $used_array [] = $cur ["subject_id"] . "~" . $cur ["course_num"];

    $rtn .= $cur ["subject_id"] . " " . $cur ["course_num"];

    if ($cur ["exclude"] != '0' && $bool_add_exclude == true) 
     {
      $rtn .= " exclude";
    }

    $rtn .= ",";
    if ($bool_add_white_space == true) 
     {
      $rtn .= " ";
    }
  }

  $rtn = trim($rtn);
  // remove last comma.
  $rtn = substr($rtn, 0, -1);

  return $rtn;
}