private function put()
 {
     PHPWS_Core::initModClass('intern', 'Faculty.php');
     //$postarray = json_decode(file_get_contents('php://input'), true);
     $req = Server::getCurrentRequest();
     $postarray = json_decode($req->getRawData(), true);
     $faculty = new FacultyDB();
     $faculty->setId($postarray['id']);
     $faculty->setUsername($postarray['username']);
     $faculty->setFirstName($postarray['first_name']);
     $faculty->setLastName($postarray['last_name']);
     $faculty->setPhone($postarray['phone']);
     $faculty->setFax($postarray['fax']);
     $faculty->setStreetAddress1($postarray['street_address1']);
     $faculty->setStreetAddress2($postarray['street_address2']);
     $faculty->setCity($postarray['city']);
     $faculty->setState($postarray['state']);
     $faculty->setZip($postarray['zip']);
     // Save the faculty object
     PHPWS_Core::initModClass('intern', 'DatabaseStorage.php');
     try {
         DatabaseStorage::saveObject($faculty);
     } catch (Exception $e) {
         header('HTTP/1.1 500 Internal Server Error');
         exit;
     }
     echo json_encode($faculty->extractVars());
     // Exit, since this is called by JSON
     exit;
 }
 public static function getFacultyObjectById($id)
 {
     if (!isset($id)) {
         throw new \InvalidArgumentException('Missing faculty id.');
     }
     $sql = "SELECT intern_faculty.* FROM intern_faculty WHERE intern_faculty.id = {$id}";
     $row = \PHPWS_DB::getRow($sql);
     if (\PHPWS_Error::logIfError($row)) {
         throw new Exception($row);
     }
     $faculty = new FacultyDB();
     $faculty->setId($row['id']);
     $faculty->setUsername($row['username']);
     $faculty->setFirstName($row['first_name']);
     $faculty->setLastName($row['last_name']);
     $faculty->setPhone($row['phone']);
     $faculty->setFax($row['fax']);
     $faculty->setStreetAddress1($row['street_address1']);
     $faculty->setStreetAddress2($row['street_address2']);
     $faculty->setCity($row['city']);
     $faculty->setState($row['state']);
     $faculty->setZip($row['zip']);
     return $faculty;
 }