function advise_display_view
Search API
7.x advise.module | advise_display_view($view = "view") |
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.
1 call to advise_display_view()
- audit_display_audit in modules/
audit/ audit.module
File
- modules/
advise/ advise.module, line 1457
Code
function advise_display_view($view = "view") {
global $user, $fp, $degree_plan, $screen, $current_student_id;
$rtn = "";
// Do we need to rebuild the course inventory cache?
if (system_check_course_inventory_should_be_reloaded()) {
system_reload_and_cache_course_inventory();
}
fp_set_title('');
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();
$render = array();
$render ['#id'] = 'advise_display_view';
$render ['#view'] = $view;
$render ['#fp'] = $fp;
$render ['#degree_plan'] = $degree_plan;
$render ['#screen'] = $screen;
$render ['#current_student_id'] = $current_student_id;
$render ['#advising_term_id'] = $GLOBALS ['fp_advising']['advising_term_id'];
$school_id = db_get_school_id_for_student_id($current_student_id);
// 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");
}
$render ['#student'] = $student;
fp_add_js(fp_get_module_path("advise") . "/js/advise.js");
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";
// 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;
$grad_level_codes = csv_to_array(variable_get_for_school("graduate_level_codes", "GR", $school_id));
if (in_array($student->db_rank, $grad_level_codes)) {
$bool_undergrad_only = FALSE;
}
// Check school setting: should we show all (both grad and undergrad) degrees on What If?
// This will overwrite the logic above.
if (variable_get_for_school('show_both_undergrad_and_grad_degrees_in_what_if', 'no', $school_id) == 'yes') {
$bool_undergrad_only = FALSE;
}
$render ['#bool_undergrad_only'] = $bool_undergrad_only;
$render ['whatif_selection_form'] = array(
'value' => fp_render_form("advise_what_if_selection_form", "", $bool_undergrad_only),
'weight' => 100,
);
//$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);
$render ['degree_plan_wrapper_top'] = array(
'value' => "<div class='degree-plan-wrapper'>
<form id='mainform' method='POST' action='$vurl'>
<input type='hidden' name='form_token' value='$form_token'>
<table class='fp-semester-table'>",
'weight' => 200,
);
/*
$rtn .= "<div class='degree-plan-wrapper'>
<form id='mainform' method='POST' action='$vurl'>
<input type='hidden' name='form_token' value='$form_token'>
<table class='fp-semester-table'>";
*/
$render ['display_screen'] = array(
'value' => $screen->display_screen(),
'weight' => 300,
);
//$rtn .= $screen->display_screen();
$render ['semester_table_close'] = array(
'value' => "</table>",
'weight' => 350,
);
//$rtn .= "</table>";
// Add in the required "advising variables"
$render ['hidden_advising_variables'] = array(
'value' => $screen->get_hidden_advising_variables("save_draft"),
'weight' => 400,
);
//$rtn .= $screen->get_hidden_advising_variables("save_draft");
$render ['close_form_and_wrapper'] = array(
'value' => "</form></div>",
'weight' => 500,
);
//$rtn .= "</form>";
//$rtn .= "</div>"; // degree-plan-wrapper
// Figure out what the page's sub-tabs should be, and set them.
$tab_array = array();
$tab_array [1]["title"] = "Display by Year";
$tab_array [1]["active"] = ($screen->view != "type");
$tab_array [1]["on_click"] = "changeView(\"year\");";
$tab_array [2]["title"] = "Display by Type";
$tab_array [2]["active"] = ($screen->view == "type");
$tab_array [2]["on_click"] = "changeView(\"type\");";
if ($view == 'what-if') {
//$what_if_select = "<span class='what-if-change-settings'>" . l("<i class='fa fa-cog'></i> " . t("Change Settings"), "what-if", "advising_what_if=yes&what_if_major_code=none&what_if_track_code=none&what_if_track_degree_ids=none¤t_student_id=$current_student_id") . "</span>";
$tab_array [3]["label"] = "\"What If?\" Mode";
$tab_array [3]['text'] = "<i class='fa fa-pencil'></i>";
$tab_array [3]['link_title'] = "Change What If settings?";
$tab_array [3]['link_class'] = "change-what-if-link";
$tab_array [3]["type"] = "link";
$tab_array [3]["active"] = FALSE;
$tab_array [3]["on_click"] = "window.location=\"" . fp_url('what-if', "advising_what_if=yes&what_if_major_code=none&what_if_track_code=none&what_if_track_degree_ids=none¤t_student_id=$current_student_id") . "\";";
}
$advising_term_id = @$GLOBALS ["fp_advising"]["advising_term_id"];
if ($advising_term_id != "" && user_has_permission("can_advise_students")) {
// If this is someone who is allowed to change terms. (advisor or above)
$t_term_id = $advising_term_id;
$for_term = " " . t("for") . " ";
$termdesc = get_term_description($t_term_id, FALSE, $school_id);
$furl = fp_url("advise/popup-change-term");
$tab_array [4]["label"] = "Advising Term: $termdesc ($t_term_id)";
$tab_array [4]['text'] = "<i class='fa fa-pencil'></i>";
$tab_array [4]['link_title'] = "Change term?";
$tab_array [4]['link_class'] = "change-term-link";
$tab_array [4]["type"] = "link";
$tab_array [4]["active"] = FALSE;
$tab_array [4]["on_click"] = "popupSmallIframeDialog(\"" . $furl . "\",\"" . t('Select an Advising Term') . "\",\"advising_term_id=$t_term_id\");";
}
fp_set_page_sub_tabs($tab_array);
watchdog("view_by_$screen->view", "$current_student_id", array());
}
// 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"]);
}
// Let's set our breadcrumbs
$db = get_global_database_handler();
$crumbs = array();
$crumbs [] = array(
'text' => 'Students',
'path' => 'student-search',
);
$crumbs [] = array(
'text' => $db->get_student_name($screen->student->student_id) . " ({$screen->student->student_id})",
'path' => 'student-profile',
'query' => "current_student_id={$screen->student->student_id}",
);
fp_set_breadcrumbs($crumbs);
return fp_render_content($render);
//return $rtn;
}