Example #1
0
 private function extractSection($row, $section_info)
 {
     $sec = Section::firstOrNew($section_info);
     $values = ['term' => trim($row->childNodes->item(0)->textContent), 'section_number' => intval($row->childNodes->item(2)->textContent), 'credits' => intval($row->childNodes->item(3)->textContent), 'raw_times' => $this->DOMinnerHTML($row->childNodes->item(5)->childNodes->item(0)), 'raw_locations' => $this->DOMinnerHTML($row->childNodes->item(6)->childNodes->item(0)), 'instructor_id' => Instructor::firstOrCreate(['name' => $row->childNodes->item(4)->textContent])->id, 'section_type_id' => SectionType::firstOrCreate(['name' => $row->childNodes->item(8)->textContent])->id];
     foreach ($values as $key => $value) {
         $sec->{$key} = $value;
     }
     $this->createOrUpdateEnrollment($sec, $this->extractEnrollmentData($row, 10), 'current_enrollment_id');
     $this->createOrUpdateEnrollment($sec, $this->extractEnrollmentData($row, 13), 'waitlist_enrollment_id');
     return $sec;
 }
 private function getAll()
 {
     return SectionType::orderBy('id', 'asc');
 }
Example #3
0
 public function __construct()
 {
     parent::__construct();
     $this->instructors = Instructor::all();
     $this->section_types = SectionType::all();
     $this->terms = ['W15', 'Sp15', 'Su15'];
 }