Moodle

Making the logs more functional by adding more actions

Details

  • Type: Sub-task Sub-task
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9.4
  • Fix Version/s: None
  • Component/s: Administration
  • Labels:
    None
  • Difficulty:
    Easy
  • Affected Branches:
    MOODLE_19_STABLE

Description

The log report function could be made more useful by simply adding a few more actions to the $actions array in course/report/log/lib.php

// Prepare the list of action options.
$actions = array(
'view' => get_string('view'),
'add' => get_string('add'),
'update' => get_string('update'),
'attempt' => 'Quizzes',
'view discussion' => 'Forum',
'delete' => get_string('delete'),
'-view' => get_string('allchanges')
);

A further enhancement would be to add another selector for the module so that all actions pertaining to a single module could be viewed.

Issue Links

Activity

Hide
Thomas Robb added a comment -

Another approach is to add the names of all of the available modules to the "Activities" tab:

/// Add this to both locations in course/report/log/lib.php
$allmods = get_records("modules");
$activities = array();
foreach ($allmods as $thismod) { $activities[$thismod->name] = "Every " . $thismod->name; }
///
$selectedactivity = "";

Then in course/lib.php modify the code like this:

/*
if ('site_errors' === $modid) { $joins[] = "( l.action='error' OR l.action='infected' )"; } else if ($modid) { $joins[] = "l.cmid = '$modid'"; }
*/
if (('site_errors' === $modid) || ('site_news' ===$modid)) {
if ('site_errors' === $modid) { $joins[] = "( l.action='error' OR l.action='infected' )"; } else if ($modid) { $joins[] = "l.cmid = '$modid'"; }
} elseif ($modid) { $joins[] = "l.module = '$modid'"; }

Show
Thomas Robb added a comment - Another approach is to add the names of all of the available modules to the "Activities" tab: /// Add this to both locations in course/report/log/lib.php $allmods = get_records("modules"); $activities = array(); foreach ($allmods as $thismod) { $activities[$thismod->name] = "Every " . $thismod->name; } /// $selectedactivity = ""; Then in course/lib.php modify the code like this: /* if ('site_errors' === $modid) { $joins[] = "( l.action='error' OR l.action='infected' )"; } else if ($modid) { $joins[] = "l.cmid = '$modid'"; } */ if (('site_errors' === $modid) || ('site_news' ===$modid)) { if ('site_errors' === $modid) { $joins[] = "( l.action='error' OR l.action='infected' )"; } else if ($modid) { $joins[] = "l.cmid = '$modid'"; } } elseif ($modid) { $joins[] = "l.module = '$modid'"; }
Hide
Anthony Borrow added a comment -

I linked this with MDL-21983 as it makes sense to include a login option. I do like the idea of making the list of actions as complete as possible and perhaps having a function to report back for each module the list of logged actions would be a way to do this - something like {modname}_get_log_actions and then in one of the central libraries we could have get_log_actions which would step through each module and/or blocks get_log_actions function. Might be a little costly but it would enhance what could be done with the logs. Peace - Anthony

Show
Anthony Borrow added a comment - I linked this with MDL-21983 as it makes sense to include a login option. I do like the idea of making the list of actions as complete as possible and perhaps having a function to report back for each module the list of logged actions would be a way to do this - something like {modname}_get_log_actions and then in one of the central libraries we could have get_log_actions which would step through each module and/or blocks get_log_actions function. Might be a little costly but it would enhance what could be done with the logs. Peace - Anthony

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated: