/** * 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); }