EECS
EECS
\n"; require_once 'change/db.php'; require_once '/w/web/eecs/etc/common/MyG.php'; MyG::dbconnect('spacedb'); include("/w/web/eecs/etc/staff/getfunctions.php"); $match = isset($_GET['match']) ? $_GET['match'] : ''; $match = sanitize($match); $match = preg_replace("/[^a-zA-Z0-9_-]/", "", $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); //Basic SQLS $staff_sql = "SELECT * FROM person " . "INNER JOIN location ON person.person_id=location.person_id " . "INNER JOIN status ON person.person_id=status.person_id " . "WHERE status.status_type LIKE \"Staff%\" "; $unit_sql = "SELECT * FROM person " . "INNER JOIN location ON person.person_id=location.person_id " . "INNER JOIN unit ON person.person_id=unit.person_id " . "INNER JOIN status ON person.person_id=status.person_id " . "WHERE status.status_type LIKE \"Staff%\" "; //Get all Staff if(!$match || $match == "EECS" || $match == "All") { $sql = $staff_sql; $pagetitle = "All $div Staff"; } //Get all Staff using first letter of last name if(strlen($match) == 1) { $sql = $staff_sql . "AND lastname RLIKE " . "\"^" . $match . "\" "; $pagetitle = "$div " . "\"$match\"" . " Staff"; } //Get Staff by uniqname $allstaff_sql = "SELECT * FROM person " . "INNER JOIN location ON person.person_id=location.person_id " . "INNER JOIN status ON person.person_id=status.person_id "; if($uniqname) { $sql = $allstaff_sql . "WHERE person.uniqname = " . "\"" . $uniqname . "\" "; $pagetitle = "$div Staff Profiles"; } //Match by Affiliation $affiliations = array( "celab" => "Computer Engineering", "ai" => "Artifical Intelligence", "vlsi" => "Circ/VLSI", "citi" => "Center for Information Technology Integration", "comm" => "Communications", "control" => "Control", "cspl" => "Communications and Signal Processing", "cuos" => "Center for Ultra-Fast Optics", "radlab" => "Radiation Laboratory", "interactive_sys" => "Interactive Systems", "lnf" => "Lurie Nanofabrication Facility", "mems" => "Micro Electro Mechanical Systems", "micl" => "Michigan Integrated Circuits Lab", "optics" => "Optics and Photonics", "power_energy" => "Power/Energy", "signal_proc" => "Signal Processing", "ssel" => "Solid-State Electronics", "systems" => "Software Systems", "theory" => "Theory of Compution", "none" => "Unknown"); //Get staff by affiliation foreach($affiliations as $affiliate => $aff_name) { if($match == $affiliate) { $sql = $unit_sql . "AND unit.unit_name = " . "\"" . $match . "\" "; $pagetitle = $aff_name . " Staff"; } } //Match by Staff Type $stafftypes = array( "Staff_Central" => "Central", "Staff_Chair" => "Chair", "Staff_DCO" => "DCO", "Staff_Grad" => "Graduate", "Staff_Lab" => "Lab", "Staff_Undergrad" => "Undergraduate", "Staff_Temp" => "Temporary", "Staff_Other" => "Other"); //Get staff by type foreach($stafftypes as $stafftype => $type_name) { if($match == $stafftype) { $sql = $staff_sql . "AND status.status_type = " . "\"" . $match . "\" "; $pagetitle = "$div $type_name Staff"; } } //Match by Staff Group $grouptypes = array( "ss" => "Student Services", "hr" => "Human Resources", "ra" => "Research Admin Support", "rc" => "Research Center Support", "rt" => "Research Technical", "cb" => "Central Business Services", "ps" => "Purchasing Services", "co" => "Communications", "dco" => "DCO Tech Support", "cs" => "Curricular Services", "cl" => "Instructional Lab Support", "fa" => "Facilities", "ch" => "Chair's Office", "erb" => "ECE ERB", "ece2nd" => "ECE 2nd Floor", "ece3rd" => "ECE 3rd Floor", "ece4th" => "ECE 4th Floor"); foreach($grouptypes as $grouptype => $group_name) { if($match == $grouptype) { $staffgroup_sql = "SELECT * FROM person " . "INNER JOIN location ON person.person_id=location.person_id " . "INNER JOIN status ON person.person_id=status.person_id " . "INNER JOIN staffgroups ON person.person_id=staffgroups.person_id " . "WHERE status.status_type LIKE \"Staff%\" "; $sql = $staffgroup_sql . "AND staffgroups.staffgroup_type = " . "\"" . $group_name . "\" "; $pagetitle = "$div $group_name Staff"; if($match == 'dco') { $sql = $staff_sql . "AND status.status_type = " . "\"" . "Staff_DCO" . "\" "; $pagetitle = "$div DCO Staff"; } } } //Get staff sorted by affiliation if($match == "affil") { $sql = "SELECT * FROM person " . "INNER JOIN location ON person.person_id=location.person_id " . "INNER JOIN status ON person.person_id=status.person_id " . "WHERE status.status_type LIKE \"Staff%\" " . "AND status.status_type != \"Staff_Lab\" " . "ORDER BY status.status_type, lastname, firstname"; $pagetitle = "$div Staff by Affiliation"; } //No SQL found? if(!$sql) { $location = "/eecs/etc/staff/" . $div . "staff.html"; header("Location: $location"); exit; } //Add CSE to CSE Lab Names $cseaddons = array("Artifical Intelligence","Computer Engineering","Interactive Systems","Software Systems","Theory of Compution"); foreach($cseaddons as $cseaddon) { if(preg_match("/^$cseaddon/",$pagetitle)) { $pagetitle = "CSE " . $pagetitle; } } $pagetitle = preg_replace("/EECS ECE/","ECE",$pagetitle); 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 \"Staff%\" "; } 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 "\n"; print "
"; $azRange = range('A','Z'); foreach ($azRange as $letter) { $baseA = "/eecs/etc/staff/" . $div . "staff.html?match=$match&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"; $alpha = $alpha1; if($alpha) { $sql .= " AND lastname RLIKE " . "\"^" . $alpha . "\" "; } if($match != "affil") { $sql .= " ORDER BY person.lastname, person.firstname, person.middlename"; } getresults($sql); ?>