function _DatabaseHandler::get_faculty_name
Search API
4.x _DatabaseHandler.php | _DatabaseHandler::get_faculty_name($cwid) |
5.x _DatabaseHandler.php | _DatabaseHandler::get_faculty_name($cwid) |
Returns the faculty's first and last name, put together. Ex: John Smith or John W Smith.
Parameters
int $faculty_id:
Return value
string
File
- classes/
_DatabaseHandler.php, line 1049
Class
Code
function get_faculty_name($cwid) {
// Let's pull the needed variables out of our settings, so we know what
// to query, because this is a non-FlightPath table.
//$tsettings = $GLOBALS["fp_system_settings"]["extra_tables"]["human_resources:faculty_staff"];
//$tf = (object) $tsettings["fields"]; //Convert to object, makes it easier to work with.
//$table_name = $tsettings["table_name"];
// Let's perform our queries.
$res = $this->db_query("SELECT * FROM users
WHERE cwid = '?'
AND is_faculty = '1' ", $cwid);
$cur = $this->db_fetch_array($res);
$name = $cur ["f_name"] . " " . $cur ["l_name"];
// Force into pretty capitalization.
// turns JOHN SMITH into John Smith
$name = ucwords(strtolower($name));
return trim($name);
}