//Defaults
include("/w/web/eecs/etc/common/sanitize.php");
$sql = '';
$div = "EECS";
print "
\n";
require_once 'change/db.php'; require_once '/w/web/eecs/etc/common/MyG.php'; MyG::dbconnect('spacedb');
include("/w/web/eecs/etc/fac/getfunctions.php");
$match = isset($_GET['match']) ? $_GET['match'] : '';
$match = sanitize($match);
$match = preg_replace("/[^a-zA-Z_-]/", "", $match);
$uniqname = isset($_GET['uniqname']) ? $_GET['uniqname'] : '';
$uniqname = preg_replace("/[^a-zA-Z]/", "", $uniqname);
$shortview = isset($_GET['view']) ? $_GET['view'] : '';
if($shortview != 'list') { $shortview = ''; }
$alpha = isset($_GET['alpha']) ? $_GET['alpha'] : '';
$alpha = preg_replace("/[^A-Z]/", "", $alpha);
$resno = isset($_GET['resno']) ? $_GET['resno'] : 0;
$resno = preg_replace("/[^0-9]/", "", $resno);
$resno = sanitize($resno);
//SQLS
/*
Faculty Types:
| Faculty_Research |
| Faculty_Tenure |
| Faculty_Courtesy |
| Faculty_Lecturer |
| Faculty_Emeritus |
| Faculty_Adjunct |
| Faculty_Lecturer_Term |
*/
$allfac_sql = "SELECT * FROM person " .
"INNER JOIN location ON person.person_id=location.person_id " .
"INNER JOIN status ON person.person_id=status.person_id ";
//Get Faculty by uniqname
if($uniqname)
{
$sql = $allfac_sql . "WHERE person.uniqname = " . "\"" . $uniqname . "\" ";
$pagetitle = "$div Faculty Profiles";
}
//Main page list
if(!$match && !$uniqname)
{
$sql = $allfac_sql . "AND (status.status_type LIKE \"Faculty%\" AND status.status_type != \"Faculty_Emeritus\") ";
$pagetitle = "All $div Faculty";
}
//Get faculty by type
if($match == "All")
{
$sql = $allfac_sql . "AND (status.status_type LIKE \"Faculty%\" AND status.status_type != \"Faculty_Emeritus\") ";
$pagetitle = "All $div Faculty";
}
if($match == "Tenure")
{
$sql = $allfac_sql . "WHERE status.status_type = \"Faculty_Tenure\" ";
$pagetitle = "$div Tenured/Tenure-Track Faculty";
}
if($match == "Emeritus")
{
$sql = $allfac_sql . "WHERE status.status_type = \"Faculty_Emeritus\" ";
$pagetitle = "$div Emeritus Faculty";
}
if($match == "Lecturer")
{
$sql = $allfac_sql . "AND status.status_type LIKE \"Faculty_Lecturer%\" ";
$pagetitle = "$div Lecturers";
}
if($match == "Adjunct")
{
$sql = $allfac_sql . "AND status.status_type = \"Faculty_Adjunct\" ";
$pagetitle = "$div Adjunct Faculty";
}
if($match == "Research")
{
$sql = $allfac_sql . "WHERE status.status_type = \"Faculty_Research\" ";
$pagetitle = "$div Research Faculty";
}
//Search by Research Area
$match2 = preg_replace('/_/', ' ', $match);
$RESareas = array(
"Applied_Electromagnetics_and_RF_Circuits",
"Artificial_Intelligence",
"Communications",
"Computer_Architecture",
"Computer-Aided_Design_and_VLSI",
"Control_Systems",
"Energy_Science_and_Engineering",
"Engineering_Education_Research",
"Integrated_Circuits_and_VLSI",
"Interactive_Systems",
"MEMS_and_Microsystems",
"Optics_and_Photonics",
"Plasma_Science_and_Engineering",
"Power_and_Energy",
"Quantum_Science_and_Technology",
"Robotics",
"Signal_and_Image_Processing",
"Software_Systems",
"Solid-State_Devices_and_Nanotechnology",
"Theory_of_Computation");
//$this_id = get_area_id($match2);
//printerr("$match2 > $this_id");
foreach($RESareas as $r_area)
{
if($match == $r_area)
{
$this_id = get_area_id($match2);
if($match == 'Signal_and_Image_Processing') { $this_id = 36; }
if($this_id)
{
$sql = "SELECT * FROM person " .
"INNER JOIN location ON person.person_id=location.person_id " .
"INNER JOIN area2 ON person.person_id=area2.person_id " .
"INNER JOIN status ON person.person_id=status.person_id " .
"WHERE status.status_type LIKE \"Faculty%\" " .
"AND area2.research_id = " . $this_id . " ";
$pagetitle = "$match2 Faculty";
break;
}
}
}
//Research Areas 1/10/17
$RESareas = array(
"1" => "Applied Electromagnetics and RF Circuits",
"2" => "Artificial Intelligence",
"55" => "Chip Design, Architecture, and Emerging Devices",
"5" => "Network, Communication, and Information Systems",
"49" => "Computer Vision",
"10" => "Control Systems",
"56" => "Databases and Data Mining",
"58" => "Embedded and Mobile Systems",
"51" => "Embedded Systems",
"47" => "Energy Science and Engineering",
"50" => "Engineering Education Research",
"19" => "Human-Computer Interaction",
"44" => "Integrated Circuits and VLSI",
"54" => "Languages, Compilers, and Runtime Systems",
"20" => "MEMS and Microsystems",
"57" => "Networking, Operating Systems,and Distributed Systems",
"26" => "Optics and Photonics",
"46" => "Plasma Science and Engineering",
"48" => "Power and Energy",
"31" => "Quantum Science and Technology",
"45" => "Robotics and Autonomous Systems",
"59" => "Robotics in CSE",
"53" => "Secure, Trustworthy, and Reliable Systems",
"36" => "Signal & Image Processing and Machine Learning",
"38" => "Solid-State Devices and Nanotechnology",
"40" => "Theory of Computation",
"52" => "Warehouse-Scale and Parallel Systems");
if($resno)
{
foreach($RESareas as $r_num => $r_name)
{
if($resno == $r_num)
{
$sql = "SELECT * FROM person " .
"INNER JOIN location ON person.person_id=location.person_id " .
"INNER JOIN area2 ON person.person_id=area2.person_id " .
"INNER JOIN status ON person.person_id=status.person_id " .
"INNER JOIN division ON person.person_id=division.person_id " .
"WHERE status.status_type LIKE \"Faculty%\" " .
"AND area2.research_id = " . $r_num . " ";
$pagetitle = "$r_name Faculty";
break;
}
}
}
//printerr($sql);
//No SQL found?
if(!$sql)
{
$location = "/eecs/etc/fac/" . $div . "faculty.html";
header("Location: $location"); exit;
}
print "
$pagetitle
\n";
//Print Alpha List
if($uniqname)
{
$sqlAlpha = "SELECT * FROM person INNER JOIN location ON person.person_id=location.person_id " .
"INNER JOIN status ON person.person_id=status.person_id " .
"AND (status.status_type LIKE \"Faculty%\" AND status.status_type != \"Faculty_Emeritus\")";
}
else { $sqlAlpha = $sql; }
$alpha1 = $alpha; $alpha = '';
$lnameT = array();
$lnameA = $lnameL = '';
$result = mysql_query($sqlAlpha) or die (mysql_error());
while ($row = mysql_fetch_array($result))
{
$lname = $row["lastname"];
$lnameA = substr($lname, 0, 1); $lnameA = strtoupper($lnameA);
if($lnameA != $lnameL) { array_push($lnameT, $lnameA); $lnameL = $lnameA; }
}
print "
\n";
print "
\n";
print "";
$azRange = range('A','Z');
//$baseB = "/eecs/etc/fac/" . $div . "faculty.html?match=$match&view=$shortview";
foreach ($azRange as $letter)
{
$baseA = "/eecs/etc/fac/" . $div . "faculty.html?match=$match&resno=$resno&view=$shortview&alpha=$letter";
$flag = '';
foreach ($lnameT as $mletter) { if($letter == $mletter) { $flag = 1; } }
if($flag) { print "$letter "; }
else { print "$letter "; }
}
print " |
\n";
print "
\n";
print "
\n";
$alpha = $alpha1;
if($alpha) { $sql .= " AND lastname RLIKE " . "\"^" . $alpha . "\" "; }
$sql .= " ORDER BY person.lastname, person.firstname, person.middlename";
//printerr($sql);
getresults($sql);
?>