ProjectFunctions::assertAndPrint($courseNames->commit(), $courseNames); $courseAreas = new MysqlTable($mysqli, 'course_areas'); ProjectFunctions::assertAndPrint(addCourseItemsMappings($courseAreas, $existingEvaluationId, 'area', $courseInfo['areas']), $courseAreas); $courseSkills = new MysqlTable($mysqli, 'course_skills'); ProjectFunctions::assertAndPrint(addCourseItemsMappings($courseSkills, $existingEvaluationId, 'skill', $courseInfo['skills']), $courseSkills); $courseProfessors = new MysqlTable($mysqli, 'course_professors'); ProjectFunctions::assertAndPrint(addCourseItemsMappings($courseProfessors, $existingEvaluationId, 'professor', $courseInfo['professors']), $courseProfessors); if ($courseInfo['exam']['group'] !== 0) { $examGroups = new MysqlTable($mysqli, 'exam_groups'); $infoToSet = extractFieldsFromArray(array('date', 'time'), $courseInfo['exam']); $infoToSet['id'] = $courseInfo['exam']['group']; $examGroups->setInfoArray($infoToSet); ProjectFunctions::assertAndPrint($examGroups->commit(), $examGroups); } $courseSessions = new MysqlTable($mysqli, 'course_sessions'); $courseSessions->addCond('course_id', $existingEvaluationId); ProjectFunctions::assertAndPrint($courseSessions->executeDeleteQuery(), $courseSessions); $courseSessions->clearSelect(); $courseSessions->setInfo('course_id', $existingEvaluationId); foreach ($courseInfo['sessions'] as &$session) { $infoToSet = extractFieldsFromArray(array('start_time', 'end_time', 'location'), $session); $infoToSet['course_id'] = $existingEvaluationId; foreach ($session['days'] as &$day) { $infoToSet['day_of_week'] = $day; $courseSessions->setInfoArray($infoToSet); ProjectFunctions::assertAndPrint($courseSessions->commit(), $courseSessions); } } $courseFlags = new MysqlTable($mysqli, 'course_flags'); ProjectFunctions::assertAndPrint(addCourseItemsMappings($courseFlags, $existingEvaluationId, 'flag', $courseInfo['extra_flags']), $courseFlags); $log->write("Done {$courseInfo['course_codes']['listings'][0]['subject']} {$courseInfo['course_codes']['listings'][0]['number']} {$courseInfo['course_codes']['oci_id']}");