2007-10-30 22:31:13 +00:00
|
|
|
<?php
|
2008-08-05 22:43:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2007-10-30 22:31:13 +00:00
|
|
|
|
|
|
|
require_once("../inc/bolt_db.inc");
|
|
|
|
require_once("../inc/util.inc");
|
2008-08-14 21:05:02 +00:00
|
|
|
require_once("../inc/bolt_util.inc");
|
2007-10-30 22:31:13 +00:00
|
|
|
|
|
|
|
page_head("Courses");
|
|
|
|
|
2008-02-13 19:02:44 +00:00
|
|
|
$user = get_logged_in_user(false);
|
|
|
|
if ($user) {
|
|
|
|
BoltUser::lookup($user);
|
|
|
|
}
|
2007-10-30 22:31:13 +00:00
|
|
|
|
|
|
|
$courses = BoltCourse::enum();
|
2007-11-29 02:56:10 +00:00
|
|
|
start_table();
|
|
|
|
table_header(
|
2007-12-18 20:28:08 +00:00
|
|
|
"Course", "Status"
|
2007-11-29 02:56:10 +00:00
|
|
|
);
|
2007-10-30 22:31:13 +00:00
|
|
|
foreach ($courses as $course) {
|
2008-02-01 23:11:09 +00:00
|
|
|
if ($course->hidden && !($user->bolt->flags&BOLT_FLAG_SHOW_ALL)) {
|
|
|
|
continue;
|
|
|
|
}
|
2007-11-29 02:56:10 +00:00
|
|
|
$e = $user?BoltEnrollment::lookup($user->id, $course->id):null;
|
2007-10-30 22:31:13 +00:00
|
|
|
if ($e) {
|
2007-12-18 20:28:08 +00:00
|
|
|
$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
|
|
|
|
<br>Last visit: $ago ago
|
|
|
|
<br>$pct% done
|
2008-02-01 23:11:09 +00:00
|
|
|
";
|
|
|
|
if ($view->fraction_done < 1) {
|
|
|
|
$status .= "<br><a href=bolt_sched.php?course_id=$course->id&action=resume>Resume</a>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
$status .= "<br><a href=bolt_sched.php?course_id=$course->id&action=start>Restart</a>
|
2008-08-21 23:24:11 +00:00
|
|
|
| <a href=bolt_course.php?course_id=$course->id>History</a>
|
2007-12-18 20:28:08 +00:00
|
|
|
";
|
2007-11-29 02:56:10 +00:00
|
|
|
} else {
|
2007-12-18 20:28:08 +00:00
|
|
|
$status = "
|
|
|
|
<a href=bolt_sched.php?course_id=$course->id&action=start>Start</a>
|
|
|
|
";
|
2007-10-30 22:31:13 +00:00
|
|
|
}
|
2008-08-14 21:05:02 +00:00
|
|
|
row2_init("<b>$course->name</b>
|
2007-11-29 02:56:10 +00:00
|
|
|
<br><span class=note>$course->description</span>",
|
|
|
|
$status
|
|
|
|
);
|
2008-08-14 21:05:02 +00:00
|
|
|
show_refreshes();
|
|
|
|
echo "</td></tr>\n";
|
2007-10-30 22:31:13 +00:00
|
|
|
}
|
2007-11-29 02:56:10 +00:00
|
|
|
end_table();
|
2007-10-30 22:31:13 +00:00
|
|
|
page_tail();
|
|
|
|
|
|
|
|
?>
|