. require_once("../inc/bolt_db.inc"); require_once("../inc/util.inc"); require_once("../inc/bolt_util.inc"); page_head("Courses"); $user = get_logged_in_user(false); if ($user) { BoltUser::lookup($user); } $courses = BoltCourse::enum(); start_table(); table_header( "Course", "Status" ); foreach ($courses as $course) { if ($course->hidden && !($user->bolt->flags&BOLT_FLAG_SHOW_ALL)) { continue; } $e = $user?BoltEnrollment::lookup($user->id, $course->id):null; if ($e) { $start = date_str($e->create_time); $view = BoltView::lookup_id($e->last_view_id); $ago = time_diff(time() - $view->start_time); $pct = number_format($view->fraction_done*100, 0); $status = "Started $start
Last visit: $ago ago
$pct% done "; if ($view->fraction_done < 1) { $status .= "
id&action=resume>Resume "; } $status .= "
id&action=start>Restart | id>History "; } else { $status = " id&action=start>Start "; } row2_init("$course->name
$course->description", $status ); show_refreshes(); echo "\n"; } end_table(); page_tail(); ?>