public function execute()
 {
     $departmentId = $_REQUEST['department'];
     if (is_null($departmentId) || !isset($departmentId)) {
         throw new InvalidArgumentException('Missing department id.');
     }
     PHPWS_Core::initModClass('intern', 'FacultyFactory.php');
     PHPWS_Core::initModClass('intern', 'DepartmentFactory.php');
     $department = DepartmentFactory::getDepartmentById($departmentId);
     $faculty = FacultyFactory::getFacultyByDepartmentAssoc($department);
     echo json_encode($faculty);
     exit;
     // Exit since this is called by JSON
 }
 private function get()
 {
     PHPWS_Core::initModClass('intern', 'FacultyFactory.php');
     $id = $_GET['id'];
     if (!isset($id) || $id == '') {
         throw new InvalidArgumentException('Missing faculty ID.');
     }
     $faculty = FacultyFactory::getFacultyById($id);
     if (empty($faculty)) {
         header('HTTP/1.1 404 Not Found');
         exit;
     }
     echo json_encode($faculty);
     exit;
 }
 /**
  * Get the Faculty Supervisor object associated with this internship.
  *
  */
 public function getFaculty()
 {
     if (!isset($this->faculty_id)) {
         return null;
     }
     PHPWS_Core::initModClass('intern', 'FacultyFactory.php');
     return FacultyFactory::getFacultyObjectById($this->faculty_id);
 }