]> git.mjollnir.org Git - moodle.git/commitdiff
Allow the display of course logs to be filtered by type of action.
authortjhunt <tjhunt>
Tue, 28 Mar 2006 17:33:40 +0000 (17:33 +0000)
committertjhunt <tjhunt>
Tue, 28 Mar 2006 17:33:40 +0000 (17:33 +0000)
course/lib.php
course/report/log/index.php
course/report/log/lib.php

index acd0701435bc3cc916dfca800053ad9aeecd2f1a..6014697d59c935e4e1a95cd4e6ffa14aa9489ac1 100644 (file)
@@ -303,7 +303,12 @@ function print_log($course, $user=0, $date=0, $order="l.time ASC", $page=0, $per
     }
 
     if ($modaction) {
-        $joins[] = "l.action = '$modaction'";
+        $firstletter = substr($modaction, 0, 1);
+        if (ctype_alpha($firstletter)) {
+            $joins[] = "lower(l.action) LIKE '%" . strtolower($modaction) . "%'";
+        } else if ($firstletter == '-') {
+            $joins[] = "lower(l.action) NOT LIKE '%" . strtolower(substr($modaction, 1)) . "%'";
+        }
     }
 
     /// Getting all members of a group.
index 20c1a1769f1d56acf86c4aff138b1e8a718dd1af..7649a7f80363532730341229839c69642c01b715 100644 (file)
@@ -11,7 +11,7 @@
     $date = optional_param('date', 0, PARAM_CLEAN); // Date to display
     $modname = optional_param('modname', ''); // course_module->id
     $modid = optional_param('modid', ''); // course_module->id
-    $modaction = optional_param('modaction', ''); // an action as recorded in the logs
+    $modaction = optional_param('modaction', '', PARAM_ALPHAEXT); // an action as recorded in the logs
     $page = optional_param('page', '0', PARAM_INT);     // which page to show
     $perpage = optional_param('perpage', '100', PARAM_INT); // how many per page 
     $showcourses = optional_param('showcourses',0,PARAM_INT); // whether to show courses if we're over our limit.
index c0bdc019d406de4799922e60fedbb49cbb4c328c..7491f7d0561dfb84187f529fd05c9e724c864c78 100644 (file)
@@ -113,6 +113,15 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate="today"
 
     asort($users);
 
+    // Prepare the list of action options.
+    $actions = array(
+        'view' => get_string('view'),
+        'add' => get_string('add'),
+        'update' => get_string('update'),
+        'delete' => get_string('delete'),
+        '-view' => get_string('allchanges')
+    );
+
     // Get all the possible dates
     // Note that we are keeping track of real (GMT) time and user time
     // User time is only used in displays - all calcs and passing is GMT
@@ -191,6 +200,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate="today"
     }
     choose_from_menu ($dates, "date", $selecteddate, get_string("alldays"));
     choose_from_menu ($activities, "modid", $selectedactivity, get_string("allactivities"), "", "");
+    choose_from_menu ($actions, 'modaction', $modaction, get_string("allactions"));
     echo '<input type="submit" value="'.get_string('showtheselogs').'" />';
     echo "</form>";
     echo "</center>";