function advise_init_advising_variables
Search API
7.x advise.module | advise_init_advising_variables($bool_ignore_what_if_variables = FALSE) |
6.x advise.module | advise_init_advising_variables($bool_ignore_what_if_variables = FALSE) |
4.x advise.module | advise_init_advising_variables($bool_ignore_what_if_variables = FALSE) |
5.x advise.module | advise_init_advising_variables($bool_ignore_what_if_variables = FALSE) |
Takes various variables from the REQUEST and stores them in our advising_session_variables table for more convenient use later on.
2 calls to advise_init_advising_variables()
- advise_init_screen in modules/
advise/ advise.module - FlightPath::init in classes/
FlightPath.php
File
- modules/
advise/ advise.module, line 2197
Code
function advise_init_advising_variables($bool_ignore_what_if_variables = FALSE) {
global $user;
$vars = array();
$student = null;
// The current student ID is what we append to all session variables
// dealing with the current student. We do this so that we will
// keep session variables unique, so that we can have more than one
// window open at a time, with multiple students.
// Therefor, this should never go into the session.
// Annoyingly, we must pass carry this around on each page in the system.
$vars ["current_student_id"] = @$_REQUEST ["current_student_id"];
if ($vars ["current_student_id"] == "")
{
$vars ["current_student_id"] = @$_REQUEST ["advising_student_id"];
}
$csid = $vars ["current_student_id"];
$school_id = db_get_school_id_for_student_id($csid);
// Get the student ID.
$vars ["advising_student_id"] = @$_REQUEST ["advising_student_id"];
if ($vars ["advising_student_id"] == "")
{
$vars ["advising_student_id"] = @$_SESSION ["advising_student_id$csid"];
if ($vars ["advising_student_id"] == "")
{ // Default value...
$vars ["advising_student_id"] = $csid;
}
}
// Should we load from the Draft advising session? or the active?
$vars ["advising_load_active"] = @$_REQUEST ["advising_load_active"];
if ($vars ["advising_load_active"] == "")
{ // values will either be "yes" or "" (any other value than "yes" is
// considered to be negative.
// Default value...
$vars ["advising_load_active"] = "";
}
// Are we currently in WhatIf mode?
@$vars ["advising_what_if"] = $_REQUEST ["advising_what_if"]; // Get it from the GET or POST.
if ($vars ["advising_what_if"] == "")
{
// Will equal "yes" if we ARE in whatIf mode.
@$vars ["advising_what_if"] = $_SESSION ["advising_what_if$csid"];
if ($vars ["advising_what_if"] == "")
{
// Default value:
$vars ["advising_what_if"] = "no";
}
}
// Go ahead and set our GLOBALS variable for advising_what_if. It's needed when we load
// the $student variable.
$GLOBALS ["fp_advising"]["advising_what_if"] = $vars ["advising_what_if"];
// Get the major_code(s).
$vars ["advising_major_code"] = @$_REQUEST ["advising_major_code"];
if ($vars ["advising_major_code"] == "")
{
$vars ["advising_major_code"] = @$_SESSION ["advising_major_code$csid"];
if ($vars ["advising_major_code"] == "")
{ // Default value...
if (!$student) {
$student = new Student($csid);
}
$vars ["advising_major_code"] = $student->major_code_csv;
$_REQUEST ["advising_major_code"] = $student->major_code_csv;
}
}
$vars ["advising_track_degree_ids"] = @$_REQUEST ["advising_track_degree_ids"];
if ($vars ["advising_track_degree_ids"] == "")
{
$vars ["advising_track_degree_ids"] = @$_SESSION ["advising_track_degree_ids$csid"];
if ($vars ["advising_track_degree_ids"] == "")
{ // Default value...
if (!$student) {
$student = new Student($csid);
}
// Re-load the major codes, as the tracks might have changed.
$student->load_student_data();
$vars ["advising_major_code"] = $student->major_code_csv;
}
}
// Update the student's settings?
$vars ["advising_update_student_settings_flag"] = @$_REQUEST ["advising_update_student_settings_flag"];
// Make it only come from the POST, for safety.
if ($vars ["advising_update_student_settings_flag"] == "")
{
$vars ["advising_update_student_settings_flag"] = @$_SESSION ["advising_update_student_settings_flag$csid"];
if ($vars ["advising_update_student_settings_flag"] == "")
{ // Default value...
}
}
@$vars ["advising_term_id"] = $_REQUEST ["advising_term_id"]; // Get it from the GET or POST.
if ($vars ["advising_term_id"] == "")
{
// Set to the default advising term.
@$vars ["advising_term_id"] = $_SESSION ["advising_term_id$csid"];
if ($vars ["advising_term_id"] == "")
{
// default value:
$vars ["advising_term_id"] = variable_get_for_school("advising_term_id", '', $school_id);
if ($vars ["advising_term_id"] == "") {
// It's STILL blank?! Just use 0 then.
$vars ["advising_term_id"] = "0";
}
}
}
@$vars ["what_if_major_code"] = $_REQUEST ["what_if_major_code"]; // Get it from the GET or POST.
if ($vars ["what_if_major_code"] == "")
{
// Will equal "yes" if we ARE in whatIf mode.
@$vars ["what_if_major_code"] = $_SESSION ["what_if_major_code$csid"];
if ($vars ["what_if_major_code"] == "")
{
// Default value:
$vars ["what_if_major_code"] = "";
}
}
@$vars ["what_if_catalog_year"] = $_REQUEST ["what_if_catalog_year"]; // Get it from the GET or POST.
if ($vars ["what_if_catalog_year"] == "")
{
@$vars ["what_if_catalog_year"] = $_SESSION ["what_if_catalog_year$csid"];
if ($vars ["what_if_catalog_year"] == "")
{
// Default value:
$vars ["what_if_catalog_year"] = "";
}
}
@$vars ["what_if_track_degree_ids"] = $_REQUEST ["what_if_track_degree_ids"]; // Get it from the GET or POST.
if ($vars ["what_if_track_degree_ids"] == "")
{
// Will equal "yes" if we ARE in whatIf mode.
@$vars ["what_if_track_degree_ids"] = $_SESSION ["what_if_track_degree_ids$csid"];
if ($vars ["what_if_track_degree_ids"] == "")
{
// Default value:
$vars ["what_if_track_degree_ids"] = "";
}
}
if ($vars ["what_if_major_code"] == "none")
{
$vars ["what_if_major_code"] = "";
}
if ($vars ["what_if_track_degree_ids"] == "none")
{
$vars ["what_if_track_degree_ids"] = "";
}
if ($vars ["advising_track_degree_ids"] == "none")
{
$vars ["advising_track_degree_ids"] = "";
}
// Settings... (from the database)
$vars ["setting_available_advising_term_ids"] = variable_get_for_school("available_advising_term_ids", '', $school_id);
$vars ["setting_advising_term_id"] = variable_get_for_school("advising_term_id", '', $school_id);
$vars ["setting_current_catalog_year"] = variable_get_for_school("current_catalog_year", '', $school_id);
$vars ["setting_current_draft_catalog_year"] = variable_get_for_school("current_draft_catalog_year", '', $school_id);
// Are we in Print View?
@$vars ["print_view"] = $_REQUEST ["print_view"];
// Should we try to load from the cache?
@$vars ["load_from_cache"] = $_REQUEST ["load_from_cache"];
if ($vars ["load_from_cache"] == "")
{
// By default, attempt to load from cache.
$vars ["load_from_cache"] = "yes";
}
// What "view" are we in? View by Year or by Type?
// Not the same as printView. printView should work regardless
// of our advising_view.
@$vars ["advising_view"] = $_REQUEST ["advising_view"];
if ($vars ["advising_view"] == "")
{
@$vars ["advising_view"] = $_SESSION ["advising_view$csid"];
}
// Place values into session.
$_SESSION ["advising_student_id$csid"] = $vars ["advising_student_id"];
$_SESSION ["advising_student_id"] = $vars ["advising_student_id"]; // used ONLY in the error report popup!
$_SESSION ["advising_major_code$csid"] = $vars ["advising_major_code"];
$_SESSION ["advising_track_degree_ids$csid"] = $vars ["advising_track_degree_ids"];
$_SESSION ["advising_term_id$csid"] = $vars ["advising_term_id"];
$_SESSION ["advising_what_if$csid"] = $vars ["advising_what_if"];
$_SESSION ["what_if_major_code$csid"] = $vars ["what_if_major_code"];
$_SESSION ["what_if_catalog_year$csid"] = $vars ["what_if_catalog_year"];
$_SESSION ["what_if_track_degree_ids$csid"] = $vars ["what_if_track_degree_ids"];
$_SESSION ["advising_view$csid"] = $vars ["advising_view"];
if ($bool_ignore_what_if_variables == true)
{
$vars ["advising_what_if"] = "";
$vars ["what_if_major_code"] = "";
$vars ["what_if_catalog_year"] = "";
$vars ["what_if_track_degree_ids"] = "";
}
// Are we in draft mode?
if ($_SESSION ["fp_draft_mode"] == "yes")
{
$vars ["bool_use_draft"] = true;
}
else {
$vars ["bool_use_draft"] = false;
}
$GLOBALS ["fp_advising"] = $vars;
// Add our current advising term (and our other settings) to javascript settings.
$js_settings = array(
"advisingTermId" => $GLOBALS ['fp_advising']['advising_term_id'], // The currently selected advising term_id.
"fp_advising_variables" => $vars,
);
fp_add_js($js_settings, "setting");
}