function advise_display_popup_change_track_non_dynamic_degree
Search API
7.x advise.module | advise_display_popup_change_track_non_dynamic_degree() |
6.x advise.module | advise_display_popup_change_track_non_dynamic_degree() |
5.x advise.module | advise_display_popup_change_track_non_dynamic_degree() |
This is the "change track" popup we will display if the degree cannot be combined with anything else (non-dynamic).
We will basically treat it similarly to how FlightPath 4x did things.
1 call to advise_display_popup_change_track_non_dynamic_degree()
- advise_display_popup_change_track in modules/
advise/ advise.module
File
- modules/
advise/ advise.module, line 465
Code
function advise_display_popup_change_track_non_dynamic_degree() {
global $degree_plan, $student;
$rtn = "";
$db = get_global_database_handler();
// Find out what track the user is already on.
// From What If mode...
if (@$GLOBALS ["fp_advising"]["advising_what_if"] == "yes") {
$student_majors_array = @csv_to_array($_SESSION ["what_if_major_code" . $student->student_id]);
}
else {
// Not in what if mode-- get the data from the normal student_majors table.
$student_majors_array = fp_get_student_majors($student->student_id, FALSE, FALSE);
} //else
$degree_plan->load_descriptive_data();
$major_code = $degree_plan->major_code;
$catalog_year = $degree_plan->catalog_year;
$bare_degree_plan = $degree_plan;
// Are we already on a track? If so, find out what the original degree was.
if (strstr($major_code, "_")) {
$temp = explode("_", $major_code);
$m = trim($temp [0]);
// Remove trailing | if its there.
$m = rtrim($m, "|");
$bare_degree_plan = $db->get_degree_plan($m, $catalog_year); // the original degree plan (bare, no tracks)
$major_code = $m;
}
$just_major_code = $major_code;
$temp = explode("_", $just_major_code);
$just_major_code = $temp [0];
$just_major_code = rtrim($just_major_code, "|");
$rtn .= fp_render_curved_line(t("Select a Degree Option"));
$rtn .= "<div class='tenpt'>
" . t("The student's degree has one or more degree options, which affects which courses are required.
Please select a degree option (or track) from the list below.") . "
<br><br>
" . t("If you are unsure of what to do, simply close this window.") . "
</div>
";
$rtn .= "<br><br><b>" . $bare_degree_plan->title . "</b> " . t("degree options:") . "<!--DEFAULT-->
<ul>";
// Get the list of available tracks for this degree.
if (!$tracks = $bare_degree_plan->get_available_tracks())
{
$rtn .= "<li>" . t("This major has no degree options.") . "</li>";
}
// Is there a "default" message for all tracks, which will override
// any other track descriptions?
// We need to look through all the tracks for the
// characters: "DEFAULT:"
// If we find this, then this is the default description
// which applies to all the tracks, and it should be displayed
// at the top.
$bool_default_description = false;
for ($t = 0; $t < count($tracks); $t++)
{
$temp = explode(" ~~ ", $tracks [$t]);
$track_code = trim($temp [0]);
$track_title = trim($temp [1]);
$track_description = trim($temp [2]);
if (strstr($track_description, "DEFAULT:")) {
// Yes! We found a default message.
$bool_default_description = true;
$track_description = filter_markup(trim(str_replace("DEFAULT:", "", $track_description)));
$track_description = "<div style='padding-top: 10px;' class='tenpt'>$track_description</div>";
$rtn = str_replace("<!--DEFAULT-->", $track_description, $rtn);
break;
}
}
for ($t = 0; $t < count($tracks); $t++)
{
$temp = explode(" ~~ ", $tracks [$t]);
$track_code = trim($temp [0]);
$track_title = trim($temp [1]);
$track_description = "";
$temp_tc = $track_code;
if ($temp_tc == "")
{
$temp_tc = "none";
}
$major_and_track_code = $just_major_code;
if ($temp_tc != "none") {
if (!strstr($major_and_track_code, "|")) {
$major_and_track_code .= "|";
}
$major_and_track_code .= "_" . $temp_tc;
}
// If this is the current track_code, mark it as such.
if (in_array($major_and_track_code, $student_majors_array)) {
$track_title .= " <b>(" . t("current") . ")</b>";
}
if ($bool_default_description == false)
{
$track_description = filter_markup(trim($temp [2]));
if ($track_description != "")
{
$track_description = " - $track_description";
}
}
// We need the track's degree id.
$trid = $db->get_degree_id($major_and_track_code, $catalog_year);
if ($trid == $bare_degree_plan->degree_id) {
$trid = ""; // don't use anything for the "none" option (the "orignal" degree plan)
}
$link = fp_get_js_confirm_link(t("Are you sure you wish to change degree options?"), "opener.changeTrackNonDynamicDegree(\"$trid\"); window.close(); ", $track_title);
if ($GLOBALS ["fp_advising"]["advising_what_if"] == "yes") {
$link = "<a href='javascript: popupChangeWhatIfTrackNonDynamicDegree(\"$major_and_track_code\", \"" . t("Are you sure you wish to change degree options?") . "\");'>$track_title</a>";
}
$rtn .= "<li class='tenpt' style='padding:3px;'>
$link $track_description</li>";
}
$rtn .= "</ul>";
return $rtn;
}