function _Course::to_data_string

4.x _Course.php _Course::to_data_string()
5.x _Course.php _Course::to_data_string()

This function will create a "data string" of the course. Think of it as a poor man's serialize. I can't actually use serialize, as I have to call this for every course on the screen, and the page load time was too long when using serialize, probably because of all the extra fields which I did not need.

The string returned will be used to send information about this course to a popup window.

Important details about the course are put into a particular order, separated by commas. Booleans are converted to either 1 or 0.

This function is the mirror of load_course_from_data_string().

Return value

string

File

classes/_Course.php, line 137

Class

_Course

Code

function to_data_string() 
 {
  $rtn = "";

  $rtn .= $this->course_id . "~";
  $rtn .= $this->assigned_to_semester_num . "~";
  $rtn .= $this->assigned_to_group_id . "~";
  $rtn .= intval($this->bool_advised_to_take) . "~";
  $rtn .= $this->specified_repeats . "~";
  $rtn .= intval($this->bool_specified_repeat) . "~";
  $rtn .= $this->grade . "~";
  $rtn .= $this->hours_awarded . "~";
  $rtn .= $this->term_id . "~";
  $rtn .= $this->advised_hours . "~";

  $rtn .= intval($this->bool_transfer) . "~";

  // If this is a transfer, then we will put in various information
  // about the original transfer course...
  if ($this->bool_transfer == true) 
   {
    $rtn .= $this->course_transfer->course_id . "~";
  }
  else {
    // Just enter blank.
    $rtn .= "~";
  }

  $rtn .= intval($this->bool_added_course) . "~";
  $rtn .= $this->db_advised_courses_id . "~";
  $rtn .= $this->random_id . "~";

  $rtn .= intval($this->bool_substitution) . "~";
  // If this is a substitution, what is the original requirement?
  if ($this->bool_substitution == true) 
   {
    $rtn .= $this->course_substitution->course_id . "~";
  }
  else {
    // Just enter blank.
    $rtn .= "~";
  }

  $rtn .= $this->db_substitution_id . "~";
  $rtn .= $this->min_hours . "~";
  $rtn .= $this->max_hours . "~";

  $rtn .= intval($this->bool_substitution_new_from_split) . "~";
  $rtn .= intval($this->bool_substitution_split) . "~";
  $rtn .= intval($this->bool_has_been_assigned) . "~";

  $rtn .= $this->display_status . "~";

  $rtn .= intval($this->bool_ghost_hour) . "~";




  return $rtn;
}