function admin_display_degrees
Search API
7.x admin.degrees.inc | admin_display_degrees() |
6.x admin.degrees.inc | admin_display_degrees() |
4.x admin.degrees.inc | admin_display_degrees() |
5.x admin.degrees.inc | admin_display_degrees() |
1 string reference to 'admin_display_degrees'
- schools_content_alter in modules/
schools/ schools.module
File
- modules/
admin/ admin.degrees.inc, line 758
Code
function admin_display_degrees() {
// Do this using $render array, so it can be altered
// by hook_content_alter
$render = array();
$render ['#id'] = 'admin_display_degrees';
$de_catalog_year = admin_get_de_catalog_year();
$rtn = "";
fp_add_css(fp_get_module_path("admin") . "/css/admin.css");
fp_set_title(t("Degrees for @year", array("@year" => $de_catalog_year)));
$render ['upper_links'] = array(
'value' => "<div class='admin-degrees-upper-links'>
" . l("Add new degree plan (major, degree plan, or track)", "admin/degrees/add-degree", "de_catalog_year=$de_catalog_year") . "
|
" . l("Copy a degree plan", "admin/degrees/copy-degree", "de_catalog_year=$de_catalog_year") . "</div>",
);
$html = "";
$html .= "<div class='degrees-filter'>";
$html .= fp_render_form("admin_degrees_list_filter_form");
$html .= "</div>";
$render ['degrees_filter'] = array(
'value' => $html,
);
$render ['degrees_table_top'] = array(
'value' => "<table class='degrees-table' border='0' width='100%' cellpadding='5' cellspacing='0'>
<tr>
<th width='8%'>Type</th>
<th width='8%'>Level</th>
<th width='15%'>Class</th>
<th width='60%'>Title</th>
<th>Code</th>
</tr>",
);
$params = array();
$params [":catalog_year"] = $de_catalog_year;
$filter_class_value = @$_SESSION ['degrees_filter_class'];
$filter_level_value = @$_SESSION ['degrees_filter_level'];
$filter_school_value = @intval($_SESSION ['degrees_filter_school']);
$extra_where_conditions = "";
watchdog("admin", "Viewed admin degree list. Class option: $filter_class_value ($de_catalog_year), School id: $filter_school_value", array(), WATCHDOG_DEBUG);
// Let's adjust the query based on filter selections (if any exist)
if ($filter_class_value) {
$extra_where_conditions .= " AND degree_class = :degree_class ";
$params [":degree_class"] = $filter_class_value;
}
if ($filter_level_value) {
$extra_where_conditions .= " AND degree_level = :degree_level ";
$params [":degree_level"] = $filter_level_value;
}
if (module_enabled('schools')) {
if ($filter_school_value) {
$extra_where_conditions .= " AND school_id = :school_id ";
$params [":school_id"] = $filter_school_value;
}
}
else {
// schools not enabled, so only search for school = 0
$extra_where_conditions .= " AND school_id = 0 ";
}
$res = db_query("SELECT * FROM draft_degrees
WHERE catalog_year = :catalog_year
$extra_where_conditions
ORDER BY degree_type, major_code, title ", $params);
while ($cur = db_fetch_array($res)) {
$db_exclude = 0;
extract($cur, 3, "db");
$disp_level = strtoupper($db_degree_level);
if ($db_degree_type == "NA" && strstr($db_major_code, "|")) {
$db_degree_type = " -- ";
}
$extra_class = "";
if ($db_exclude == "1") {
$extra_class = "list-degree-row-excluded";
}
$degree_title = $db_title;
// get JUST the major code...
$temp = explode("|", $db_major_code);
$just_major = trim(@$temp [0]);
$just_conc = trim(@$temp [1]);
$outside = "";
//if ($just_conc != "" && strstr($just_conc, "_"))
if (strstr($just_conc, "_")) {
// If the concentration has an underscore, it's actually
// a track. Let's get the track title...
$temp2 = explode("_", $just_conc);
$just_track = trim($temp2 [1]);
// Might need to add the first part BACK onto the major...
if (trim($temp2 [0]) != "")
{
$just_major .= "|" . trim($temp2 [0]);
}
$res2 = db_query("SELECT * FROM draft_degree_tracks
WHERE catalog_year = ?
AND major_code = ?
AND track_code = ?
AND school_id = ? ", $de_catalog_year, $just_major, $just_track, $db_school_id);
if (db_num_rows($res2) > 0) {
$cur2 = db_fetch_array($res2);
$db_title = trim($cur2 ["track_title"]);
$outside = "$degree_title » ";
if (strstr($just_major, "|")) {
// both a conc AND a track. Denote it special.
$outside = ">>" . $outside;
}
$db_degree_type = "";
}
}
else if ($just_conc != "") {
// Meaning, this is a concentration, NOT a track.
$db_degree_type = "";
$outside = ">>";
}
$url = fp_url("admin/degrees/edit-degree/$db_degree_id/$de_catalog_year", "de_catalog_year=$de_catalog_year", array("class" => "degree-$db_degree_class"));
$class_details = fp_get_degree_classification_details($db_degree_class);
$disp_class = $class_details ["title"];
$on_mouse_over = "
onmouseover='$(this).addClass(\"selection_highlight\");'
onmouseout='$(this).removeClass(\"selection_highlight\");'
";
$render ['degree_row_' . $db_degree_id] = array(
'value' => "<tr
$on_mouse_over
style='cursor:pointer;'
onClick='window.location=\"$url\"'
class='$extra_class class-$db_degree_class class-level-" . $class_details ["level_num"] . " '
>
<td valign='top' class='degree-type'>$db_degree_type</td>
<td valign='top' class='degreee-level'>$disp_level</td>
<td valign='top' class='degreee-class'>$disp_class</td>
<td valign='top' class='degree-title'>$outside$db_title</td>
<td valign='top' class='degree-major-code'>$db_major_code</td>
</tr>
",
'data' => array(
'degree_id' => $db_degree_id,
'major_code' => $db_major_code,
'title' => $db_title,
'catalog_year' => $db_catalog_year,
'degree_type' => $db_degree_type,
'degree_class' => $db_degree_class,
'db_row' => $cur,
),
);
}
//$rtn .= "</table>";
$render ['degrees_table_bottom'] = array(
'value' => "</table>",
);
$rtn .= fp_render_content($render);
return $rtn;
}