function _CourseList::find_first_selectable

4.x _CourseList.php _CourseList::find_first_selectable()
5.x _CourseList.php _CourseList::find_first_selectable()

Returns the first course in the list which the user may select for advising. This method is used by the popup window to determine what exactly is the first element of the course list. (so it can make that radio button checked).

Returns FALSE if it cannot find a selectable course.

Return value

Course

File

classes/_CourseList.php, line 1043

Class

_CourseList

Code

function find_first_selectable() 
 {
  /*

		*/
  $temp_i = $this->i; // preserve the counter.
  $this->reset_counter();

  while ($this->has_more()) 
   {
    $c = $this->get_next();
    if ($c->bool_advised_to_take == true) 
     {
      continue;
    }
    if (!$c->course_list_fulfilled_by->is_empty) 
     {
      continue;
    }
    if ($c->bool_unselectable == true) 
     {
      continue;
    }

    // $c is our valid course...
    $this->i = $temp_i;
    //print_pre($c->to_string());
    return $c;


  }

  $this->i = $temp_i;
  return false;

}