Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 39 and 401] [Versions 401 and 402] [Versions 401 and 403]

This file contains functions used by the log reports This files lists the functions that are used during the log report generation.

Copyright: 1999 onwards Martin Dougiamas (http://dougiamas.com)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 634 lines (25 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 1 file
 report/log/lib.php

Defines 6 functions


Functions that are not part of a class:

report_log_print_graph($course, $user, $typeormode, $date=0, $logreader='')   X-Ref
This function is used to generate and display the log activity graph

param: stdClass $course course instance
param: int|stdClass    $user id/object of the user whose logs are needed
param: string $typeormode type of logs graph needed (usercourse.png/userday.png) or the mode (today, all).
param: int $date timestamp in GMT (seconds since epoch)
param: string $logreader Log reader.
return: void

report_log_usercourse($userid, $courseid, $coursestart, $logreader = '')   X-Ref
Select all log records for a given course and user

param: int $userid The id of the user as found in the 'user' table.
param: int $courseid The id of the course as found in the 'course' table.
param: string $coursestart unix timestamp representing course start date and time.
param: string $logreader log reader to use.
return: array

report_log_userday($userid, $courseid, $daystart, $logreader = '')   X-Ref
Select all log records for a given course, user, and day

param: int $userid The id of the user as found in the 'user' table.
param: int $courseid The id of the course as found in the 'course' table.
param: string $daystart unix timestamp of the start of the day for which the logs needs to be retrived
param: string $logreader log reader to use.
return: array

report_log_print_mnet_selector_form($hostid, $course, $selecteduser=0, $selecteddate='today',$modname="", $modid=0, $modaction='', $selectedgroup=-1, $showcourses=0, $showusers=0, $logformat='showashtml')   X-Ref
This function is used to generate and display Mnet selector form

param: int      $hostid host id
param: stdClass $course course instance
param: int      $selecteduser id of the selected user
param: string   $selecteddate Date selected
param: string   $modname course_module->id
param: string   $modid number or 'site_errors'
param: string   $modaction an action as recorded in the logs
param: int      $selectedgroup Group to display
param: int      $showcourses whether to show courses if we're over our limit.
param: int      $showusers whether to show users if we're over our limit.
param: string   $logformat Format of the logs (downloadascsv, showashtml, downloadasods, downloadasexcel)
return: void

report_log_userall_data($course, $user, $logreader)   X-Ref
Fetch logs since the start of the courses and structure in series and labels to be sent to Chart API.

param: stdClass $course the course object
param: stdClass $user user object
param: string $logreader the log reader where the logs are.
return: array structured array to be sent to chart API, split in two indexes (series and labels).

report_log_usertoday_data($course, $user, $date, $logreader)   X-Ref
Fetch logs of the current day and structure in series and labels to be sent to Chart API.

param: stdClass $course the course object
param: stdClass $user user object
param: int $date A time of a day (in GMT).
param: string $logreader the log reader where the logs are.
return: array $logs structured array to be sent to chart API, split in two indexes (series and labels).