function blank_degrees_display_blank_degree

7.x blank_degrees.module blank_degrees_display_blank_degree()
6.x blank_degrees.module blank_degrees_display_blank_degree()
4.x blank_degrees.module blank_degrees_display_blank_degree()
5.x blank_degrees.module blank_degrees_display_blank_degree()

File

modules/blank_degrees/blank_degrees.module, line 88

Code

function blank_degrees_display_blank_degree() {
  global $screen, $student, $fp;

  $blank_degree_id = $_REQUEST ["blank_degree_id"];
  $blank_catalog_year = $_REQUEST ["blank_catalog_year"];
  @$blank_print = $_REQUEST ["blank_print"];
  @$blank_view = $_REQUEST ["blank_view"];

  // If we used the word "current" for catalog_year, then find out what the current is.
  if (strtolower($blank_catalog_year) == "current") {
    $blank_catalog_year = variable_get("current_catalog_year", 2006);
  }

  // If the blank_degree_id begins with "major_code_" then figure out the degree based on major_code.
  if (strstr($blank_degree_id, "major_code_")) {
    $blank_major_code = str_replace("major_code_", "", $blank_degree_id);
    // Okay, figure out the degree id based on the major code and catalog year.
    $db = get_global_database_handler();
    $blank_degree_id = $db->get_degree_id($blank_major_code, $blank_catalog_year);
    if (!$blank_degree_id) {
      // Couldn't be found!
      $rtn = "<br>Checking for major code: $blank_major_code, year: $blank_catalog_year
              <br><br>
              Sorry, but that major code/track combination and catalog year could not be found.  Please check your URL and try again.";
      return $rtn;
    }
  }
  else {
    // Find out the major_code for this blank_degree_id...
    $blank_degree = new DegreePlan($blank_degree_id, NULL, TRUE);
    $blank_major_code = $blank_degree->major_code;
    // If there is a track, tack it on.
    if ($blank_degree->track_code != "") {
      if (!strstr($blank_major_code, "|")) {
        $blank_major_code .= "|";
      }
      $blank_major_code .= "_" . $blank_degree->track_code;
    }


  }


  $rtn = "";

  // Are we in draft mode?
  if ($_SESSION ["fp_draft_mode"] == "yes") {
    $GLOBALS ["fp_advising"]["bool_use_draft"] = true;
  }
  else {
    $GLOBALS ["fp_advising"]["bool_use_draft"] = false;
  }


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

  $student = new Student();
  $student->load_student();
  $student->student_id = "000000000";
  $student->name = "Blank Degree";
  $degree_plan = new DegreePlan($blank_degree_id);
  $degree_plan->load_descriptive_data();
  $student->catalog_year = $degree_plan->catalog_year;
  $fp = new FlightPath($student, $degree_plan);
  $screen = new AdvisingScreen("", $fp, "not_advising");
  if ($blank_view == "type") 
   {
    $screen = new AdvisingScreenTypeView("", $fp, "not_advising");
    $screen->view = "type";
  }

  $screen->bool_blank = true;

  if ($blank_print == "yes") 
   {
    $screen->bool_print = true;
  }

  $screen->build_screen_elements();

  $title = $degree_plan->title;
  if ($degree_plan->track_title != "") {
    $title .= " - " . $degree_plan->track_title;
  }
  fp_set_title($title);

  $rtn .= "<table class='fp-semester-table'>";
  $rtn .= $screen->display_screen();
  $rtn .= "</table><br><br>";


  if (user_has_permission("blank_degrees_view_url_options") && !$screen->bool_print) {
    // If the user has permissions, show them the extra URL options.  (but don't bother in print mode)
    $rtn .= fp_render_c_fieldset("
              <div style='font-size: 0.85em;'>
                " . t("This degree may be linked to directly using the following URLs:") . "
                <ul>
                  <li>Internal ID for $blank_catalog_year: <a href='" . $GLOBALS ["fp_system_settings"]["base_url"] . "/" . fp_url("blank-degrees/display", "blank_degree_id=$blank_degree_id&blank_catalog_year=$blank_catalog_year", FALSE) . "'>Link</a></li>
                  <li>Major-code $blank_major_code for $blank_catalog_year: <a href='" . $GLOBALS ["fp_system_settings"]["base_url"] . "/" . fp_url("blank-degrees/display", "blank_degree_id=major_code_$blank_major_code&blank_catalog_year=$blank_catalog_year", FALSE) . "'>Link</a></li>
                  <li>Major-code $blank_major_code always <b>current</b> catalog: <a href='" . $GLOBALS ["fp_system_settings"]["base_url"] . "/" . fp_url("blank-degrees/display", "blank_degree_id=major_code_$blank_major_code&blank_catalog_year=current", FALSE) . "'>Link</a></li>
                </ul>
              </div>
             ", t("View URL Options"), TRUE);
  }



  // Add in the required "advising variables"
  //$rtn .= $screen->get_hidden_advising_variables("save_draft");

  // Figure out what the page's sub-tabs should be, and set them.
  $tab_array = array();
  $tab_array [0]["title"] = "Display by Year";
  $tab_array [0]["active"] = ($screen->view != "type");
  $tab_array [0]["on_click"] = "window.location=\"" . fp_url("blank-degrees/display", "blank_degree_id=$blank_degree_id&blank_catalog_year=$blank_catalog_year&blank_view=year") . "\";";

  $tab_array [1]["title"] = "Display by Type";
  $tab_array [1]["active"] = ($screen->view == "type");
  $tab_array [1]["on_click"] = "window.location=\"" . fp_url("blank-degrees/display", "blank_degree_id=$blank_degree_id&blank_catalog_year=$blank_catalog_year&blank_view=type") . "\";";

  if (!fp_screen_is_mobile()) {
    $tab_array [2]["title"] = "Print";
    $tab_array [2]["type"] = "link";
    $tab_array [2]["active"] = FALSE;
    $tab_array [2]["on_click"] = "popupPrintWindow(\"" . fp_url("blank-degrees/display", "blank_degree_id=$blank_degree_id&blank_catalog_year=$blank_catalog_year&blank_view=$blank_view&blank_print=yes") . "\");";
  }

  fp_set_page_sub_tabs($tab_array);

  watchdog("blank_degrees", "User viewed blank degree: @year,@degree,@title", array("@year" => $blank_catalog_year, "@degree" => $blank_degree_id, "@title" => $title), WATCHDOG_DEBUG);


  return $rtn;

}