/** * Takes a reference to a Student object and a SOAP response, * Plugs the SOAP values into Student object. * * @param Student $student * @param stdClass $data */ protected function plugValues(&$student, \stdClass $data) { /********************** * Basic Demographics * **********************/ $student->setStudentId($data->banner_id); $student->setUsername($data->user_name); $student->setFirstName($data->first_name); $student->setMiddleName($data->middle_name); $student->setLastName($data->last_name); $student->setPreferredName($data->preferred_name); $student->setBirthDateFromString($data->birth_date); $student->setGender($data->gender); if ($data->confid === 'N') { $student->setConfidentialFlag(false); } else { $student->setConfidentialFlag(true); } // Person type flags if ($data->isstudent == 1) { $student->setStudentFlag(true); } else { $student->setStudentFlag(false); } if ($data->isstaff == 1) { $student->setStaffFlag(true); } else { $student->setStaffFlag(false); } /***************** * Academic Info * *****************/ // Campus if ($data->campus == BannerStudentProvider::MAIN_CAMPUS) { // If campus is 'Main Campus', then we know it's a main campus student $student->setCampus(Student::MAIN_CAMPUS); } else { if ($data->campus != '') { // If the campus is set, but is not 'Main Campus', then we know it's some other campus name (e.g. "Catawba EdD EdLead") // We're not going to check for every possible campus name; as long as there's *something* there, we'll assume it's distance ed $student->setCampus(Student::DISTANCE_ED); } else { // If the campus isn't set, then throw an exception //throw new \InvalidArgumentException("Unrecognized campus ({$data->campus}) for {$data->banner_id}."); } } // Level (grad vs undergrad) if ($data->level == self::UNDERGRAD) { $student->setLevel(Student::UNDERGRAD); } else { if ($data->level == self::GRADUATE) { $student->setLevel(Student::GRADUATE); } else { if ($data->level == self::GRADUATE2) { $student->setLevel(Student::GRADUATE2); } else { if ($data->level == self::DOCTORAL) { $student->setLevel(Student::DOCTORAL); } else { if ($data->level == self::POSTDOC) { $student->setLevel(Student::POSTDOC); } else { throw new \InvalidArgumentException("Unrecognized student level ({$data->level}) for {$data->banner_id}."); } } } } } // Credit Hours $student->setCreditHours($data->creditHours); // Majors - Can be an array of objects, or just a single object if (is_array($data->majors)) { foreach ($data->majors as $major) { $student->addMajor(new AcademicMajor($major->major_code, $major->major_desc, 'U')); } } else { if (is_object($data->majors)) { $student->addMajor(new AcademicMajor($data->majors->major_code, $data->majors->major_desc, 'U')); } } // GPA - Rounded to 4 decimial places $student->setGpa(round($data->gpa, 4)); // Grad date, if available if (isset($data->grad_date) && $data->grad_date != '') { $student->setGradDateFromString($data->grad_date); } // Holds // TODO - Find out what these look like // Contact info $student->setPhone($data->phone); // Address info $student->setAddress($data->addr1); $student->setAddress2($data->addr2); $student->setCity($data->city); $student->setState($data->state); $student->setZip($data->zip); }
/** * Copies student data from Student object to this Internship. * @param Student $student */ private function initalizeStudentData(Student $student) { // Basic student demographics $this->banner = $student->getStudentId(); $this->email = $student->getUsername(); $this->first_name = $student->getFirstName(); $this->middle_name = $student->getMiddleName(); $this->last_name = $student->getLastName(); $this->birth_date = $student->getBirthDate(); $this->setFirstNameMetaphone($student->getFirstName()); $this->setMiddleNameMetaphone($student->getMiddleName()); $this->setLastNameMetaphone($student->getLastName()); // Academic info $this->level = $student->getLevel(); $this->campus = $student->getCampus(); $this->gpa = $student->getGpa(); // Majors - If double major, just take index 0 $majors = $student->getMajors(); if (is_array($majors)) { $this->major_code = $majors[0]->getCode(); $this->major_description = $majors[0]->getDescription(); } else { if (is_object($majors)) { $this->major_code = $majors->getCode(); $this->major_description = $majors->getDescription(); } } // Else, there were no majors set in the Student object // Contact Info $this->phone = $student->getPhone(); // Student address $this->student_address = $student->getAddress(); $this->student_address2 = $student->getAddress2(); $this->student_city = $student->getCity(); $this->student_state = $student->getState(); $this->student_zip = $student->getZip(); }