_AdvisingScreenTypeView

This class is the View by Type view for FlightPath. As such, it inherits most of it's classes from __advising_screen.

The biggest difference with View by Type from the default View by Year is that we don't care about the original semesters that were spelled out in the degree plan. We need to re-organize them into new semesters for Major, Core, Supporting, and Electives. So, most of the methods here will be about doing that.

Hierarchy

Expanded class hierarchy of _AdvisingScreenTypeView

Properties

NameDescription
_AdvisingScreen::$admin_message
_AdvisingScreen::$bool_blank
_AdvisingScreen::$degree_plan
_AdvisingScreen::$page_hide_report_error
_AdvisingScreen::$page_title
_AdvisingScreen::$screen_mode
_AdvisingScreen::$theme_location
_AdvisingScreen::$width_array

Functions & methods

NameDescription
_AdvisingScreen::add_cssThis function simply adds a reference for additional CSS to be link'd in to the theme. It is used by add-on modules.
_AdvisingScreen::add_to_screenThis function is used by the "build" functions most often. It very simply adds a block of HTML to an array called box_array.
_AdvisingScreen::build_added_coursesConstructs the HTML to show which courses have been added by an advisor.
_AdvisingScreen::build_excess_creditConstructs the HTML to show the Excess Credits list.
_AdvisingScreen::build_footnotesConstructs the HTML which will show footnotes for substitutions and transfer credits.
_AdvisingScreen::build_screen_elementsThis function calls the other "build" functions to assemble the View or What If tabs in FlightPath.
_AdvisingScreen::build_test_scoresConstructs the HTML to show the student's test scores.
_AdvisingScreen::build_transfer_creditConstructs the HTML which will be used to display the student's transfer credits
_AdvisingScreen::clear_variablesClear the session varibles.
_AdvisingScreen::determine_mobile_deviceThis function will attempt to determine automatically if we are on a mobile device. If so, it will set $this->page_is_mobile = TRUE
_AdvisingScreen::display_groupThis 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.
_AdvisingScreen::display_group_course_listDisplays all the courses in a CourseList object, using the draw_course_row function.
_AdvisingScreen::display_popup_course_descriptionDisplays the contents of the Descripton tab for the course popup.
_AdvisingScreen::display_popup_group_selectThis function displays the popup which lets a user select a course to be advised into a group.
_AdvisingScreen::display_popup_group_select_course_listAccepts a CourseList object and draws it out to the screen. Meant to be called by display_popup_group_select();
_AdvisingScreen::display_popup_substituteThis is used to display the substitution popup to a user, to let them actually make a substitution.
_AdvisingScreen::display_screenThis function generates the HTML to display the screen. Should be used in conjunction with output_to_browser()
_AdvisingScreen::display_semesterGiven a Semester object, this will generate the HTML to draw it out to the screen.
_AdvisingScreen::display_toolbox_coursesUsed in the Toolbox popup, this will display content of the tab which shows a student's courses which they have taken.
_AdvisingScreen::display_toolbox_movedUsed in the Toolbox popup, this will display content of the tab which shows a student's moved courses. That is, courses which have had their group memberships changed.
_AdvisingScreen::display_toolbox_substitutionsUsed in the Toolbox popup, this will display content of the tab which shows a student's substututions
_AdvisingScreen::display_toolbox_transfersUsed in the Toolbox popup, this will display content of the tab which shows a student's transfers
_AdvisingScreen::draw_box_bottomVery, very simple. Just returns "</table>";
_AdvisingScreen::draw_box_topUsed to draw the beginning of semester boxes and other boxes, for example the footnotes.
_AdvisingScreen::draw_buttonReturns the HTML to draw a pretty button.
_AdvisingScreen::draw_course_rowThis is used by lots of other functions to display a course on the screen. It will show the course, the hours, the grade, and quality points, as well as any necessary icons next to it.
_AdvisingScreen::draw_c_fieldsetThis function will return the HTML to contruct a collapsible fieldset, complete with javascript and style tags.
_AdvisingScreen::draw_group_select_rowThis draws the "blank row" for a group on the degree plan, which instructs the user to click on it to select a course from the popup.
_AdvisingScreen::draw_menu_itemSimply builds a single menu item.
_AdvisingScreen::draw_menu_itemsUses the draw_menu_item method to draw the HTML for all the supplied menu items, assuming the user has permission to view them.
_AdvisingScreen::draw_pie_chart_boxThis function is used to draw an individual pie chart box. It accepts values of top/bottom in order to come up with a percentage.
_AdvisingScreen::draw_popup_group_select_course_rowUsed in the group selection popup, this will display a course with a radio button next to it, so the user can select it.
_AdvisingScreen::draw_popup_group_subject_selectWhen the groupSelect has too many courses, they are broken down into subjects, and the user first selects a subject. This function will draw out that select list.
_AdvisingScreen::draw_progress_boxesThis function calls drawPieChart to construct the student's 3 progress pie charts.
_AdvisingScreen::draw_public_noteWill display the "public note" at the top of a degree. This was entred in Data Entry.
_AdvisingScreen::draw_semester_box_bottomUses the draw_box_bottom function, specifically for semesters. Actually, this function is a straight alias for $this->draw_box_bottom().
_AdvisingScreen::draw_semester_box_topUses the draw_box_top function, specifically for semesters.
_AdvisingScreen::fix_course_titleLeft in for legacy reasons, this function uses a new Course object's method of $course->fix_title to make a course's title more readable.
_AdvisingScreen::fix_institution_nameSimple function to make an institution name look more pretty, because all institution names pass through ucwords(), sometimes the capitalization gets messed up. This function tries to correct it.
_AdvisingScreen::get_hidden_advising_variablesReturns a list of "hidden" HTML input tags which are used to keep track of advising variables between page loads.
_AdvisingScreen::get_quality_pointsCalculate the quality points for a grade and hours.
_AdvisingScreen::mark_course_as_displayedFind all instaces of a Course in a Group and mark as displayed.
_AdvisingScreen::output_to_browserThis method outputs the screen to the browser by performing an include(path-to-theme-file.php). All necessary information must be placed into certain variables before the include happens.
_AdvisingScreen::z__convert_bbcode_to_htmlConverts a string containing BBCode to the equivalent HTML.
_AdvisingScreen::z__draw_mobile_tabsThis function is called when we know we are on a mobile browser. We have to handle tab rendering differently in order to make them all fit.
_AdvisingScreen::__constructThis is the constructor. Must be named this for inheritence to work correctly.
_AdvisingScreenTypeView::build_semester_listIn __advising_screen, this method simply displays the degree plan's semesters to the screen. But here, we need to go through the 4 type categories: Core, Major, Supporting, and Electives, and only display courses and groups from each semester… Overrides _AdvisingScreen::build_semester_list
_AdvisingScreenTypeView::display_semester_listDisplay contents of a semester list as a single semester, only displaying courses matching the requirement_type. If the requirement_type is "e", then we will look for anything not containing an m, s, uc, um, or c as a requirement_type.
_AdvisingScreenTypeView::match_requirement_typeDoes the testType match the reqType? This function is used to make sure that courses or groups with a certain requirement_type are placed in the correct semester blocks on screen.

