From e7d9c966765081d2904f6d996a65d77d7e1edf0b Mon Sep 17 00:00:00 2001 From: selliott Date: Thu, 5 Feb 2004 20:34:49 +0000 Subject: [PATCH] Added selector form at the top of the page . Added logic to not display hidden activities. --- course/recent.php | 79 ++++++++++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 28 deletions(-) diff --git a/course/recent.php b/course/recent.php index 754ffc8f39..09440f788c 100644 --- a/course/recent.php +++ b/course/recent.php @@ -7,12 +7,7 @@ require_variable($id); - optional_variable($days); - $day_list = array("1","7","14","21","30"); - $strsince = get_string("since"); - $strlastlogin = get_string("lastlogin"); - $strday = get_string("day"); - $strdays = get_string("days"); + optional_variable($user); if (! $course = get_record("course", "id", $id) ) { error("That's an invalid course id"); @@ -26,36 +21,60 @@ $loggedinas = "

".user_login_string($course, $USER)."

"; - print_header("$course->fullname: $strrecentactivity", "$course->fullname", - "id\">$course->shortname -> $strrecentactivity", - "", "", true, "", $loggedinas); + if (!empty($_GET['chooserecent'])) { - get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused); + $userinfo = get_string("allparticipants"); + $dateinfo = get_string("alldays"); - $heading = ""; - foreach ($day_list as $count) { - if ($count == "1") - $day = $strday; - else - $day = $strdays; - $heading = $heading . "wwwroot/course/recent.php?id=$id&days=$count\"> $count $day | "; - } - $heading = $strsince . ": wwwroot/course/recent.php?id=$id\">$strlastlogin" . " | " . $heading; - print_heading($heading); + if ($user) { + if (!$u = get_record("user", "id", $user) ) { + error("That's an invalid user!"); + } + $userinfo = "$u->firstname $u->lastname"; + } + if ($date) + $dateinfo = userdate($date, get_string("strftimedaydate")); + + if ($course->category) { + print_header("$course->shortname: $strrecentactivity", "$course->fullname", + "id\">$course->shortname -> + id\">$strrecentactivity -> $userinfo, $dateinfo", ""); + } else { + print_header("$course->shortname: $strrecentactivity", "$course->fullname", + "admin/index.php\">$stradministration -> + id\">$strrecentactivity -> $userinfo, $dateinfo", ""); + } + + print_heading("$course->fullname: $userinfo, $dateinfo (".usertimezone().")"); + print_recent_selector_form($course, $user, $date, $modname, $modid, $modaction); - if (empty($days)) { - $timestart = $USER->lastlogin; } else { - $timestart = time() - ($days * 3600 * 24); + + if (empty($date)) { // no date picked, default to last login time + $date = $USER->lastlogin; + } + + if ($course->category) { + print_header("$course->shortname: $strrecentactivity", "$course->fullname", + "id\">$course->shortname -> $strrecentactivity", ""); + } else { + print_header("$course->shortname: $strrecentactivity", "$course->fullname", + "admin/index.php\">$stradministration -> $strrecentactivity", ""); + } + + print_heading(get_string("chooseactivity").":"); + + print_recent_selector_form($course); + } - print_heading(get_string("activitysince", "", userdate($timestart))); + get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused); $sections = get_all_sections($course->id); for ($i=0; $i<=$course->numsections; $i++) { - if (isset($sections[$i])) { // should always be true + if (isset($sections[$i]) && $sections[$i]->visible) { $section = $sections[$i]; @@ -85,14 +104,19 @@ if (file_exists($libfile)) { require_once($libfile); $print_recent_instance_activity = $mod->modname."_print_recent_instance_activity"; - if (function_exists($print_recent_instance_activity)) { + + // fix modid if a section (or week) is selected, may want to enhance to get all mods from section (or week) + if (!is_numeric($modid)) + $modid = ""; + + if (function_exists($print_recent_instance_activity) && (($mod->id == $modid) || (empty($modid)))) { $image = "modpixpath/$mod->modname/icon.gif\" ". "height=16 width=16 alt=\"$mod->modfullname\">"; echo "

$image $mod->modfullname: ". "wwwroot/mod/$mod->modname/view.php?id=$mod->id\">". "$instance->name

"; echo ""; } } @@ -106,4 +130,3 @@ print_footer($course); ?> - -- 2.39.5