function _AdvisingScreen::fix_institution_name

4.x _AdvisingScreen.php _AdvisingScreen::fix_institution_name($str)
5.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 2980

Class

_AdvisingScreen

Code

function fix_institution_name($str) 
 {

  // Should we do this at all?  We will look at the "autocapitalize_institution_names" setting.
  $auto = $GLOBALS ["fp_system_settings"]["autocapitalize_institution_names"];
  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 = $GLOBALS ["fp_system_settings"]["school_initials"];
  $str = str_replace(ucwords(strtolower($school_initials)), $school_initials, $str);


  if ($str == "") 
   {
    $str = "<i>unknown institution</i>";
  }



  return $str;
}