function advise_display_view
Search API
6.x advise.module | advise_display_view($view = "view") |
4.x advise.module | advise_display_view($view = "view") |
5.x advise.module | advise_display_view($view = "view") |
This is the page which actually displays the "view" for the user to see their advising session, or for an advisor to advise them.
File
- modules/
advise/ advise.module, line 1320
Code
function advise_display_view($view = "view") {
global $user, $fp, $degree_plan, $screen;
$rtn = "";
if ($view == "what-if") {
$GLOBALS ["fp_advising"]["advising_what_if"] = "yes";
$_REQUEST ["advising_what_if"] = "yes";
}
else {
$GLOBALS ["fp_advising"]["advising_what_if"] = "no";
$_REQUEST ["advising_what_if"] = "no";
}
// Initialize everything we need to initialize for this advising session.
advise_init_screen();
// Add some body classes to the page for this student.
$student = $screen->student;
if (is_object($student)) {
fp_add_body_class("student-rank-$student->db_rank student-catalog-year-$student->catalog_year");
}
fp_add_js(fp_get_module_path("advise") . "/js/advise.js");
// Add advise.css to the screen
fp_add_css(fp_get_module_path("advise") . "/css/advise.css");
// If we are on a print screen, we need to go out of our
// way to set the screen mode, so we don't display certain things
// when we go to draw the screen.
if (strstr($_REQUEST ["q"], "/print")) {
$screen->bool_print = TRUE;
$screen->screen_mode = "not_advising";
}
if ($GLOBALS ["fp_advising"]["advising_what_if"] == "yes" && $GLOBALS ["fp_advising"]["what_if_major_code"] == "") {
// We are in WhatIf, but we have not selected a major, so give
// the user a selection screen.
$screen->screen_mode = "not_advising";
//$rtn .= advise_display_what_if_selection();
// TODO: If graduate degree selection is allowed for graduate students, then change bool_undergrad_only to FALSE.
// (if the student is a grad student!)
$bool_undergrad_only = TRUE;
if ($student->db_rank == 'GR') { // TODO: make it a settings list of graduate ranks?
// TODO: check setting to see if we should allow graduate students to see what if (?) Maybe?
$bool_undergrad_only = FALSE;
}
$rtn .= fp_render_form("advise_what_if_selection_form", "", $bool_undergrad_only);
}
else {
// This is a normal advising screen. Either View or WhatIf.
//$page_content .= $screen->display_view_options();
$screen->build_screen_elements();
$form_token = md5("advise_display_view" . fp_token());
$vurl = fp_url($view);
$rtn .= "<form id='mainform' method='POST' action='$vurl'>
<input type='hidden' name='form_token' value='$form_token'>
<table class='fp-semester-table'>";
$rtn .= $screen->display_screen();
$rtn .= "</table>";
// Add in the required "advising variables"
$rtn .= $screen->get_hidden_advising_variables("save_draft");
$rtn .= "</form>";
// Figure out what the page's sub-tabs should be, and set them.
$tab_array = array();
$tab_array [0]["title"] = "Display by Year";
$tab_array [0]["active"] = ($screen->view != "type");
$tab_array [0]["on_click"] = "changeView(\"year\");";
$tab_array [1]["title"] = "Display by Type";
$tab_array [1]["active"] = ($screen->view == "type");
$tab_array [1]["on_click"] = "changeView(\"type\");";
if (!fp_screen_is_mobile()) {
$tab_array [2]["title"] = "Print";
$tab_array [2]["type"] = "link";
$tab_array [2]["active"] = FALSE;
$tab_array [2]["on_click"] = "popupPrintWindow(\"" . fp_url("$view/print", "advising_view=$screen->view") . "\");";
}
fp_set_page_sub_tabs($tab_array);
watchdog("view_by_$screen->view", "", array(), WATCHDOG_DEBUG);
}
/* We aren't doing anything with these variables, so I am commenting-out
*
// If we are in WhatIf mode, let's write something special to
// the log.
if ($GLOBALS["fp_advising"]["advising_what_if"] == "yes" && $GLOBALS["fp_advising"]["what_if_major_code"] != "")
{
$log_action .= "_whatif";
$log_extra = $GLOBALS["fp_advising"]["what_if_major_code"] . " " . $GLOBALS["fp_advising"]["what_if_track_code"];
}
*/
// print_pre($student->list_courses_taken->toString());
// Should we re-cache the course inventory? If there have been any changes
// to it, then we will see that in a GLOBALS variable...
if (@$GLOBALS ["cache_course_inventory"] == true)
{
$_SESSION ["fp_cache_course_inventory"] = serialize(@$GLOBALS ["fp_course_inventory"]);
}
return $rtn;
}