function advise_popup_display_summary

6.x advise.history.inc advise_popup_display_summary($advising_session_id = NULL, $bool_html = TRUE, $bool_show_as_group = FALSE, $bool_minimal_text = TRUE)
4.x advise.history.inc advise_popup_display_summary()
5.x advise.history.inc advise_popup_display_summary($advising_session_id = NULL, $bool_html = TRUE)

Displays the printable advising summary.

File

modules/advise/advise.history.inc, line 244

Code

function advise_popup_display_summary() {
  $rtn = "";

  $db = get_global_database_handler();

  $advising_session_id = trim($_REQUEST ["advising_session_id"]);


  $res = db_query("SELECT * FROM advising_sessions
                     WHERE advising_session_id = '?' ", $advising_session_id);
  if (db_num_rows($res) > 0) {
    $cur = $db->db_fetch_array($res);
    extract($cur, 3, "db");
  }
  $dt = format_date($db_posted, "pretty");

  $term = get_term_description($db_term_id);
  $degree_plan = new DegreePlan();
  $degree_plan->degree_id = $db_degree_id;
  $degree_plan->load_descriptive_data();
  $degree_title = $degree_plan->get_title(true);

  $student = new Student($db_student_id, $db);

  $what_if_message = "";
  if ($db_is_whatif == "1") {
    $official_degree_plan = $student->get_degree_plan(false, true);
    $official_degree_plan->load_descriptive_data();
    $official_degree_title = $official_degree_plan->get_title(true);

    $what_if_message = "<b>" . t("Note:") . "</b>
              " . t("This advising was saved using <b>What If</b> mode
              for the %degree_title major.  According to @initials records,
              the student's official major is %official.", array("%degree_title" => $degree_title, "@initials" => $GLOBALS ["fp_system_settings"]["school_initials"], "%official" => $official_degree_title));
  }

  $page_is_mobile = fp_screen_is_mobile();

  $w = ($page_is_mobile) ? "100%" : "500";

  $rtn .= "<table width='$w'><td valign='top'>";

  if ($page_is_mobile) {

  }
  else {

    $rtn .= "
      <table class='tenpt' border='0' width='100%' cellpadding='3' cellspacing='0' style='border-width: 2px; border-style: solid; border-color: black;'>
       <tr height='7'>
        <td> </td>
       </tr>
       <tr>
        <td valign='top' width='15%'>" . t("Student:") . "</td>
        <td valign='top' width='40%'>" . $db->get_student_name($db_student_id, false) . " ($db_student_id)</td>
        <td valign='top' rowspan='3'>
          <table width='100%' cellpadding='0' cellspacing='0'>
        <tr height='20'>
         <td width='100%' valign='bottom'><hr noshade size='1' width='100%' color='black' style='margin: 0px;'></td>
        </tr>
        <tr height='20'>
         <td width='100%' valign='top' align='right'><span style='font-size: 8pt;'>" . t("Student signature") . "</span></td>
        </tr>

        <tr height='20'>
         <td width='100%' valign='bottom'><hr noshade size='1' width='100%' color='black' style='margin: 0px;'></td>
        </tr>
        <tr>
         <td width='100%' valign='bottom' align='right'><span style='font-size: 8pt;'>" . t("Advisor signature") . "</span></td>
        </tr>
       <tr height='7'>
        <td> </td>
       </tr>
  
        
        </table> ";
  }

  $rtn .= "
        </td>
       </tr>
       <tr>
        <td valign='top' width='10%'>" . t("Advisor:") . "</td>
        <td valign='top'>" . fp_get_faculty_name($db_faculty_id, false) . "</td>

       </tr>
       <tr>
        <td valign='top'>" . t("Term:") . "</td>
        <td valign='top'>$term</td>

       </tr>
       ";
  if (!$page_is_mobile) {
    $rtn .= "
       <tr>
        <td valign='top' colspan='2'>
        " . t("Alternate Term:") . " _____________________
        </td>
       </tr>";
  }

  $rtn .= "   
       <tr>
        <td valign='top' colspan='4'>
        ";

  if ($degree_title != "") 
   {
    $rtn .= t("Major:") . " $degree_title";
  }

  $rtn .= "
       </tr>
       </table>
       <div class='tenpt'><i>" . t("Submitted on") . " $dt.</i></div>
       <div class='tenpt'>$what_if_message</div>
       <br>
    ";

  $rtn .= fp_render_curved_line(t("Advised Courses"));

  $fp = new FlightPath($student, $degree_plan, $db);

  $fp->load_advising_session_from_database("", "", false, false, $advising_session_id);

  $rtn .= "<table border='0' cellpadding='3'>
      <tr>
        <td class='tenpt' valign='top' width='25%'>
          <b>" . t("Course") . "</b>
        </td>
        <td class='tenpt' valign='top' width='70%'>
          <b>" . t("Title") . "</b>
        </td>
        <td class='tenpt' valign='top'>
          <b>" . t("Hours") . "</b>
        </td>
      </tr>";



  // Get a courseList of all the courses which are set as advised to take.
  $advised_courses_list = $fp->course_list_advised_courses;
  $advised_courses_list->load_course_descriptive_data();
  $advised_courses_list->sort_alphabetical_order();
  $advised_courses_list->reset_counter();
  while ($advised_courses_list->has_more()) {
    $course = $advised_courses_list->get_next();
    // set the catalogYear from the term_id.
    $course->term_id = $db_term_id;
    $course->set_catalog_year_from_term_id();
    $course->load_descriptive_data(false);

    $rtn .= "<tr>
          <td class='tenpt' valign='top'>
          $course->subject_id $course->course_num
          </td>
          <td class='tenpt' valign='top'>
          $course->title
          </td>
          <td class='tenpt' valign='top' align='center'>
          " . $course->get_hours() . " 
          </td>
          
        </tr>
      ";
  }

  $rtn .= "</table>
      <div align='right' class='tenpt' style='padding-top: 10px; padding-right: 15px;'>
        <b>" . t("Total advised hours:") . " &nbsp; " . $advised_courses_list->count_hours() . "</b>
      </div>
      ";


  if (!$page_is_mobile) {
    $rtn .= "<br>";
    $rtn .= fp_render_curved_line(t("Alternate Courses"));
    $rtn .= "<div class='tenpt'>
        " . t("You may use this space to write in alternate courses 
        the student should enroll in, in the event that an 
        advised course is full or unavailable.") . "
        <br><br>
        ___________________________________________________________________ <br><br>
        ___________________________________________________________________
        </div>  ";
  }

  $rtn .= "</table>";

  fp_set_title($db->get_student_name($db_student_id, FALSE) . " ($db_student_id) $term " . t("Advising Summary"));


  return $rtn;
}