function _AdvisingScreen::display_group

4.x _AdvisingScreen.php _AdvisingScreen::display_group(Group $place_group)
5.x _AdvisingScreen.php _AdvisingScreen::display_group(Group $place_group)

This function displays a Group object on the degree plan. This is not the selection popup display. It will either show the group as multi rows, filled in with courses, or as a "blank row" for the user to click on.

Parameters

Group $place_group:

Return value

string

1 call to _AdvisingScreen::display_group()
_AdvisingScreen::display_semester in classes/_AdvisingScreen.php
Given a Semester object, this will generate the HTML to draw it out to the screen.

File

classes/_AdvisingScreen.php, line 2358

Class

_AdvisingScreen

Code

function display_group(Group $place_group) 
 {
  // Display a group, either filled in with courses,
  // and/or with a "blank row" for the user to
  // click on.
  $pC = "";

  // Now, if you will recall, all of the groups and their courses, etc,
  // are in the degree_plan's list_groups.  The $place_group object here
  // is just a placeholder.  So, get the real group...

  if (!$group = $this->degree_plan->find_group($place_group->group_id)) 
   {
    fpm("Group not found.");
    return;
  }




  $title = $group->title;

  $display_course_list = new CourseList();

  // Okay, first look for courses in the first level
  // of the group.

  $display_semesterNum = $place_group->assigned_to_semester_num;


  $group->list_courses->remove_unfulfilled_and_unadvised_courses();
  $group->list_courses->reset_counter();
  while ($group->list_courses->has_more()) 
   {
    $course = $group->list_courses->get_next();

    // Do we have enough hours to keep going?
    $fulfilled_hours = $display_course_list->count_hours();
    $remaining = $place_group->hours_required - $fulfilled_hours;


    // If the course in question is part of a substitution that is not
    // for this group, then we should skip it.
    if (!($course->course_list_fulfilled_by->is_empty)) 
     {
      $try_c = $course->course_list_fulfilled_by->get_first();
      if ($try_c->bool_substitution == true && $try_c->assigned_to_group_id != $group->group_id) 
       {

        continue;
      }
    }


    if (!($course->course_list_fulfilled_by->is_empty) && $course->course_list_fulfilled_by->get_first()->bool_has_been_displayed != true && $course->bool_has_been_displayed != true) 
     {
      $c = $course->course_list_fulfilled_by->get_first();
      if ($remaining < $c->get_hours()) 
       {
        continue;
      }


      $c->temp_flag = false;
      $c->icon_filename = $group->icon_filename;
      $c->title_text = "This course is a member of $group->title.";
      $display_course_list->add($c);


    }

    if ($course->bool_advised_to_take && $course->bool_has_been_displayed != true && $course->assigned_to_semester_num == $display_semesterNum) 
     {
      $c = $course;
      if ($remaining < $c->get_hours()) 
       {
        continue;
      }

      $c->temp_flag = true;
      $c->icon_filename = $group->icon_filename;
      $c->title_text = "The student has been advised to take this course to fulfill a $group->title requirement.";
      $display_course_list->add($c);

    }
  }


  $group->list_groups->reset_counter();
  while ($group->list_groups->has_more()) 
   {
    $branch = $group->list_groups->get_next();
    // look for courses at this level...
    if (!$branch->list_courses->is_empty) 
     {

      $branch->list_courses->sort_alphabetical_order();
      $branch->list_courses->reset_counter();
      while ($branch->list_courses->has_more()) 
       {
        $course = $branch->list_courses->get_next();

        // Do we have enough hours to keep going?
        $fulfilled_hours = $display_course_list->count_hours();
        $remaining = $place_group->hours_required - $fulfilled_hours;

        if (!($course->course_list_fulfilled_by->is_empty) && $course->course_list_fulfilled_by->get_first()->bool_has_been_displayed != true && $course->bool_has_been_displayed != true) 
         {
          $c = $course->course_list_fulfilled_by->get_first();
          if ($remaining < $c->get_hours() || $remaining < 1) 
           {
            continue;
          }

          $c->temp_flag = false;
          $c->icon_filename = $group->icon_filename;
          $c->title_text = "This course is a member of $group->title.";

          if (!$display_course_list->find_match($c)) 
           { // Make sure it isn't already in the display list.

            $display_course_list->add($c);
          }
          else if (is_object($c->course_transfer)) 
           {
            if (!$display_course_list->find_match($c->course_transfer)) 
             { // Make sure it isn't already in the display list.
              $display_course_list->add($c);
            }
          }


        }

        if ($course->bool_advised_to_take && $course->bool_has_been_displayed != true && $course->assigned_to_semester_num == $display_semesterNum) 
         {

          $c = $course;
          if ($remaining < $c->get_hours() || $remaining < 1) 
           {

            continue;
          }

          $c->temp_flag = true;
          $c->icon_filename = $group->icon_filename;
          $c->title_text = "The student has been advised to take this course to fulfill a $group->title requirement.";
          if (!$display_course_list->find_match($c)) 
           {
            $display_course_list->add($c);
          }

        }


      }

    }
  }







  $display_course_list->sort_advised_last_alphabetical();


  $pC .= $this->display_group_course_list($display_course_list, $group, $display_semesterNum);

  $fulfilled_hours = $display_course_list->count_hours("", false, false, true);
  $fulfilled_credit_hours = $display_course_list->count_credit_hours("", false, true);


  $test_hours = $fulfilled_hours;
  // if the fulfilledCreditHours is > than the fulfilledHours,
  // then assign the fulfilledCreditHours to the testHours.
  if ($fulfilled_credit_hours > $fulfilled_hours) 
   { // done to fix a bug involving splitting hours in a substitution.		  
    $test_hours = $fulfilled_credit_hours;
  }
  // If there are any remaining hours in this group,
  // draw a "blank" selection row.
  $remaining = $place_group->hours_required - $test_hours;
  $place_group->hours_remaining = $remaining;
  $place_group->hours_fulfilled = $fulfilled_hours;
  $place_group->hours_fulfilled_for_credit = $fulfilled_credit_hours;
  if ($remaining > 0) 
   {
    $pC .= "<tr><td colspan='8' class='tenpt'>";
    $pC .= $this->draw_group_select_row($place_group, $remaining);
    $pC .= "</td></tr>";
  }


  return $pC;
}