function advise_display_popup_course_description

7.x advise.module advise_display_popup_course_description()
6.x advise.module advise_display_popup_course_description()
4.x advise.module advise_display_popup_course_description()
5.x advise.module advise_display_popup_course_description()

File

modules/advise/advise.module, line 1337

Code

function advise_display_popup_course_description() {
  global $current_student_id, $screen;
  $rtn = "";

  advise_init_screen();

  fp_add_js(fp_get_module_path("advise") . "/js/advise.js");
  fp_add_css(fp_get_module_path("advise") . "/css/advise.css");

  $data_string = trim($_GET ["data_string"]);
  $course = new Course();
  if ($data_string != "") 
   {
    $course->load_course_from_data_string($data_string);
  }

  $req_by_degree_id = $course->req_by_degree_id;

  // Save the max hours from the data string here.  This is to fix a bug where we didn't keep track
  // of a course's remainder from a split substitution.  Due to pass-by-reference, it gets reset
  // in the display_popup_course_description function.
  $datastring_max_hours = $course->max_hours;

  $rtn .= $screen->display_popup_course_description("", $course);

  // Create the tabs for the page...
  $tab_array = array();
  $tab_array [0]["title"] = "Description";
  $tab_array [0]["active"] = true;

  if (user_has_permission("can_substitute") && !$screen->bool_blank && intval($course->get_first_assigned_to_group_id()) != DegreePlan::GROUP_ID_FOR_COURSES_ADDED) {
    if ($course->get_bool_substitution() != TRUE && $course->grade == "") {

      // By checking grade, we are making sure this course has NOT already
      // been taken by the student.  In other words, verify that this course
      // is an unfulfilled requirement on the degree plan ONLY.      
      $extra_vars = "hours_avail=$datastring_max_hours";
      $tab_array [1]["title"] = "Substitute";
      $tab_array [1]["on_click"] = "popupSubstituteSelected(\"$course->course_id\",\"" . $course->get_first_assigned_to_group_id() . "\",\"$course->assigned_to_semester_num\",\"$req_by_degree_id\",\"$extra_vars\");";

    }
  }

  fp_set_page_tabs($tab_array);

  //$screen->page_tabs = $screen->draw_tabs($tab_array);

  return $rtn;
}