function _Course::name_equals
Search API
4.x _Course.php | _Course::name_equals($str) |
5.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 1234
Class
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();
}
$temp = explode(" ", $str);
if ($this->subject_id == $temp [0] && ($this->course_num == $temp [1] || trim($temp [1]) == ""))
{
return TRUE;
}
return FALSE;
}