/moodle-tool_time_report

Moodle admin tool to create reports of time spent online

Primary LanguagePHPGNU General Public License v3.0GPL-3.0

moodle-tool_time_report

Admin tool for Moodle creating reports of time spent online.

Installation

  1. Git clone the plugin in the admin/tool directory.
  2. Rename the plugin folder as time_report
  3. Finish the installation

Usage

Admins and users having the tool/time_report:view capability can access the reports through the user's profile (e.g. /user/profile.php?id=2), under the reports category.

The interface allow the creationg of CSV files listing

The plugin uses a cron task job to generate the reports. It is not needed to stay on the page while the report is generating.

A notification is sent to the requestor when the report is ready to be downloaded.

The name of the files are created according the following scheme : report__firstname_lastname__dd-mm-yyyy_dd-mm-yyyy.csv

UI overview :

"Time report"

    Starting date  [yyyy-mm-dd] #-> date input
    Ending date    [yyyy-mm-dd] #-> date input

    ["Create"] #-> triggers the generate_report amd script

"Generated reports list"

    report__jean_dupont__01-02-2023-20-02-2023.csv #-> downloadable file
    report__jean_dupont__10-02-2023-10-03-2023.csv #-> downloadable file
    report__jean_dupont__11-05-2023-20-09-2023.csv #-> downloadable file

["Remove files"] #-> purges the report files of the current user

Example of CSV report :

| Name                          | Dupont                 |
| First name                    | Jean                   |
| Email address                 | jd@example.com         |
| Period                        | 01/2022 - 05/2022      |
| Total duration for the period | 00:44:18               |
| Date                          | Total duration per day |
| 02/02/2022                    | 00:25:38               |
| 03/02/2022                    | 00:15:00               |
| 16/05/2022                    | 00:03:40               |

Settings

Go to Site Administration -> Reports -> Time Reports. Descriptions for the settings are as follows :

tool_time_report/targets

Defines the targets from the logstore_standard_log table that are wanted in the report. All the different kind of targets are retrived by the locallib get_targets function.

tool_time_report/idletime

Defines the time span after which the difference in time between 2 logs is considered as inactivity.

tool_time_report/borrowedtime

Defines the amount of time counted in the report that the user has after being considered inactive.

Without this, the last action of viewing a course module performed by a user (e.g. a PDF file) before his inactivity would not generate additional connection time for one day. For the benefit of the doubt, we grant a specific amount of time.

Development

amd/build/*.js and styles.css files are generated by Grunt tasks.

Run grunt watch, grunt amd or grunt sass from the root directory of Moodle to modify the files.