function AdvisingScreen::display_popup_group_select_course_list

6.x AdvisingScreen.php AdvisingScreen::display_popup_group_select_course_list(CourseList $course_list = null, $group_hours_remaining = 0)

Accepts a CourseList object and draws it out to the screen. Meant to be called by display_popup_group_select();

Parameters

CourseList $course_list:

int $group_hours_remaining:

Return value

string

1 call to AdvisingScreen::display_popup_group_select_course_list()
AdvisingScreen::display_popup_group_select in classes/AdvisingScreen.php
This function displays the popup which lets a user select a course to be advised into a group.

File

classes/AdvisingScreen.php, line 6106

Class

AdvisingScreen

Code

function display_popup_group_select_course_list(CourseList $course_list = null, $group_hours_remaining = 0) 
 {
  // Accepts a CourseList object and draws it out to the screen.  Meant to
  // be called by display_popup_group_select().
  $rtn = "";

  if ($course_list == null) 
   {

    return;
  }

  $old_course = null;
  $bool_has_recommended = FALSE;
  $course_list->reset_counter();
  while ($course_list->has_more()) 
   {
    $course = $course_list->get_next();
    if ($course->equals($old_course)) 
     { // don't display the same course twice in a row.
      continue;
    }

    if ($course->db_group_attributes == "*") {
      $bool_has_recommended = TRUE;
    }

    $rtn .= "<tr><td colspan='8'>";

    // Only display this course for advising IF it hasn't been fulfilled, or if it has infinite repeats, and only if it isn't already
    // advised to be taken.
    if (($course->course_list_fulfilled_by->is_empty || $course->specified_repeats == Group::GROUP_COURSE_INFINITE_REPEATS) && !$course->bool_advised_to_take) {
      // So, only display if it has not been fulfilled by anything.     

      $rtn .= $this->draw_popup_group_select_course_row($course, $group_hours_remaining);
      $old_course = $course;
    }
    $rtn .= "</td></tr>";
  }


  if ($bool_has_recommended) {
    $rtn .= "<tr><td colspan='8'><span class='group-recommended-message'>" . t("<b>Note:</b> Courses in <strong>bold</strong> are recommended.") . "</span></td></tr>";
  }


  return $rtn;
}