function AdvisingScreen::fix_institution_name
Search API
7.x AdvisingScreen.php | AdvisingScreen::fix_institution_name($str) |
6.x AdvisingScreen.php | AdvisingScreen::fix_institution_name($str) |
Simple function to make an institution name look more pretty, because all institution names pass through ucwords(), sometimes the capitalization gets messed up. This function tries to correct it.
Feel free to override it and add to it, if needed.
Parameters
string $str:
Return value
string
2 calls to AdvisingScreen::fix_institution_name()
- AdvisingScreen::display_popup_course_description in classes/
AdvisingScreen.php - Displays the contents of the Descripton tab for the course popup.
- AdvisingScreen::display_toolbox_transfers in classes/
AdvisingScreen.php - Used in the Toolbox popup, this will display content of the tab which shows a student's transfers
File
- classes/
AdvisingScreen.php, line 3175
Class
Code
function fix_institution_name($str)
{
$student_id = $this->student->student_id;
$school_id = db_get_school_id_for_student_id($student_id);
// Should we do this at all? We will look at the "autocapitalize_institution_names" setting.
$auto = variable_get_for_school("autocapitalize_institution_names", 'yes', $school_id);
if ($auto == "no") {
// Nope! Just return.
return $str;
}
$str = str_replace("-", " - ", $str);
$str = ucwords(strtolower($str));
$str = str_replace(" Of ", " of ", $str);
$str = str_replace("clep", "CLEP", $str);
$str = str_replace("_clep", "CLEP", $str);
$str = str_replace("_act", "ACT", $str);
$str = str_replace("_sat", "SAT", $str);
$str = str_replace("Ap ", "AP ", $str);
$str = str_replace("_dsst", "DSST", $str);
// Fix school initials.
// Turns "Ulm" into "ULM"
$school_initials = variable_get_for_school("school_initials", "DEMO", $school_id);
$str = str_replace(ucwords(strtolower($school_initials)), $school_initials, $str);
if ($str == "")
{
$str = "<i>unknown institution</i>";
}
return $str;
}