예제 #1
0
        $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']}");
        flush();
    }
}
예제 #2
0
     }
 }
 $courses = new MysqlTable($mysqli, 'evaluation_courses');
 $infoToSet = $evaluationInfo['statistics'];
 $infoToSet['season'] = $evaluationInfo['season'];
 if ($existingEvaluationId) {
     $infoToSet['id'] = $existingEvaluationId;
 }
 $courses->setInfoArray($infoToSet);
 ProjectFunctions::assertAndPrint($courses->commit(), $courses);
 if (!$existingEvaluationId) {
     $existingEvaluationId = $courses->insertId;
 }
 foreach ($evaluationInfo['courses'] as &$course) {
     $courseNames->clearInfo();
     $infoToSet = extractFieldsFromArray(array('subject', 'number', 'section'), $course);
     $infoToSet['course_id'] = $existingEvaluationId;
     $infoToSet['season'] = $evaluationInfo['season'];
     $courseNames->setInfoArray($infoToSet);
     ProjectFunctions::assertAndPrint($courseNames->commit(), $courseNames);
 }
 $evaluationComments = new MysqlTable($mysqli, 'evaluation_comments');
 foreach ($evaluationInfo['comments'] as $type => &$comments) {
     $success = addCourseItemsMappings($evaluationComments, $existingEvaluationId, 'comment', $comments, array('type' => $type));
     if (!$success) {
         echo "php FetchRatings.php --startsubject {$rawCourseSubject} --startnumber {$thisListing['number']} --startsection {$thisListing['section']} --startseason {$season}";
     }
     ProjectFunctions::assertAndPrint($success, $evaluationComments->error);
 }
 $curCourse = $evaluationInfo['courses'][0];
 $log->write("{$pid} Done {$rawCourseSubject} {$thisListing['number']} {$thisListing['section']} {$season} {$crn}", E_NOTICE, $logFlags);