2007-12-07 23:23:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once("../inc/util.inc");
|
|
|
|
|
|
|
|
$user = get_logged_in_user();
|
|
|
|
|
2008-01-28 15:48:09 +00:00
|
|
|
function phase_name($phase) {
|
|
|
|
switch ($phase) {
|
|
|
|
case BOLT_PHASE_STUDY: return "study";
|
|
|
|
case BOLT_PHASE_REVIEW: return "review";
|
|
|
|
case BOLT_PHASE_REFRESH: return "refresh";
|
|
|
|
default: return "unknown phase: $phase";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-07 23:23:25 +00:00
|
|
|
function mode_name($mode) {
|
|
|
|
switch ($mode) {
|
|
|
|
case BOLT_MODE_LESSON: return "lesson";
|
|
|
|
case BOLT_MODE_SHOW: return "exercise";
|
2008-01-31 23:43:37 +00:00
|
|
|
case BOLT_MODE_ANSWER: return "answer page";
|
2007-12-18 21:48:36 +00:00
|
|
|
case BOLT_MODE_FINISHED: return "course completed";
|
2008-01-28 15:48:09 +00:00
|
|
|
default: return "unknown mode: $mode";
|
2007-12-07 23:23:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function action_name($action) {
|
|
|
|
switch ($action) {
|
|
|
|
case BOLT_ACTION_NONE: return "None";
|
|
|
|
case BOLT_ACTION_NEXT: return "Next";
|
2007-12-18 20:28:08 +00:00
|
|
|
case BOLT_ACTION_PREV: return "Previous";
|
2007-12-07 23:23:25 +00:00
|
|
|
case BOLT_ACTION_SUBMIT: return "Submit";
|
|
|
|
case BOLT_ACTION_QUESTION: return "Question";
|
2007-12-19 16:31:41 +00:00
|
|
|
case BOLT_ACTION_COURSE_HOME: return "Course home";
|
2007-12-18 20:28:08 +00:00
|
|
|
default: return "unknown: $action";
|
2007-12-07 23:23:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_view($view) {
|
|
|
|
if ($view->end_time) {
|
|
|
|
$d = $view->end_time - $view->start_time;
|
|
|
|
$dur = "$d seconds";
|
|
|
|
} else {
|
|
|
|
$dur = "---";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($view->result_id) {
|
|
|
|
$result = BoltResult::lookup_id($view->result_id);
|
2007-12-18 23:37:26 +00:00
|
|
|
$qs = str_replace("action=answer", "action=answer_page", $result->response);
|
|
|
|
$x = "<br>Score: $result->score
|
|
|
|
<br><a href=bolt_sched.php?$qs>Answer page</a>";
|
2007-12-07 23:23:25 +00:00
|
|
|
}
|
|
|
|
echo "<tr>
|
2008-02-10 05:17:57 +00:00
|
|
|
<td valign=top>$view->id</td>
|
2007-12-18 23:37:26 +00:00
|
|
|
<td valign=top>".time_str($view->start_time)."</td>
|
|
|
|
<td valign=top>$dur</td>
|
|
|
|
<td valign=top>$view->item_name</td>
|
|
|
|
<td valign=top>".mode_name($view->mode)." $x</td>
|
2008-02-07 01:09:30 +00:00
|
|
|
";
|
|
|
|
//<td valign=top>".phase_name($view->phase)."</td>
|
|
|
|
echo "
|
2007-12-18 23:37:26 +00:00
|
|
|
<td valign=top>".action_name($view->action)."</td>
|
2007-12-07 23:23:25 +00:00
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
2008-01-31 23:43:37 +00:00
|
|
|
function show_views() {
|
|
|
|
global $user;
|
|
|
|
global $course;
|
|
|
|
|
|
|
|
$views = BoltView::enum("user_id=$user->id and course_id=$course->id order by id desc");
|
|
|
|
start_table();
|
|
|
|
|
2008-02-10 05:17:57 +00:00
|
|
|
table_header("ID", "Time", "Duration", "Item", "Mode",
|
2008-02-07 01:09:30 +00:00
|
|
|
// "Phase",
|
|
|
|
"Action");
|
2008-01-31 23:43:37 +00:00
|
|
|
foreach ($views as $view) {
|
|
|
|
show_view($view);
|
|
|
|
}
|
|
|
|
end_table();
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_refresh($r) {
|
|
|
|
echo "<tr>
|
|
|
|
<td>".time_str($r->create_time)."</td>
|
|
|
|
<td>$r->name
|
|
|
|
<a href=bolt_sched.php?course_id=$r->course_id&refresh_id=$r->id&action=start>Start</a>
|
|
|
|
<a href=bolt_sched.php?course_id=$r->course_id&refresh_id=$r->id&action=resume>Resume</a>
|
|
|
|
</td>
|
|
|
|
<td>".time_str($r->due_time)."</td>
|
|
|
|
</tr>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function show_refreshes() {
|
|
|
|
global $user;
|
|
|
|
global $course;
|
|
|
|
|
|
|
|
$refreshes = BoltRefreshRec::enum("user_id=$user->id and course_id=$course->id");
|
|
|
|
start_table();
|
|
|
|
table_header("Created", "Unit", "Due");
|
|
|
|
foreach ($refreshes as $r) {
|
|
|
|
show_refresh($r);
|
|
|
|
}
|
|
|
|
end_table();
|
|
|
|
}
|
|
|
|
|
2007-12-07 23:23:25 +00:00
|
|
|
require_once("../inc/bolt_db.inc");
|
|
|
|
|
|
|
|
$course_id = get_int('course_id');
|
|
|
|
$course = BoltCourse::lookup_id($course_id);
|
2008-01-31 23:43:37 +00:00
|
|
|
if (!$course) error_page("No such course");
|
2007-12-07 23:23:25 +00:00
|
|
|
page_head("Your history in $course->name");
|
|
|
|
|
2008-01-31 23:43:37 +00:00
|
|
|
show_views();
|
|
|
|
show_refreshes();
|
2007-12-07 23:23:25 +00:00
|
|
|
|
|
|
|
echo "
|
2008-01-31 23:43:37 +00:00
|
|
|
<a href=bolt_sched.php?course_id=$course_id&action=resume>Resume course</a>
|
2007-12-07 23:23:25 +00:00
|
|
|
<p>
|
|
|
|
";
|
|
|
|
|
|
|
|
page_tail();
|
|
|
|
?>
|