function clear() { global $course_id; admin_page_head("Deleting course data"); BoltEnrollment::delete_aux("course_id = {$course_id}"); BoltView::delete_aux("course_id = {$course_id}"); BoltResult::delete_aux("course_id = {$course_id}"); BoltXsetResult::delete_aux("course_id = {$course_id}"); BoltSelectFinished::delete_aux("course_id = {$course_id}"); BoltRefreshRec::delete_aux("course_id = {$course_id}"); BoltQuestion::delete_aux("course_id = {$course_id}"); echo "\n\t\tCourse data deleted.\n\t"; admin_page_tail(); }
$now = time(); $id = BoltXsetResult::insert("(create_time, user_id, course_id, name, score, view_id) values ({$now}, {$user->id}, {$course->id}, '{$xset->name}', {$avg_score}, {$view_id})"); $refresh_intervals = $xset->refresh; if ($refresh_intervals) { $refresh_rec = BoltRefreshRec::lookup("user_id={$user->id} and course_id={$course->id} and name='{$xset->name}'"); if ($refresh_rec) { $count = $refresh_rec->count; $n = count($refresh_intervals->intervals); if ($count >= $n) { $count = $n - 1; } $due_time = time() + $refresh_intervals->intervals[$count] * 86400; $refresh_rec->update("create_time={$now}, xset_result_id={$id}, due_time={$due_time}"); } else { $due_time = time() + $refresh_intervals->intervals[0] * 86400; BoltRefreshRec::insert("(user_id, course_id, name, create_time, xset_result_id, due_time, count) values ({$user->id}, {$course->id}, '{$xset->name}', {$now}, {$id}, {$due_time}, 0)"); } } } } // show the answer page if ($item->has_answer_page) { srand($view_id); $view_id = create_view($iter, BOLT_MODE_ANSWER, $view->id); show_item($iter, $view_id, $view->id, BOLT_MODE_ANSWER, $repeat); } else { show_next($iter, $view); } break; case 'answer_page': $view = BoltView::lookup_id($view_id);