File

classes/_AdvisingScreenTypeView.php, line 15

View source
class _AdvisingScreenTypeView extends _AdvisingScreen {


  /**
   * In __advising_screen, this method simply displays the degree plan's
   * semesters to the screen.  But here, we need to go through the 4
   * type categories: Core, Major, Supporting, and Electives,
   * and only display courses and groups from each semester fitting
   * that type.
   *
   */
  function build_semester_list() {

    $list_semesters = $this->degree_plan->list_semesters;
    // Go through each semester and add it to the screen...
    $list_semesters->reset_counter();

    $this->add_to_screen($this->display_semester_list($list_semesters, "c", t("Core Requirements"), true));
    $this->add_to_screen($this->display_semester_list($list_semesters, "m", t("Major Requirements"), true));
    $this->add_to_screen($this->display_semester_list($list_semesters, "s", t("Supporting Requirements"), true));
    $this->add_to_screen($this->display_semester_list($list_semesters, "e", t("Electives"), true));


    $temp_d_s = new Semester(-55); // developmental requirements.
    if ($dev_sem = $list_semesters->find_match($temp_d_s)) {
      $this->add_to_screen($this->display_semester($dev_sem));
    }


  }


  /**
   * Does the testType match the reqType?  This function is used
   * to make sure that courses or groups with a certain requirement_type
   * are placed in the correct semester blocks on screen.
   *
   * @param string $test_type
   * @param string $req_type
   * @return bool
   */
  function match_requirement_type($test_type, $req_type) {
    // Does the testType match the reqType?

    if ($test_type == $req_type) {
      return true;
    }

    if ($test_type == "uc" && $req_type == "c") { // university captone core.
      return true;
    }

    if ($test_type == "um" && $req_type == "m") { // university captone major
      return true;
    }


    if ($req_type == "e") {
      // type "elective."  test must not be c, s, or m.
      if ($test_type != "c" && $test_type != "s" && $test_type != "m" && $test_type != "uc" && $test_type != "um" && $test_type != "dev") {
        return true;
      }
    }

    return false;

  }

