function z___advise_display_what_if_selection

5.x advise.module z___advise_display_what_if_selection($bool_undergrad_only = TRUE)

Displays the pulldown select list for picking a new What If degree. Returns HTML.

This function is no longer used...

Return value

string

File

modules/advise/advise.module, line 1957

Code

function z___advise_display_what_if_selection($bool_undergrad_only = TRUE) {
  global $screen, $current_student_id;

  $rtn = "";

  if ($screen->bool_print) {
    return "";
  }

  $db = get_global_database_handler();

  $url = fp_url("what-if");

  $rtn .= "<form action='" . $url . "' id='mainform' method='POST'>";
  $rtn .= fp_render_curved_line("What if I change my major to...");


  $rtn .= "<br>
      Major: <select name='what_if_major_code' class='what-if-selector'>
        <option value=''>Please select a major</option>
        <option value=''>------------------------------</option>\n
        ";
  //$settings = fp_get_system_settings();
  $current_catalog_year = variable_get("current_catalog_year", 0); // get the current catalog year, 0 if not set (which is an error condition)
  //$bool_use_draft = $GLOBALS["fp_advising"]["bool_use_draft"];
  $bool_use_draft = FALSE; // leave as false for now.  Because you can't select
  // degree options, and if you click submit it really does
  // save it.  Better to just use blank degrees.
  if ($degree_array = $db->get_degrees_in_catalog_year($current_catalog_year, false, $bool_use_draft, $bool_undergrad_only, array(1))) {
    foreach ($degree_array as $major_code => $value) {
      if (trim($value ["title"]) == "") {
        continue;
      }
      $rtn .= "<option value='$major_code'>{$value ["title"]}</option> \n";
    }
  }

  $rtn .= "</select>
      <br><br>";

  $c = 100;

  /////////////////////
  // Select a major....
  $content = "";
  if ($degree_array = $db->get_degrees_in_catalog_year($current_catalog_year, false, $bool_use_draft, $bool_undergrad_only, array(1))) {
    foreach ($degree_array as $major_code => $value) {
      if (trim($value ["title"]) == "") {
        continue;
      }
      $content .= "<label style='display:block;'><input type='checkbox' name='cb_$c' value='$major_code'>{$value ["title"]} </label> \n";
      $c++;
    }
  }

  $rtn .= fp_render_c_fieldset($content, "Select a Major &raquo;", FALSE);

  /////////////////////////
  // Select a minor....
  $content = "";
  if ($degree_array = $db->get_degrees_in_catalog_year($current_catalog_year, false, $bool_use_draft, $bool_undergrad_only, array(2))) {
    foreach ($degree_array as $major_code => $value) {
      if (trim($value ["title"]) == "") {
        continue;
      }
      $content .= "<label style='display:block;'><input type='checkbox' name='cb_$c' value='$major_code'>{$value ["title"]} </label> \n";
      $c++;
    }
  }

  $rtn .= "<br><br>" . fp_render_c_fieldset($content, "Select a Minor &raquo;", FALSE);



  $rtn .= "<br><br>
      <div align='right'>
      " . fp_render_button("Try It Out!", "showUpdate(true);submitForm();") . "       
   
      </div>
      <br><br>
      <div class='hypo tenpt'>
       <b>Important Notice:</b> What If displays degree plans
       from the most recent catalog year ($current_catalog_year-" . ($current_catalog_year + 1) . "), 
       as any major change would place the student into the 
       most recent catalog. 
      </div>";


  // Include only certain variables, so we don't overwrite our selection of what_if_major_code.
  $rtn .= "
          <input type='hidden' name='load_from_cache' value='no'>
          <input type='hidden' name='window_mode' value='screen'>
          <input type='hidden' id='scroll_top'>
          <input type='hidden' id='perform_action' name='perform_action'>
          <input type='hidden' id='advising_what_if' name='advising_what_if' value='yes'>
          <input type='hidden' id='current_student_id' name='current_student_id' value='$current_student_id'>
          
          <input type='hidden' id='from_what_if_selection_form' name='from_what_if_selection_form' value='yes'>
          
        ";

  $rtn .= "</form>
      ";


  return $rtn;
}