function Course::set_catalog_year_from_term_id

6.x Course.php Course::set_catalog_year_from_term_id()

Based on $this->term_id, set what catalog year should go with the course.

File

classes/Course.php, line 1885

Class

Course

Code

function set_catalog_year_from_term_id() 
 {

  if ($this->db == null) 
   {
    $this->db = get_global_database_handler();
  }

  if (strstr($this->term_id, "1111")) 
   {

    $this->catalog_year = variable_get_for_school("earliest_catalog_year", 2006, $this->school_id);
  }

  $this->catalog_year = trim(substr($this->term_id, 0, 4));

  // If the catalog year is greater than the currentCatalogYear
  // setting, then set it to that.


  if ($this->catalog_year > variable_get_for_school("current_catalog_year", "", $this->school_id)) 
   {
    $this->catalog_year = variable_get_for_school("current_catalog_year", "", $this->school_id);
  }



}