function FlightPath::get_all_courses_in_catalog_year

7.x FlightPath.php FlightPath::get_all_courses_in_catalog_year($catalog_year = "2006", $bool_load_descriptive_data = false, $limit_start = 0, $limit_size = 0, $school_id = 0, $bool_only_undergrad = TRUE, $bool_skip_excluded = FALSE)
6.x FlightPath.php FlightPath::get_all_courses_in_catalog_year($catalog_year = "2006", $bool_load_descriptive_data = false, $limit_start = 0, $limit_size = 0, $school_id = 0, $bool_only_undergrad = TRUE, $bool_skip_excluded = FALSE)

File

classes/FlightPath.php, line 1139

Class

FlightPath

Code

function get_all_courses_in_catalog_year($catalog_year = "2006", $bool_load_descriptive_data = false, $limit_start = 0, $limit_size = 0, $school_id = 0, $bool_only_undergrad = TRUE, $bool_skip_excluded = FALSE) 
 {
  // Returns a CourseList object of all the
  // courses in the supplied catalog_year.

  $lim_line = "";
  if ($limit_size > 0) 
   {
    $lim_line = " limit $limit_start, $limit_size ";
  }
  $rtn_list = new CourseList();
  $c_array = array();

  $params = array();
  $params [":catalog_year"] = $catalog_year;
  $params [":school_id"] = $school_id;


  $exclude_line = "";
  if ($bool_skip_excluded) {
    $exclude_line = " AND exclude = 0 ";
  }

  $course_num_line = "";
  if ($bool_only_undergrad) {
    $course_num_line = " AND course_num < :gradnum ";
    $params [":params"] = variable_get_for_school("graduate_level_course_num", 5000, $school_id);
  }


  $result = $this->db->db_query("SELECT * FROM courses
              WHERE 
                catalog_year = :catalog_year
                $course_num_line
                AND school_id = :school_id
                AND delete_flag = 0
                $exclude_line
              ORDER BY subject_id, course_num
              $lim_line
              ", $params);

  while ($cur = $this->db->db_fetch_array($result)) 
   {


    $course = new Course();
    $course->course_id = $cur ["course_id"];
    $course->subject_id = $cur ["subject_id"];
    $course->course_num = $cur ["course_num"];
    $course->min_hours = $cur ["min_hours"];
    $course->max_hours = $cur ["max_hours"];

    if ($bool_load_descriptive_data == true) 
     {
      $course->load_descriptive_data();
    }

    $rtn_list->add($course);
  }

  return $rtn_list;

}