  /**
   * Display contents of a semester list as a single semester,
   * only displaying courses matching the requirement_type.
   * If the requirement_type is "e", then we will look for anything
   * not containing an m, s, uc, um, or c as a requirement_type.
   *
   * @param SemesterList $list_semesters
   * @param string $requirement_type
   * @param string $title
   * @param bool $bool_display_hour_count
   * @return string
   */
  function display_semester_list($list_semesters, $requirement_type, $title, $bool_display_hour_count = false) {

    // Display the contents of a semester object
    // on the screen (in HTML)
    $pC = "";
    $pC .= $this->draw_semester_box_top($title);

    $count_hours_completed = 0;
    $list_semesters->reset_counter();
    while ($list_semesters->has_more()) {
      $semester = $list_semesters->get_next();
      if ($semester->semester_num == -88) { // These are the "added by advisor" courses.  Skip them.
        continue;
      }

      // First, display the list of bare courses.
      $semester->list_courses->sort_alphabetical_order();
      $semester->list_courses->reset_counter();
      $sem_is_empty = true;
      $sem_rnd = rand(0, 9999);
      $pC .= "<tr><td colspan='4' class='tenpt'>
					<b><!--SEMTITLE$sem_rnd--></b></td></tr>";
      while ($semester->list_courses->has_more()) {
        $course = $semester->list_courses->get_next();
        // Make sure the requirement type matches!
        if (!$this->match_requirement_type($course->requirement_type, $requirement_type)) {
          continue;
        }

        // Is this course being fulfilled by anything?
        //if (is_object($course->courseFulfilledBy))
        if (!($course->course_list_fulfilled_by->is_empty)) { // this requirement is being fulfilled by something the student took...
          //$pC .= $this->draw_course_row($course->courseFulfilledBy);
          $pC .= $this->draw_course_row($course->course_list_fulfilled_by->get_first());
          //$count_hours_completed += $course->courseFulfilledBy->hours_awarded;
          $course->course_list_fulfilled_by->get_first()->bool_has_been_displayed = true;

          if ($course->course_list_fulfilled_by->get_first()->display_status == "completed") { // We only want to count completed hours, no midterm or enrolled courses.
            //$count_hours_completed += $course->course_list_fulfilled_by->get_first()->hours_awarded;
            $h = $course->course_list_fulfilled_by->get_first()->hours_awarded;
            if ($course->course_list_fulfilled_by->get_first()->bool_ghost_hour == TRUE) {
              $h = 0;
            }
            $count_hours_completed += $h;
          }
        }
        else {
          // This requirement is not being fulfilled...
          $pC .= $this->draw_course_row($course);
        }
        //$pC .= "</td></tr>";
        $sem_is_empty = false;
      }

      // Now, draw all the groups.
      $semester->list_groups->sort_alphabetical_order();
      $semester->list_groups->reset_counter();
      while ($semester->list_groups->has_more()) {
        //debug_c_t("dddd");
        $group = $semester->list_groups->get_next();
        if (!$this->match_requirement_type($group->requirement_type, $requirement_type)) {
          continue;
        }

        $pC .= "<tr><td colspan='8'>";
        $pC .= $this->display_group($group);
        $count_hours_completed += $group->hours_fulfilled_for_credit;
        $pC .= "</td></tr>";
        $sem_is_empty = false;
      }

      if ($sem_is_empty == false) {
        // There WAS something in this semester, put in the title.

        //debugCT("replacing $sem_rnd with $semester->title");
        $pC = str_replace("<!--SEMTITLE$sem_rnd-->", $semester->title, $pC);
      }

    }


    // Add hour count to the bottom...
    if ($bool_display_hour_count == true && $count_hours_completed > 0) {
      $pC .= "<tr><td colspan='8'>
				<div class='tenpt' style='text-align:right; margin-top: 10px;'>
				Completed hours: $count_hours_completed
				</div>
				";
      $pC .= "</td></tr>";
    }

    $pC .= $this->draw_semester_box_bottom();

    return $pC;

  }

}