$COURSE_MAX_LOG_DISPLAY = 150; // days
+$COURSE_MAX_LOGS_PER_PAGE = 1000; // records
+
$COURSE_TEACHER_COLOR = "#990000"; // To hilight certain items that are teacher-only
$COURSE_LIVELOG_REFRESH = 60; // Seconds
// It is assumed that $date is the GMT time of midnight for that day,
// and so the next 86400 seconds worth of logs are printed.
- global $CFG;
+ global $CFG, $COURSE_MAX_LOGS_PER_PAGE;
if ($course->category) {
$selector = "WHERE l.course='$course->id' AND l.userid = u.id";
$count=0;
$tt = getdate(time());
$today = mktime (0, 0, 0, $tt["mon"], $tt["mday"], $tt["year"]);
+ if (($totalcountlogs = count($logs)) > $COURSE_MAX_LOGS_PER_PAGE) {
+ $totalcountlogs = "$COURSE_MAX_LOGS_PER_PAGE/$totalcountlogs";
+ }
+
echo "<P ALIGN=CENTER>";
- print_string("displayingrecords", "", count($logs));
+ print_string("displayingrecords", "", $totalcountlogs);
echo "</P>";
+
+ $countlogs = 0;
echo "<TABLE BORDER=0 ALIGN=center CELLPADDING=3 CELLSPACING=3>";
foreach ($logs as $log) {
+ $countlogs++;
+
+ if ($countlogs > $COURSE_MAX_LOGS_PER_PAGE) {
+ break;
+ }
+
if ($ld = get_record("log_display", "module", "$log->module", "action", "$log->action")) {
$log->info = get_field($ld->mtable, $ld->field, "id", $log->info);
}
/// Add a teacher if one is specified
- if ($add) {
+ if (!empty($add)) {
if (! $user = get_record("user", "id", $add)) {
error("That teacher (id = $add) doesn't exist", "teacher.php?id=$course->id");
}
- if ($teachers) {
+ if (!empty($teachers)) {
foreach ($teachers as $tt) {
if ($tt->id == $user->id) {
error("That user is already a teacher for this course.", "teacher.php?id=$course->id");
$teacher->userid = $user->id;
$teacher->course = $course->id;
- if ($teachers) {
+ if (!empty($teachers)) {
$teacher->authority = 2;
} else {
$teacher->authority = 1; // First teacher is the main teacher
}
$teacher->id = insert_record("user_teachers", $teacher);
- if (! $teacher->id) {
+ if (empty($teacher->id)) {
error("Could not add that teacher to this course!");
}
$teachers[] = $user;
/// Remove a teacher if one is specified.
- if ($remove) {
+ if (!empty($remove)) {
if (! $user = get_record("user", "id", $remove)) {
error("That teacher (id = $remove) doesn't exist", "teacher.php?id=$course->id");
}
- if ($teachers) {
+ if (!empty($teachers)) {
foreach ($teachers as $key => $tt) {
if ($tt->id == $user->id) {
remove_teacher($user->id, $course->id);
/// First, show existing teachers for this course
- if (! $teachers) {
+ if (empty($teachers)) {
echo "<P ALIGN=CENTER>$strnoexistingteachers</A>";
} else {
/// Print list of potential teachers
- if ($search) {
+ if (!empty($search)) {
$users = get_users_search($search);
+
} else {
$users = get_users_confirmed();
}
- if ($users) {
+ if (!empty($users)) {
foreach ($users as $user) { // Remove users who are already teachers
- if ($teachers) {
+ if (!empty($teachers)) {
foreach ($teachers as $teacher) {
if ($teacher->id == $user->id) {
continue 2;
}
}
- if (! $potential) {
+ if (empty($potential)) {
echo "<P ALIGN=CENTER>$strnopotentialteachers</A>";
if ($search) {
echo "<FORM ACTION=teacher.php METHOD=GET>";
}
} else {
- if ($search) {
+ if (!empty($search)) {
echo "<P ALIGN=CENTER>($strsearchresults)</P>";
}
if (count($potential) <= 20) {