function Student::load_significant_courses

6.x Student.php Student::load_significant_courses()
1 call to Student::load_significant_courses()

File

classes/Student.php, line 107

Class

Student

Code

function load_significant_courses() 
 {
  // This will attempt to add as much to the array_significant_courses
  // as we can, which was not previously determined.
  // For example: courses we were advised to take and/or
  // substitutions.

  // Now, when this gets called, it's actually *before* we
  // write any subs or advisings to the database, so what we
  // actually need to do is go through the POST
  // and add any course_id's we find.
  // In the future, perhaps it would be more efficient
  // to have just one POST variable to look at, perhaps
  // comma-seperated.


  // Look in the database of advised courses for ANY course advised in
  // the range of advisingTermIDs.
  $advising_term_ids = variable_get("available_advising_term_ids", "0", $this->school_id);

  $temp = explode(",", $advising_term_ids);
  foreach ($temp as $term_id) 
   {
    $term_id = trim($term_id);
    $res = $this->db->db_query("SELECT * FROM advising_sessions a,
              advised_courses b
              WHERE a.student_id = ?
              AND a.advising_session_id = b.advising_session_id
              AND a.term_id = ?             
              AND a.is_draft = 0 ", $this->student_id, $term_id);
    while ($cur = $this->db->db_fetch_array($res)) 
     {
      $this->array_significant_courses [$cur ["course_id"]] = true;
    }
  }


  // Now, look for any course which a substitution might have been
  // performed for...
  $res = $this->db->db_query("SELECT * FROM student_substitutions
                    WHERE student_id = ? ", $this->student_id);
  while ($cur = $this->db->db_fetch_array($res)) {
    $this->array_significant_courses [$cur ["required_course_id"]] = true;
  }


}