admin_get_course_id_array_from_course_array

4.x admin.groups.inc admin_get_course_id_array_from_course_array($course_array)

File

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

Code

function admin_get_course_id_array_from_course_array($course_array) {

  $rtn_array = array();
  $db = new DatabaseHandler();

  // MUST use foreach instead of for since we did
  // array_unique!  Can't trust count($arr)!
  foreach ($course_array as $t => $value) {
    $line = trim($course_array[$t]);
    if ($line == "~~" || $line == "") {
      continue;
    }
    $count++;
    $temp = explode(" ~~ ", $line);
    $si = trim($temp[0]);
    $cn = trim($temp[1]);

    $course_id = $db->get_course_id($si, $cn, "", true);
    $rtn_array[] = "$course_id"; // force into a string.
  }

  return $rtn_array;
}