function advise_display_popup_change_term
Search API
7.x advise.module | advise_display_popup_change_term() |
6.x advise.module | advise_display_popup_change_term() |
4.x advise.module | advise_display_popup_change_term() |
5.x advise.module | advise_display_popup_change_term() |
This popup allows the advisor to change the advising term.
File
- modules/
advise/ advise.module, line 1066
Code
function advise_display_popup_change_term() {
global $current_student_id;
$rtn = "";
$school_id = db_get_school_id_for_student_id($current_student_id);
fp_add_js(fp_get_module_path("advise") . "/js/advise.js");
$current_term_id = $_REQUEST ["advising_term_id"];
$current_term = get_term_description($current_term_id, FALSE, $school_id);
$rtn .= "<div>
" . t("You may advise this student for future semesters. Please select which
advising term you would like to advise for from the list below. If you
are unsure, simply close this window and continue to advise for the current
term of %current_term.", array("%current_term" => $current_term)) . "
</div>";
$rtn .= "<ul class='change-terms'>";
$temp = explode(",", variable_get_for_school("available_advising_term_ids", "0", $school_id));
for ($t = 0; $t < count($temp); $t++) {
$term_id = trim($temp [$t]);
$term_desc = get_term_description($term_id, FALSE, $school_id);
if ($term_id == $current_term_id) {
$term_desc = "<strong class='current-term'>$term_desc</strong> - " . t("current");
}
// This bit allows other modules to use this function, but change (by appending a string) to the parent function
// we intend to call.
// Example: if the append string is "MyModule" then the full function called below will be changeTermMyModule().
$perform_parent_function = "changeTerm";
if (isset($_REQUEST ['append_parent_function'])) {
$x = fp_get_machine_readable(trim($_REQUEST ['append_parent_function'])); // Make safe from hackers
$perform_parent_function .= $x;
}
$link = fp_get_js_confirm_link(t("Are you sure you wish to change advising terms?"), "parent.fpCloseSmallIframeDialog(\"\");parent.$perform_parent_function(\"$term_id\");", $term_desc);
$rtn .= "<li>$link</li>";
}
$rtn .= "</ul>";
watchdog("advise", "display_popup_change_term $current_student_id", array(), WATCHDOG_DEBUG);
return $rtn;
}