function _Course::to_data_string
Search API
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 563
Class
Code
function to_data_string()
{
$rtn = "";
$rtn .= $this->course_id . "~";
$rtn .= $this->assigned_to_semester_num . "~";
$rtn .= fp_join_assoc($this->assigned_to_group_ids_array) . "~";
$rtn .= intval($this->bool_advised_to_take) . "~";
$rtn .= $this->specified_repeats . "~";
$rtn .= intval($this->bool_specified_repeat) . "~";
$rtn .= $this->grade . "~";
$rtn .= $this->get_hours_awarded() * 1 . "~";
$rtn .= $this->term_id . "~";
$rtn .= $this->advised_hours * 1 . "~";
$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 .= fp_join_assoc($this->get_degree_details_data_string("bool_substitution")) . "~";
// If this is a substitution, what is the original requirement?
if ($this->get_bool_substitution(-1))
{
// Create a simple assoc array for our course substitutions, where all we need to keep track of
// is their course_id, not the entire course object.
$temp = $this->get_degree_details_data_string("course_substitution");
$arr = array();
foreach ($temp as $key => $c) {
$arr [$key] = $c->course_id;
}
//$rtn .= $this->course_substitution->course_id . "," . $this->req_by_degree_id . "~";
$rtn .= fp_join_assoc($arr) . "~";
}
else {
// Just enter blank.
$rtn .= "~";
}
///////////////////
$rtn .= fp_join_assoc($this->db_substitution_id_array) . "~";
$rtn .= $this->min_hours * 1 . "~";
$rtn .= $this->max_hours * 1 . "~";
//$rtn .= intval($this->get_bool_substitution_new_from_split()) . "~";
$rtn .= fp_join_assoc($this->get_degree_details_data_string("bool_substitution_new_from_split")) . "~";
//$rtn .= intval($this->get_bool_substitution_split()) . "~";
$rtn .= fp_join_assoc($this->get_degree_details_data_string("bool_substitution_split")) . "~";
// no longer used
//$rtn .= intval($this->bool_has_been_assigned) . "~";
$rtn .= "0~"; // temporary just to keep place. Should probably just be removed.
$rtn .= $this->display_status . "~";
$rtn .= intval($this->bool_ghost_hour) . "~";
$rtn .= fp_join_assoc($this->assigned_to_degree_ids_array) . "~";
$rtn .= $this->req_by_degree_id . "~";
$rtn .= $this->disp_for_group_id . "~";
return $rtn;
}