advise_display_popup_course_description

4.x advise.module advise_display_popup_course_description()

File

modules/advise/advise.module, line 629

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");

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

  }

  $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) {
    if ($course->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=$course->max_hours";
      $tab_array[1]["title"] = "Substitute";
      $tab_array[1]["on_click"] = "popupSubstituteSelected(\"$course->course_id\",\"$course->assigned_to_group_id\",\"$course->assigned_to_semester_num\",\"$extra_vars\");";

      // I WAS WRONG!!!!!
      // I don't see any reason to make this a javascript function.  I'm going to make it a simple URL link.
      // window.location = "' . $script_filename . '?windowMode=popup&performAction=substituteSelected&course_id=" + course_id + "&group_id=" + group_id + "&semester_num=" + semester_num + "&current_student_id=" + csid + "&" + extraVars;
      //$tab_array[1]["on_click"] = "window.location = \"" . base_path() . "/advise/popup-substitute-selected&window_mode=popup&course_id=$course->course_id&group_id=$course->assigned_to_group_id&semester_num=$course->assigned_to_semester_num&current_student_id=$current_student_id&hours_avail=$course->max_hours\"";      
    }
  }

  fp_set_page_tabs($tab_array);

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

  return $rtn;
}