function _FlightPath::init

4.x _FlightPath.php _FlightPath::init($bool_init_advising_variables = false, $bool_ignore_what_if_advising_variables = false, $bool_load_full = true)
5.x _FlightPath.php _FlightPath::init($bool_init_advising_variables = false, $bool_ignore_what_if_advising_variables = false, $bool_load_full = true)
2 calls to _FlightPath::init()
_FlightPath::process_request_save_draft in classes/_FlightPath.php
This function will check to see if we are trying to save the draft from a tab change. It should be near the top of all of FP's "tab" pages, like Main, Comments, etc.
_FlightPath::__construct in classes/_FlightPath.php

File

classes/_FlightPath.php, line 37

Class

_FlightPath

Code

function init($bool_init_advising_variables = false, $bool_ignore_what_if_advising_variables = false, $bool_load_full = true) {

  global $current_student_id, $user;
  // This will initialize this flightPath object
  // based on what is available in the global variables.
  // Takes the place of what was going on at the beginning
  // of advise.php.

  if ($bool_init_advising_variables == true) 
   {
    //$temp_screen = new AdvisingScreen();
    //$temp_screen->init_advising_variables($bool_ignore_what_if_advising_variables);
    //advise_load_advising_variables_from_db($current_student_id, $user->id);
    advise_init_advising_variables();
  }

  $major_code = $GLOBALS ["fp_advising"]["advising_major_code"];
  $track_code = $GLOBALS ["fp_advising"]["advising_track_code"];
  $student_id = $GLOBALS ["fp_advising"]["advising_student_id"];
  $advising_term_id = $GLOBALS ["fp_advising"]["advising_term_id"];
  $available_terms = $GLOBALS ["fp_advising"]["available_advising_term_ids"];



  $this->bool_what_if = false;

  // Are we in WhatIf mode?
  if ($GLOBALS ["fp_advising"]["advising_what_if"] == "yes") 
   {
    $major_code = $GLOBALS ["fp_advising"]["what_if_major_code"];
    $track_code = $GLOBALS ["fp_advising"]["what_if_track_code"];
    $this->bool_what_if = true;

  }

  if ($bool_load_full == false) 
   { // not trying to load anything, so return.
    return;
  }

  $db = $this->db;


  if ($bool_load_full == true) 
   {
    $student = new Student($student_id);
  }
  else {
    $student = new Student();
    $student->student_id = $student_id;

  }



  $settings = fp_get_system_settings();

  $catalog_year = $student->catalog_year;
  if ($this->bool_what_if) 
   {
    $catalog_year = $settings ["current_catalog_year"];
  }

  // make sure their catalog year is not past the system's current
  // year setting.
  if ($catalog_year > $settings ["current_catalog_year"]
   && $settings ["current_catalog_year"] > $settings ["earliest_catalog_year"]) 
   { // Make sure degree plan is blank if it is!
    $catalog_year = 99999;
  }

  if ($GLOBALS ["fp_advising"]["advising_update_student_settings_flag"] != "") 
   {
    $student->array_settings ["track_code"] = $track_code;
    $student->array_settings ["major_code"] = $major_code;
  }

  $t_major_code = $major_code;

  if ($track_code != "") 
   {
    // Does the major_code already have a | in it?
    if (!strstr($t_major_code, "|")) 
     {
      $t_major_code .= "|_" . $track_code;
    }
    else {
      // it DOES have a | in it already, so just add the
      // trackCode using _.  This is most likely because
      // we are dealing with a track AND a concentration.
      $t_major_code .= "_" . $track_code;
    }
  }


  $degree_id = $db->get_degree_id($t_major_code, $catalog_year);

  if ($student->array_settings ["track_code"] != "" && $this->bool_what_if == false
     && $student->array_settings ["major_code"] == $major_code) 
   {
    // The student has a selected track in their settings,
    // so use that (but only if it is for their current major-- settings
    // could be old!)

    $t_major_code = $student->get_major_and_track_code();
    $temp_degree_id = $db->get_degree_id($t_major_code, $student->catalog_year);
    if ($temp_degree_id) {
      $degree_id = $temp_degree_id;
    }
  }




  if ($bool_load_full == true) 
   {
    $this->student = $student;

    $degree_plan = new DegreePlan($degree_id, $db, false, $student->array_significant_courses);

    $degree_plan->add_semester_developmental($student->student_id);
    $this->degree_plan = $degree_plan;
  }



}