function _Course::get_hours_awarded

5.x _Course.php _Course::get_hours_awarded($degree_id = 0, $bool_use_first_found_if_not_found_by_degree = TRUE)

If the boolean is set, it means if the supplied degree_id isn't set, then use the first found value.

3 calls to _Course::get_hours_awarded()
_Course::get_hours in classes/_Course.php
Figure out the number of hours this particular instance of the course is worth. In the case of variable hours, it will return the number of hours selected. If that does not exist, it will return the MIN HOURS.
_Course::to_data_string in classes/_Course.php
This function will create a "data string" of the course. Think of it as a poor man's serialize. I can't actually use serialize, as I have to call this for every course on the screen, and the page load time was too long when using…
_Course::to_string in classes/_Course.php
This is the to_string method for Course. Because we want to pass it values, we are not using the magic method of "__to_string". So, to use, invoke this method directly. Ex:

File

classes/_Course.php, line 347

Class

_Course

Code

function get_hours_awarded($degree_id = 0, $bool_use_first_found_if_not_found_by_degree = TRUE) {
  // If degree_id is zero, then use the course's currently req_by_degree_id.    
  if ($degree_id == 0) {
    $degree_id = $this->req_by_degree_id;
  }

  if ($degree_id > 0) {
    //return $this->course_substitution_by_degree_array[$degree_id];
    if (isset($this->details_by_degree_array [$degree_id]["hours_awarded"])) {
      $x = $this->get_details_by_degree($degree_id, "hours_awarded") * 1; // *1 forces numeric and trimes extra zeroes.
    }
    else if ($bool_use_first_found_if_not_found_by_degree) {
      // It wasn't set, so get the first value that WAS set.
      $x = $this->get_first_value_from_any_degree("hours_awarded");
    }
    if ($x) {
      return $x;
    }

  }
  else {

    // We just want the first value of ANY degree returned.
    $x = $this->get_first_value_from_any_degree("hours_awarded");
    if ($x) {
      return $x;
    }

  }

  // Else, return zero
  return 0;


}