function Course::name_equals

6.x Course.php Course::name_equals($str)

This function is used for comparing a course name to the subject_id and course_num of $this. We expect a space between the subject_id and CourseNum in $str.

For example: MATH 1010

You may also ONLY specify a subject, ex: BIOL. If you do that, then only the subject will be compared.

Example of use: if ($c->name_equals("ART 101")) then do this etc.

Parameters

string $str:

Return value

bool

File

classes/Course.php, line 1216

Class

Course

Code

function name_equals($str) 
 {
  // We expect the str to be given to us
  // with a space b/t the subject_id and course_num.
  // ex:  MATH 111
  // may also ONLY specify the subject. ex:  BIOL

  // If our $subject_id is not populated, then call load_descriptive_data()
  if ($this->subject_id == "") {
    $this->load_descriptive_data();
  }

  // TODO: We should check ALL names for this course. Use get_all_names to do that.


  $temp = explode(" ", $str);
  if ($this->subject_id == $temp [0] && ($this->course_num == $temp [1] || trim($temp [1]) == "")) 
   {
    return TRUE;
  }

  return FALSE;

}