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 99

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"];
  $school_id = 0;
  if (isset($_REQUEST ['school_id'])) {
    $school_id = intval($_REQUEST ['school_id']);
  }
  @$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_for_school("current_catalog_year", 2006, $school_id);
  }

  $blank_degree = NULL;

  // 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>" . t("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.", array('%blank_major_code' => $blank_major_code, '%blank_catalog_year' => $blank_catalog_year));
      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;
    }


  }


  $render = array();
  $render ['#id'] = 'blank_degrees_display_blank_degree';
  $render ['#view'] = $blank_view;



  // 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_css(fp_get_module_path("advise") . "/css/advise.css");
  fp_add_js(fp_get_module_path("advise") . "/js/advise.js");

  $student = new Student();
  $student->load_student();
  $student->student_id = "000000000";
  $student->school_id = $school_id;
  $student->name = "Blank Degree";
  $degree_plan = new DegreePlan($blank_degree_id);
  $degree_plan->load_descriptive_data();
  $degree_plan->school_id = $school_id;
  $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);


  $render ['#fp'] = $fp;
  $render ['#degree_plan'] = $blank_degree;
  $render ['#blank_catalog_year'] = $blank_catalog_year;
  $render ['#screen'] = $screen;
  $render ['#student'] = $student;

  $render ['degree_plan_wrapper_top'] = array(
    'value' => "<div class='degree-plan-wrapper'>",
    'weight' => 100,
  );


  $render ['semester_table_start'] = array(
    'value' => "<table class='fp-semester-table'>",
    'weight' => 200,
  );

  $render ['screen_display_screen'] = array(
    'value' => $screen->display_screen(),
    'weight' => 300,
  );

  $render ['semester_table_end'] = array(
    'value' => "</table>",
    'weight' => 400,
  );

  $render ['degree_plan_wrapper_bottom'] = array(
    'value' => "</div>",
    'weight' => 500,
  );




  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)

    $render ['url_options_html'] = array(
      'value' => 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&school_id=$school_id", 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&school_id=$school_id", 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&school_id=$school_id", FALSE) . "'>Link</a></li>
                </ul>
              </div>
             ", t("View URL Options"), TRUE, 'view-url-options-fs'),
      'weight' => 2000,
    );


  }



  // 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&school_id=$school_id") . "\";";

  $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&school_id=$school_id") . "\";";


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


  return fp_render_content($render);

}