]> git.mjollnir.org Git - moodle.git/commitdiff
Added selector form at the top of the page .
authorselliott <selliott>
Thu, 5 Feb 2004 20:34:49 +0000 (20:34 +0000)
committerselliott <selliott>
Thu, 5 Feb 2004 20:34:49 +0000 (20:34 +0000)
Added logic to not display hidden activities.

course/recent.php

index 754ffc8f39311c3b72d279e0ea7c0c0e3c82e7a5..09440f788c31d1540b1dbdc772da39b30d0018f3 100644 (file)
@@ -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");
 
     $loggedinas = "<p class=\"logininfo\">".user_login_string($course, $USER)."</p>";
 
-    print_header("$course->fullname: $strrecentactivity", "$course->fullname", 
-                 "<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $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 . "<a href=\"$CFG->wwwroot/course/recent.php?id=$id&days=$count\"> $count $day</a> | ";
-    }
-    $heading = $strsince . ": <a href=\"$CFG->wwwroot/course/recent.php?id=$id\">$strlastlogin</a>" . " | " . $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",
+                         "<a href=\"view.php?id=$course->id\">$course->shortname</a> ->
+                          <a href=\"recent.php?id=$course->id\">$strrecentactivity</a> -> $userinfo, $dateinfo", "");
+        } else {
+            print_header("$course->shortname: $strrecentactivity", "$course->fullname",
+                         "<a href=\"../$CFG->admin/index.php\">$stradministration</a> ->
+                          <a href=\"recent.php?id=$course->id\">$strrecentactivity</a> -> $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",
+                     "<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $strrecentactivity", "");
+        } else {
+            print_header("$course->shortname: $strrecentactivity", "$course->fullname",
+                     "<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $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];
         
                     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 = "<img src=\"$CFG->modpixpath/$mod->modname/icon.gif\" ".
                                      "height=16 width=16 alt=\"$mod->modfullname\">";
                             echo "<h4>$image $mod->modfullname: ".
                                  "<a href=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">".
                                  "$instance->name</a></h4>";
                             echo "<ul>";
-                            $print_recent_instance_activity($instance, $timestart);
+                            $print_recent_instance_activity($instance, $date, $user);
                             echo "</ul>";
                         }
                     }
     print_footer($course);
 
 ?>
-