function _CourseList::get_course_subjects

4.x _CourseList.php _CourseList::get_course_subjects($bool_ignore_excluded = true)
5.x _CourseList.php _CourseList::get_course_subjects($bool_ignore_excluded = true)

Returns an array containing the unique subject_id's of the courses in this list. Its assumed to be ordered already!

Parameters

bool $bool_ignore_excluded:

Return value

array

File

classes/_CourseList.php, line 875

Class

_CourseList

Code

function get_course_subjects($bool_ignore_excluded = true) 
 {
  // returns an array containing the unique subject_id's
  // of the courses in this list.

  // IMPORTANT:  The list is assumed to be ordered already!  Either
  // alphabetically or reverse alphabetically.
  $old_subject_id = "";
  $rtn_array = array();

  for ($t = 0; $t < $this->count; $t++) 
   {
    $course = $this->array_list [$t];
    if ($course->subject_id == "") 
     {
      $course->load_descriptive_data();
    }


    // Go through all valid names for this course.
    for ($x = 0; $x < count($course->array_valid_names); $x++) 
     {
      $temp = explode("~", $course->array_valid_names [$x]);
      $subj = strtoupper($temp [0]);

      if (in_array($subj, $rtn_array)) 
       { // skip ones with subjects we have already looked at.
        continue;
      }

      if ($course->db_exclude == 1) 
       {
        continue;
      }


      // We have a new subject.  Add it to the array.
      $rtn_array [] = $subj;
    }

  }

  return $rtn_array;
}