function _AdvisingScreen::build_footnotes

4.x _AdvisingScreen.php _AdvisingScreen::build_footnotes($bool_include_box_top = TRUE)
5.x _AdvisingScreen.php _AdvisingScreen::build_footnotes($bool_include_box_top = TRUE)

Constructs the HTML which will show footnotes for substitutions and transfer credits.

1 call to _AdvisingScreen::build_footnotes()
_AdvisingScreen::build_screen_elements in classes/_AdvisingScreen.php
This function calls the other "build" functions to assemble the View or What If tabs in FlightPath.

File

classes/_AdvisingScreen.php, line 633

Class

_AdvisingScreen

Code

function build_footnotes($bool_include_box_top = TRUE) 
 {
  // Display the footnotes & messages.

  $pC = "";
  $is_empty = true;
  if ($bool_include_box_top) {
    $pC .= $this->draw_semester_box_top(t("Footnotes & Messages"), true);
  }

  $pC .= "<tr><td colspan='8' class='tenpt'>
					";
  $fn_type_array = array("substitution", "transfer");
  $fn_char = array("substitution" => "S", "transfer" => "T");
  $fn_name = array("substitution" => t("Substitutions"),
    "transfer" => t("Transfer Equivalency Footnotes"));
  $fn_between = array("substitution" => t("for"),
    "transfer" => t("for") . " {$GLOBALS ["fp_system_settings"]["school_initials"]}'s");
  for ($xx = 0; $xx <= 1; $xx++) 
   {
    $fn_type = $fn_type_array [$xx];
    if (isset($this->footnote_array [$fn_type]) && @count($this->footnote_array [$fn_type]) < 1) 
     {
      continue;
    }

    $pC .= "<div style='padding-bottom: 10px;'>
						<b>{$fn_name [$fn_type]}</b>";
    $is_empty = false;
    for ($t = 1; $t <= @count($this->footnote_array [$fn_type]); $t++) 
     {
      $line = $this->footnote_array [$fn_type][$t];

      if ($line == "") 
       {
        continue;
      }

      $extra = ".";

      $temp = explode(" ~~ ", $line);
      $o_course = trim(@$temp [0]);
      $new_course = trim(@$temp [1]);
      $using_hours = trim(@$temp [2]);
      if ($using_hours != "") 
       {
        $using_hours = "($using_hours hrs)";
      }
      $in_group = trim(@$temp [3]);
      $sub_id = trim(@$temp [4]);


      $fbetween = $fn_between [$fn_type];

      $sub_details = $this->db->get_substitution_details($sub_id);

      $remarks = @trim($sub_details ["remarks"]);
      $sub_faculty_id = @$sub_details ["faculty_id"];

      $sub_degree_plan = new DegreePlan();
      $sub_degree_plan->degree_id = @$sub_details ["required_degree_id"];

      $sub_required_group_id = @$sub_details ["required_group_id"];


      //if ($in_group > 0 && $fn_type=="substitution")
      if ($sub_required_group_id != "" && $fn_type == "substitution") 
       {
        $new_group = new Group();
        $new_group->group_id = $sub_required_group_id;
        $new_group->load_descriptive_data();

        $extra = "<div style='padding-left: 45px;'><i>" . t("in") . " $new_group->title.</i></div>";
        if ($new_course == $o_course || $o_course == "") 
         {
          $o_course = t("was added");
          $fbetween = "";
          $extra = str_replace("<i>" . t("in"), "<i>" . t("to"), $extra);
        }



      }

      // Clean this up, as far as the remarks and such.  Make it look similar (new function?) as popup text for a substitution.
      if ($remarks) {
        $remarks = " ($remarks) ";
      }

      // Build a "theme" array, so we can pass it to other modules in a hook.
      $theme = array();
      $theme ["footnote"] = array(
        "fn_char" => $fn_char,
        "fn_type" => $fn_type,
        "fn_num" => $t,
        "css_class" => "",
        "new_course" => $new_course,
        "using_hours" => $using_hours,
        "fbetween" => $fbetween,
        "o_course" => $o_course,
        "extra" => $extra,
        "remarks" => $remarks,
        "for_degree" => $sub_degree_plan->get_title2(FALSE, TRUE),
        "overwrite_with_html" => "",
      );


      // Invoke a hook on our theme array, so other modules have a chance to change it up.   
      invoke_hook("theme_advise_footnote", array(&$theme));

      $sup = $theme ["footnote"]["fn_char"][$theme ["footnote"]["fn_type"]] . $theme ["footnote"]["fn_num"];

      // Actually gather the output for the footnote:
      $html = "";

      if ($theme ["footnote"]["overwrite_with_html"] != "") {
        $html = $theme ["footnote"]["overwrite_with_html"];
      }
      else {

        $html = "<div class='tenpt advise-footnote {$theme ["footnote"]["css_class"]}'>
  					<sup>$sup</sup>
  					<span class='advise-footnote-body'>
  					   {$theme ["footnote"]["new_course"]} 
  					   {$theme ["footnote"]["using_hours"]} 
  					   {$theme ["footnote"]["fbetween"]} 
  					   {$theme ["footnote"]["o_course"]}{$theme ["footnote"]["extra"]}{$theme ["footnote"]["remarks"]} 
  					   <span class='footnote-for-degree'>(Degree {$theme ["footnote"]["for_degree"]})</span>
  					</span>
  					</div>";
      }


      $pC .= $html;


    }
    $pC .= "</div>";
  }


  //////////////////////////////
  /// Unassigned transfer eqv's
  $this->student->list_transfer_eqvs_unassigned->load_descriptive_transfer_data();
  $this->student->list_transfer_eqvs_unassigned->sort_alphabetical_order();
  $this->student->list_transfer_eqvs_unassigned->reset_counter();
  $ut_is_empty = TRUE;
  $pC .= "<!--TRANS_UN_COURSES-->";
  while ($this->student->list_transfer_eqvs_unassigned->has_more()) {

    $c = $this->student->list_transfer_eqvs_unassigned->get_next();

    $l_si = $c->subject_id;
    $l_cn = $c->course_num;
    $l_term = $c->get_term_description(true);

    $pC .= "<div class='tenpt' style='padding-left: 10px; padding-bottom: 5px;
			                                 margin-left: 1.5em; text-indent: -1.5em;'>
							$l_si $l_cn (" . $c->get_hours() . " " . t("hrs") . ") from <em>$c->institution_name</em>.
								";


    $pC .= "</div>";

    $ut_is_empty = false;
    $is_empty = false;
  }


  if ($ut_is_empty == false) 
   {
    $mtitle = "<div style='padding-bottom: 10px;'>
						<div style='padding-bottom: 5px;'>
						<b>" . t("Transfer Equivalency Removed Courses") . "</b><br>
				" . t("These courses have had their default transfer equivalencies removed.
				        ") . "</div>";
    $pC = str_replace("<!--TRANS_UN_COURSES-->", $mtitle, $pC);
    $pC .= "</div>";
  }



  ////////////////////////////////////
  ////  Moved Courses...
  $m_is_empty = TRUE;
  $pC .= "<!--MOVEDCOURSES-->";
  $this->student->list_courses_taken->sort_alphabetical_order();
  $this->student->list_courses_taken->reset_counter();
  while ($this->student->list_courses_taken->has_more()) 
   {
    $c = $this->student->list_courses_taken->get_next();
    // Skip courses which haven't had anything moved.
    if ($c->group_list_unassigned->is_empty == true) {
      continue;
    }


    if ($c->course_id > 0) 
     {
      $c->load_descriptive_data();
    }

    $l_s_i = $c->subject_id;
    $l_c_n = $c->course_num;
    $l_term = $c->get_term_description(true);


    $c->group_list_unassigned->reset_counter();
    while ($c->group_list_unassigned->has_more()) {

      $pC .= "<div class='tenpt' style='padding-left: 10px; padding-bottom: 5px;
                                       margin-left: 1.5em; text-indent: -1.5em;'>
                      $l_s_i $l_c_n (" . $c->get_hours_awarded() . " " . t("hrs") . ") - $c->grade - $l_term
                    ";

      $group = $c->group_list_unassigned->get_next();
      $group->load_descriptive_data();
      $group_title = "";
      $degree_title = "";
      if ($group->req_by_degree_id != 0) {
        $tdeg = new DegreePlan();
        $tdeg->degree_id = $group->req_by_degree_id;
        $degree_title = " (" . $tdeg->get_title2(FALSE, TRUE) . ")";
      }
      if ($group->group_id > 0) 
       {
        $group_title = "<i>$group->title</i>";
      }
      else {
        $group_title = t("the degree plan");
      }
      $pC .= t("was removed from") . " $group_title$degree_title.";

      $pC .= "</div>";

    }





    $m_is_empty = false;
    $is_empty = false;
  }

  if ($m_is_empty == false) 
   {
    $mtitle = "<div style='padding-bottom: 10px;'>
						<div style='padding-bottom: 5px;'>
						<b>" . t("Moved Courses") . "</b><br>
				" . t("These courses have been moved out of their 
				original positions on your degree plan.") . "</div>";
    $pC = str_replace("<!--MOVEDCOURSES-->", $mtitle, $pC);
    $pC .= "</div>";
  }



  // For admins only....
  if (user_has_permission("can_substitute") && $bool_include_box_top) {
    if ($this->bool_print != true) 
     { // Don't display in print view.
      $purl = fp_url("advise/popup-toolbox/transfers");
      $pC .= "<div style='tenpt'>				
					<a href='javascript: popupWindowNew(\"" . $purl . "\",\"\");'><img src='" . fp_theme_location() . "/images/toolbox.gif' border='0'>" . t("Administrator's Toolbox") . "</a>
				</div>";
      $is_empty = false;
    }
  }


  $pC .= "</td></tr>";

  if ($bool_include_box_top) {
    $pC .= $this->draw_semester_box_bottom();
  }

  if (!$is_empty) 
   {
    $this->add_to_screen($pC, "FOOTNOTES");
  }

  // Return so other functions can use this output, if needed.
  return $pC;
}