function DatabaseHandler::get_faculty_name

7.x DatabaseHandler.php DatabaseHandler::get_faculty_name($cwid, $bool_include_cwid = FALSE)
6.x DatabaseHandler.php DatabaseHandler::get_faculty_name($cwid, $bool_include_cwid = FALSE)

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 1330

Class

DatabaseHandler

Code

function get_faculty_name($cwid, $bool_include_cwid = FALSE) {

  $name = '';
  // Let's perform our queries.
  $res = $this->db_query("SELECT f_name, l_name FROM users 
                      WHERE cwid = ?                      
                      AND is_faculty = 1 ", $cwid);


  $cur = $this->db_fetch_array($res);
  if ($cur) {
    $name = $cur ["f_name"] . " " . $cur ["l_name"];


    // Force into pretty capitalization.
    // turns JOHN SMITH into John Smith 
    $name = trim(ucwords(strtolower($name)));

    if ($bool_include_cwid) {
      $name .= " ($cwid)";
    }
  }

  return $name;
}