Skip to content

Commit a2ab3b0

Browse files
author
martin
committed
More tidy ups in displays
1 parent 0087d8a commit a2ab3b0

File tree

4 files changed

+31
-25
lines changed

4 files changed

+31
-25
lines changed

course/lib.php

Lines changed: 1 addition & 0 deletions
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -121,6 +121,7 @@ function print_log($course, $user=0, $date=0, $order="ORDER BY l.time ASC") {
121

121

122
if ($course->category) {
122
if ($course->category) {
123
$selector = "WHERE l.course='$course->id' AND l.user = u.id";
123
$selector = "WHERE l.course='$course->id' AND l.user = u.id";
124+
124
} else {
125
} else {
125
$selector = "WHERE l.user = u.id"; // Show all courses
126
$selector = "WHERE l.user = u.id"; // Show all courses
126
if ($ccc = get_records_sql("SELECT * FROM course ORDER BY fullname")) {
127
if ($ccc = get_records_sql("SELECT * FROM course ORDER BY fullname")) {

course/user.php

Lines changed: 27 additions & 24 deletions
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -7,6 +7,8 @@
7
require_variable($user); // user id
7
require_variable($user); // user id
8
optional_variable($mode, "outline");
8
optional_variable($mode, "outline");
9

9

10+
$modes = array("outline", "complete", "todaylogs", "alllogs");
11+
10
if (! $course = get_record("course", "id", $id)) {
12
if (! $course = get_record("course", "id", $id)) {
11
error("Course id is incorrect.");
13
error("Course id is incorrect.");
12
}
14
}
@@ -24,42 +26,43 @@
24

26

25
add_to_log($course->id, "course", "user report", "user.php?id=$course->id&user=$user->id&mode=$mode", "$user->id");
27
add_to_log($course->id, "course", "user report", "user.php?id=$course->id&user=$user->id&mode=$mode", "$user->id");
26

28

27-
print_header("$course->shortname: Activity Report ($mode)", "$course->fullname",
29+
$stractivityreport = get_string("activityreport");
30+
$strparticipants = get_string("participants");
31+
$stroutline = get_string("outline");
32+
$strcomplete = get_string("complete");
33+
$stralllogs = get_string("alllogs");
34+
$strtodaylogs = get_string("todaylogs");
35+
$strmode = get_string($mode);
36+
37+
if ($course->category) {
38+
print_header("$course->shortname: $stractivityreport ($mode)", "$course->fullname",
28
"<A HREF=\"../course/view.php?id=$course->id\">$course->shortname</A> ->
39
"<A HREF=\"../course/view.php?id=$course->id\">$course->shortname</A> ->
29-
<A HREF=\"../user/index.php?id=$course->id\">Participants</A> ->
40+
<A HREF=\"../user/index.php?id=$course->id\">$strparticipants</A> ->
30
<A HREF=\"../user/view.php?id=$user->id&course=$course->id\">$user->firstname $user->lastname</A> ->
41
<A HREF=\"../user/view.php?id=$user->id&course=$course->id\">$user->firstname $user->lastname</A> ->
31-
Activity Report ($mode)", "");
42+
$stractivityreport -> $strmode");
43+
} else {
44+
print_header("$course->shortname: $stractivityreport ($mode)", "$course->fullname",
45+
"<A HREF=\"../user/view.php?id=$user->id&course=$course->id\">$user->firstname $user->lastname</A> ->
46+
$stractivityreport -> $strmode");
47+
}
32
print_heading("$user->firstname $user->lastname");
48
print_heading("$user->firstname $user->lastname");
33

49

34
echo "<TABLE CELLPADDING=10 ALIGN=CENTER><TR>";
50
echo "<TABLE CELLPADDING=10 ALIGN=CENTER><TR>";
35
echo "<TD>Reports: </TD>";
51
echo "<TD>Reports: </TD>";
36-
if ($mode != "outline") {
52+
foreach ($modes as $listmode) {
37-
echo "<TD><A HREF=user.php?id=$course->id&user=$user->id&mode=outline>Outline</A></TD>";
53+
$strmode = get_string($listmode);
38-
} else {
54+
if ($mode == $listmode) {
39-
echo "<TD><U>Outline</U></TD>";
55+
echo "<TD><U>$strmode</U></TD>";
40-
}
56+
} else {
41-
if ($mode != "complete") {
57+
echo "<TD><A HREF=user.php?id=$course->id&user=$user->id&mode=$listmode>$strmode</A></TD>";
42-
echo "<TD><A HREF=user.php?id=$course->id&user=$user->id&mode=complete>Complete</A></TD>";
58+
}
43-
} else {
44-
echo "<TD><U>Complete</U></TD>";
45-
}
46-
if ($mode != "today") {
47-
echo "<TD><A HREF=user.php?id=$course->id&user=$user->id&mode=today>Today</A></TD>";
48-
} else {
49-
echo "<TD><U>Today</U></TD>";
50-
}
51-
if ($mode != "alllogs") {
52-
echo "<TD><A HREF=user.php?id=$course->id&user=$user->id&mode=alllogs>All logs</A></TD>";
53-
} else {
54-
echo "<TD><U>All logs</U></TD>";
55
}
59
}
56
echo "</TR></TABLE>";
60
echo "</TR></TABLE>";
57

61

58-
59
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused, $modsectioncounts);
62
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused, $modsectioncounts);
60

63

61
switch ($mode) {
64
switch ($mode) {
62-
case "today" :
65+
case "todaylogs" :
63
echo "<HR><CENTER>";
66
echo "<HR><CENTER>";
64
print_log_graph($course, $user->id, "userday.png", time() );
67
print_log_graph($course, $user->id, "userday.png", time() );
65
echo "</CENTER>";
68
echo "</CENTER>";

lang/en/moodle.php

Lines changed: 2 additions & 0 deletions
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -23,6 +23,7 @@
23
$string[chooseuser] = "Choose a user";
23
$string[chooseuser] = "Choose a user";
24
$string[city] = "City/town";
24
$string[city] = "City/town";
25
$string[confirmed] = "Your registration has been confirmed";
25
$string[confirmed] = "Your registration has been confirmed";
26+
$string[complete] = "Complete";
26
$string["continue"] = "Continue";
27
$string["continue"] = "Continue";
27
$string[country] = "Country";
28
$string[country] = "Country";
28
$string[course] = "Course";
29
$string[course] = "Course";
@@ -190,6 +191,7 @@
190
$string[ok] = "OK";
191
$string[ok] = "OK";
191
$string[opentoguests] = "Open to guests?";
192
$string[opentoguests] = "Open to guests?";
192
$string[optional] = "optional";
193
$string[optional] = "optional";
194+
$string[outline] = "Outline";
193
$string[participants] = "Participants";
195
$string[participants] = "Participants";
194
$string[password] = "Password";
196
$string[password] = "Password";
195
$string[passwordchanged] = "Password has been changed";
197
$string[passwordchanged] = "Password has been changed";

user/view.php

Lines changed: 1 addition & 1 deletion
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -117,7 +117,7 @@
117

117

118
// Print other functions
118
// Print other functions
119
echo "<CENTER><TABLE ALIGN=CENTER><TR>";
119
echo "<CENTER><TABLE ALIGN=CENTER><TR>";
120-
if (isteacher($course->id) or ($user->id == $USER->id and !isguest()) ) {
120+
if ($course->category and (isteacher($course->id) or ($user->id == $USER->id and !isguest())) ) {
121
echo "<TD NOWRAP><P><FORM ACTION=\"../course/unenrol.php\" METHOD=GET>";
121
echo "<TD NOWRAP><P><FORM ACTION=\"../course/unenrol.php\" METHOD=GET>";
122
echo "<INPUT type=hidden name=id value=\"$course->id\">";
122
echo "<INPUT type=hidden name=id value=\"$course->id\">";
123
echo "<INPUT type=hidden name=user value=\"$user->id\">";
123
echo "<INPUT type=hidden name=user value=\"$user->id\">";

0 commit comments

Comments
 (0)