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 727
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();
fp_add_js(fp_get_module_path("advise") . "/js/advise.js");
// 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();
}
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());
$rtn .= "<form id='mainform' method='POST' action='" . base_path() . "/$view'>
<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(\"" . base_path() . "/$view/print&advising_view=$screen->view\");";
}
fp_set_page_sub_tabs($tab_array);
watchdog("view_by_$screen->view", "", array(), WATCHDOG_DEBUG);
}
// 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;
}