function Course::to_string

7.x Course.php Course::to_string($pad = " ", $bool_show_random = false)
6.x Course.php Course::to_string($pad = " ", $bool_show_random = false)

This is the to_string method for Course. Because we want to pass it values, we are not using the magic method of "__to_string". So, to use, invoke this method directly. Ex:

$x = $newCourse->to_string("", true);

Parameters

string $pad:

  • How much padding to use. Specified in the form of a string of spaces. Ex: " "

bool $bool_show_random:

  • Display the randomly assigned number which goes with this course.

Return value

string

File

classes/Course.php, line 1995

Class

Course

Code

function to_string($pad = "      ", $bool_show_random = false) 
 {
  $rtn = "";

  if ($this->subject_id == "") {
    $this->load_descriptive_data();
  }

  if ($bool_show_random) {
    $x = "rnd:$this->random_id -";
  }

  $rtn = $pad . "$this->course_id $x- $this->subject_id $this->course_num (" . $this->get_hours_awarded() . ") $this->grade $this->term_id";

  if ($this->course_list_fulfilled_by->is_empty != true) {
    // In other words, if this is a requirement, and it is
    // being fulfilled by one of the student's courses,
    // then let's see it.
    $rtn .= " ->fulfilled by " . $this->course_list_fulfilled_by->get_first()->to_string("");
  }

  if ($this->bool_transfer == true && is_object($this->course_transfer)) 
   {
    $rtn .= " - XFER eqv to " . $this->course_transfer->to_string("");
  }
  else if ($this->bool_transfer == true) {
    $rtn .= " - XFER no eqv ";
  }


  if ($this->bool_advised_to_take) {
    $rtn .= " - adv in sem " . $this->assigned_to_semester_num . ".";
  }

  if ($this->bool_substitution) {
    $rtn .= " - substitution.";
  }


  if ($this->db_exclude > 0) {
    $rtn .= " - db_exclude = $this->db_exclude";
  }

  if ($this->specified_repeats > 0) {
    $rtn .= " reps: $this->specified_repeats";
  }


  $rtn .= "\n";
  return $rtn;
}