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 ""; echo ""; - if ($mode != "outline") { - echo ""; - } else { - echo ""; - } - if ($mode != "complete") { - echo ""; - } else { - echo ""; - } - if ($mode != "today") { - echo ""; - } else { - echo ""; - } - if ($mode != "alllogs") { - echo ""; - } else { - echo ""; + foreach ($modes as $listmode) { + $strmode = get_string($listmode); + if ($mode == $listmode) { + echo ""; + } else { + echo ""; + } } echo "
Reports: id&user=$user->id&mode=outline>OutlineOutlineid&user=$user->id&mode=complete>CompleteCompleteid&user=$user->id&mode=today>TodayTodayid&user=$user->id&mode=alllogs>All logsAll logs$strmodeid&user=$user->id&mode=$listmode>$strmode
"; - get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused, $modsectioncounts); switch ($mode) { - case "today" : + case "todaylogs" : echo "
"; print_log_graph($course, $user->id, "userday.png", time() ); echo "
"; diff --git a/lang/en/moodle.php b/lang/en/moodle.php index c5d844bcf45..610a2ec97fb 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -23,6 +23,7 @@ $string[choosecourse] = "Choose a course"; $string[chooseuser] = "Choose a user"; $string[city] = "City/town"; $string[confirmed] = "Your registration has been confirmed"; +$string[complete] = "Complete"; $string["continue"] = "Continue"; $string[country] = "Country"; $string[course] = "Course"; @@ -190,6 +191,7 @@ $string[numberweeks] = "Number of weeks/topics"; $string[ok] = "OK"; $string[opentoguests] = "Open to guests?"; $string[optional] = "optional"; +$string[outline] = "Outline"; $string[participants] = "Participants"; $string[password] = "Password"; $string[passwordchanged] = "Password has been changed"; diff --git a/user/view.php b/user/view.php index d891503e513..0113d121aef 100644 --- a/user/view.php +++ b/user/view.php @@ -117,7 +117,7 @@ // Print other functions echo "
"; - if (isteacher($course->id) or ($user->id == $USER->id and !isguest()) ) { + if ($course->category and (isteacher($course->id) or ($user->id == $USER->id and !isguest())) ) { echo "

"; echo "id\">"; echo "id\">";