bolt->update("sex=$sex, birth_year=$birth_year"); } $course_doc = require_once($course->doc_file); function finalize_view($user, $view_id, $action) { if (!$view_id) return null; $view = BoltView::lookup_id($view_id); if ($view && $view->user_id == $user->id && !$view->end_time) { $now = time(); $view->update("end_time=$now, action=$action"); return $view; } return null; } function default_mode($item) { return $item->is_exercise()?BOLT_MODE_SHOW:BOLT_MODE_LESSON; } function create_view($user, $course, $iter, $mode) { $now = time(); $item = $iter->item; $state = $iter->encode_state(); return BoltView::insert("(user_id, course_id, item_name, start_time, mode, state, fraction_done) values ($user->id, $course->id, '$item->name', $now, $mode, '$state', $iter->frac_done)"); } function show_item($iter, $user, $course, $view_id, $mode) { global $bolt_ex_mode; global $bolt_ex_index; $item = $iter->item; if ($item->is_exercise()) { $bolt_ex_mode = $mode; $bolt_ex_index = 0; switch ($mode) { case BOLT_MODE_SHOW: echo "