Allow the display of course logs to be filtered by type of action.

This commit is contained in:
tjhunt 2006-03-28 17:33:40 +00:00
parent 5db97a46a5
commit ee35e0b855
3 changed files with 17 additions and 2 deletions

View 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.

View 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.

View 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>";