function AdvisingScreen::draw_popup_group_subject_select

6.x AdvisingScreen.php AdvisingScreen::draw_popup_group_subject_select($subject_array, $group_id, $semester_num, $group_hours_remaining = 0, $req_by_degree_id = 0)

When the groupSelect has too many courses, they are broken down into subjects, and the user first selects a subject. This function will draw out that select list.

Parameters

array $subject_array:

int $group_id:

int $semester_num:

int $group_hours_remaining:

Return value

string

1 call to AdvisingScreen::draw_popup_group_subject_select()
AdvisingScreen::display_popup_group_select in classes/AdvisingScreen.php
This function displays the popup which lets a user select a course to be advised into a group.

File

classes/AdvisingScreen.php, line 6025

Class

AdvisingScreen

Code

function draw_popup_group_subject_select($subject_array, $group_id, $semester_num, $group_hours_remaining = 0, $req_by_degree_id = 0) 
 {
  $csid = $GLOBALS ["current_student_id"];
  $blank_degree_id = "";
  if ($this->bool_blank) 
   {
    $blank_degree_id = $this->degree_plan->degree_id;
  }

  $db = get_global_database_handler();
  $school_id = db_get_school_id_for_student_id($this->student->student_id);

  $pC = "";

  $clean_urls = variable_get("clean_urls", FALSE);

  $pC .= "<tr><td colspan='8' class=' '>";
  $pC .= "<form action='" . fp_url("advise/popup-group-select") . "' method='GET' style='margin:0px; padding:0px;' id='theform'>
          <input type='hidden' name='window_mode' value='popup'>
          <input type='hidden' name='group_id' value='$group_id'>";
  if (!$clean_urls) {
    // Hack so that non-clean URLs sites still work
    $pC .= "<input type='hidden' name='q' value='advise/popup-group-select'>";
  }
  $pC .= "          
          <input type='hidden' name='semester_num' value='$semester_num'>
          <input type='hidden' name='group_hours_remaining' value='$group_hours_remaining'>
          <input type='hidden' name='current_student_id' value='$csid'>
          <input type='hidden' name='blank_degree_id' value='$blank_degree_id'>
          <input type='hidden' name='req_by_degree_id' value='$req_by_degree_id'>
    
          " . t("Please begin by selecting a subject from the list below.") . "
          <br><br>
          <select name='selected_subject'>
          <option value=''>" . t("Please select a subject...") . "</option>
          <option value=''>----------------------------------------</option>
          ";
  $new_array = array();
  foreach ($subject_array as $key => $subject_id) 
   {

    if ($title = $this->flightpath->get_subject_title($subject_id, $school_id)) {
      $new_array [] = "$title ~~ $subject_id";
    }
    else {
      $new_array [] = "$subject_id ~~ $subject_id";
    }

  }

  sort($new_array);

  foreach ($new_array as $key => $value) 
   {
    $temp = explode(" ~~ ", $value);
    $title = trim($temp [0]);
    $subject_id = trim($temp [1]);
    $pC .= "<option value='$subject_id'>$title ($subject_id)</option>";
  }

  $pC .= "</select>
        <div style='margin: 20px;' align='left'>
        " . fp_render_button(t("Next") . " ->", "document.getElementById(\"theform\").submit();") . "
        </div>
          <!-- <input type='submit' value='submit'> -->
          
              </form>
        ";
  $pC .= "</td></tr>";

  return $pC;
}