function _CourseList::assign_unselectable_courses_with_hours_greater_than

4.x _CourseList.php _CourseList::assign_unselectable_courses_with_hours_greater_than($hours)
5.x _CourseList.php _CourseList::assign_unselectable_courses_with_hours_greater_than($hours)

Go through the list and find any course whose hours are greater than $hours. Make that course "unselectable." Used in the groups.

For example, if a student may only select 3 hours from a group, we don't want to give them the option of selecting a 5 hour course. But we also don't want to remove that course either. We want to display it so they know it was an option (and possibly need to substitute or move things around if they need it).

Returns TRUE if anything got assigned, FALSE if nothing got assigned.

Parameters

int $hours:

Return value

bool

File

classes/_CourseList.php, line 71

Class

_CourseList

Code

function assign_unselectable_courses_with_hours_greater_than($hours) 
 {
  // Go through the list and assign bool_unselectable courses whose minHour
  // is greater than $hours.
  // Returns TRUE if it did assign something,
  // false if it didn't.

  $bool_assigned = false;

  for ($t = 0; $t < $this->count; $t++) 
   {
    $course = $this->array_list [$t];
    if ($course->subject_id == "") 
     {
      $course->load_descriptive_data();
    }

    if ($course->min_hours > $hours) 
     {
      $course->bool_unselectable = true;
      $bool_assigned = true;
    }
  }

  return $bool_assigned;

}