function admin_get_course_array_from_definition_data

7.x admin.groups.inc admin_get_course_array_from_definition_data($subject_data, $course_numData, $catalog_year = "", $school_id = 0, $bool_check_allow_default_school = FALSE)
6.x admin.groups.inc admin_get_course_array_from_definition_data($subject_data, $course_numData, $catalog_year = "", $school_id = 0, $bool_check_allow_default_school = FALSE)
4.x admin.groups.inc admin_get_course_array_from_definition_data($subject_data, $course_numData, $catalog_year = "")
5.x admin.groups.inc admin_get_course_array_from_definition_data($subject_data, $course_numData, $catalog_year = "")
1 call to admin_get_course_array_from_definition_data()

File

modules/admin/admin.groups.inc, line 894

Code

function admin_get_course_array_from_definition_data($subject_data, $course_numData, $catalog_year = "") {

  // Looks at the subjectData and course_numData fields, and constructs
  // a query to pull our every course which matches it.

  $rtn_array = array();

  $si = str_replace("*", "%", $subject_data);
  $cn = str_replace("*", "%", $course_numData);

  $catalog_line = "";
  if ($catalog_year != "") {
    $catalog_line = "AND catalog_year = '$catalog_year'";
  }


  $query = "SELECT * FROM draft_courses
        WHERE 
          subject_id LIKE '?'
        AND course_num LIKE '?'
        AND course_id > 0
        $catalog_line
        GROUP BY subject_id, course_num
        ";
  $res = db_query($query, $si, $cn);
  while ($cur = db_fetch_array($res)) {
    $course_id = $cur ["course_id"];

    if (in_array($course_id, $rtn_array)) {
      continue;
    }
    $rtn_array [] = $course_id;

  }

  return $rtn_array;
}