function stats_draw_majors_with_options_pulldown

4.x stats.module stats_draw_majors_with_options_pulldown($smajor = "", $display_submit = false)

Display a major selection pulldown, used by other reports.

Parameters

unknown_type $smajor:

unknown_type $display_submit:

Return value

unknown

1 call to stats_draw_majors_with_options_pulldown()
stats_report_selected_degree_options in modules/stats/stats.module
This report will show which degree options are being selected for degrees which offer options.

File

modules/stats/stats.module, line 322
This module displays statistics and reports for FlightPath

Code

function stats_draw_majors_with_options_pulldown($smajor = "", $display_submit = false) 
 {

  $db = get_global_database_handler();
  $major_array = array();

  $current_catalog_year = variable_get("current_catalog_year", "");

  $m_a_count = 0;
  $query = "SELECT * FROM degrees
				WHERE  catalog_year = '?'
				AND `exclude`='0'
				ORDER BY `title`  ";
  $result = db_query($query, $current_catalog_year);
  while ($cur_row = $db->db_fetch_array($result)) {
    $major = trim($cur_row ["major_code"]);
    if (!$db->get_degree_tracks($major, $current_catalog_year)) 
     { // only get majors that also have tracks!
      continue;
    }
    $description = trim($cur_row ["title"]);
    $type = trim($cur_row ["degree_type"]);
    $major_array [$m_a_count]["description"] = $description;
    $major_array [$m_a_count]["major"] = $major;
    $major_array [$m_a_count]["type"] = $type;

    $m_a_count++;


  }


  $rtn .= "
			<table border='0'>
			
          <td valign='middle'>
          
         <select name='major' id='major'><option value=''>" . t("Please select a major with degree options") . "</option>
                      <option value=''>-----------------------------------</option>";

  for ($t = 0; $t < $m_a_count; $t++) 
   {
    $sel = "";
    if ($major_array [$t]["major"] == $smajor && $smajor != "") 
     {
      $sel = "selected";
    }
    $hyph = "-";
    if ($major_array [$t]["type"] == "" || $major_array [$t]["type"] == "NA") 
     {
      $hyph = "";
      $major_array [$t]["type"] = "";
    }

    $rtn .= "<option value='" . $major_array [$t]["major"] . "' $sel>
					" . $major_array [$t]["description"] . " $hyph " . $major_array [$t]["type"] . "
					</option>";
  }


  $rtn .= "                </select> </td>";
  if ($display_submit == true) 
   {
    $rtn .= "<td valign='middle'><input type='submit' value='" . t("Select") . "'></td>";
  }

  $rtn .= "</table>";

  return $rtn;

}