function Course::get_hours_awarded
Search API
7.x Course.php | Course::get_hours_awarded($degree_id = 0, $bool_use_first_found_if_not_found_by_degree = TRUE) |
6.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 337
Class
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 = floatval($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 = floatval($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 = floatval($this->get_first_value_from_any_degree("hours_awarded"));
if ($x) {
return $x;
}
}
// Else, return zero
return 0;
}