function _Course::set_catalog_year_from_term_id

4.x _Course.php _Course::set_catalog_year_from_term_id()
5.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 1284

Class

_Course

Code

function set_catalog_year_from_term_id() 
 {

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

  if (strstr($this->term_id, "1111")) 
   {
    $this->catalog_year = $GLOBALS ["fp_system_settings"]["earliest_catalog_year"];
  }

  $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 > $GLOBALS ["fp_system_settings"]["current_catalog_year"]) 
   {
    $this->catalog_year = $GLOBALS ["fp_system_settings"]["current_catalog_year"];
  }



}