diff --git a/course/lib.php b/course/lib.php index c409b2fc2cb..7afdf121622 100644 --- a/course/lib.php +++ b/course/lib.php @@ -121,6 +121,7 @@ function print_log($course, $user=0, $date=0, $order="ORDER BY l.time ASC") { if ($course->category) { $selector = "WHERE l.course='$course->id' AND l.user = u.id"; + } else { $selector = "WHERE l.user = u.id"; // Show all courses if ($ccc = get_records_sql("SELECT * FROM course ORDER BY fullname")) { diff --git a/course/user.php b/course/user.php index fede41a7ca8..39995571d9c 100644 --- a/course/user.php +++ b/course/user.php @@ -7,6 +7,8 @@ require_variable($user); // user id optional_variable($mode, "outline"); + $modes = array("outline", "complete", "todaylogs", "alllogs"); + if (! $course = get_record("course", "id", $id)) { error("Course id is incorrect."); } @@ -24,42 +26,43 @@ add_to_log($course->id, "course", "user report", "user.php?id=$course->id&user=$user->id&mode=$mode", "$user->id"); - print_header("$course->shortname: Activity Report ($mode)", "$course->fullname", + $stractivityreport = get_string("activityreport"); + $strparticipants = get_string("participants"); + $stroutline = get_string("outline"); + $strcomplete = get_string("complete"); + $stralllogs = get_string("alllogs"); + $strtodaylogs = get_string("todaylogs"); + $strmode = get_string($mode); + + if ($course->category) { + print_header("$course->shortname: $stractivityreport ($mode)", "$course->fullname", "id\">$course->shortname -> - id\">Participants -> + id\">$strparticipants -> id&course=$course->id\">$user->firstname $user->lastname -> - Activity Report ($mode)", ""); + $stractivityreport -> $strmode"); + } else { + print_header("$course->shortname: $stractivityreport ($mode)", "$course->fullname", + "id&course=$course->id\">$user->firstname $user->lastname -> + $stractivityreport -> $strmode"); + } print_heading("$user->firstname $user->lastname"); echo "
Reports: | "; - if ($mode != "outline") { - echo "id&user=$user->id&mode=outline>Outline | "; - } else { - echo "Outline | "; - } - if ($mode != "complete") { - echo "id&user=$user->id&mode=complete>Complete | "; - } else { - echo "Complete | "; - } - if ($mode != "today") { - echo "id&user=$user->id&mode=today>Today | "; - } else { - echo "Today | "; - } - if ($mode != "alllogs") { - echo "id&user=$user->id&mode=alllogs>All logs | "; - } else { - echo "All logs | "; + foreach ($modes as $listmode) { + $strmode = get_string($listmode); + if ($mode == $listmode) { + echo "$strmode | "; + } else { + echo "id&user=$user->id&mode=$listmode>$strmode | "; + } } echo "